mirror of
https://github.com/kunkunsh/kunkun-ext-neohtop.git
synced 2025-04-20 05:29:14 +00:00
Merge pull request #60 from andrewjanssen/enhanced-search
Search processes with comma-separated queries, incl regexes
This commit is contained in:
commit
23b1171083
@ -22,6 +22,12 @@
|
|||||||
- 💻 CPU and Memory usage tracking
|
- 💻 CPU and Memory usage tracking
|
||||||
- 🎨 Beautiful, modern UI with dark/light themes
|
- 🎨 Beautiful, modern UI with dark/light themes
|
||||||
- 🔍 Process search and filtering
|
- 🔍 Process search and filtering
|
||||||
|
|
||||||
|
Search for processes by name, command, or PID. Search for multiple things at once by separating them with commas. For
|
||||||
|
example, `arm, x86` will return processes having `arm` or `x86` as a substring of the name or command. You can use
|
||||||
|
regular expressions too. For example, `d$` will return a list of daemons (which tend to end in the letter `d`), while
|
||||||
|
`(\w+)\.\w+` will return a list of processes with reverse domain name notation, such as `com.docker.vmnetd`.
|
||||||
|
|
||||||
- 📌 Pin important processes
|
- 📌 Pin important processes
|
||||||
- 🛠 Process management (kill processes)
|
- 🛠 Process management (kill processes)
|
||||||
- 🎯 Sort by any column
|
- 🎯 Sort by any column
|
||||||
|
@ -60,11 +60,22 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$: filteredProcesses = processes.filter((process) => {
|
$: filteredProcesses = processes.filter((process) => {
|
||||||
const matchesSearch = searchTerm
|
let matchesSearch = searchTerm.length === 0;
|
||||||
? process.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
searchTerm
|
||||||
process.command.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
.split(",")
|
||||||
process.pid.toString().includes(searchTerm)
|
.map((term) => term.trim())
|
||||||
: true;
|
.forEach((term) => {
|
||||||
|
const nameSubstringMatch = process.name
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(term.toLowerCase());
|
||||||
|
const nameRegexMatch = new RegExp(term, "i").test(process.name);
|
||||||
|
const commandMatch = process.command
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(term.toLowerCase());
|
||||||
|
const pidMatch = process.pid.toString().includes(term);
|
||||||
|
matchesSearch ||=
|
||||||
|
nameSubstringMatch || nameRegexMatch || commandMatch || pidMatch;
|
||||||
|
});
|
||||||
|
|
||||||
const matchesStatus =
|
const matchesStatus =
|
||||||
statusFilter === "all" ? true : process.status === statusFilter;
|
statusFilter === "all" ? true : process.status === statusFilter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user