mirror of
https://github.com/kunkunsh/kunkun-ext-neohtop.git
synced 2025-04-11 17:29:45 +00:00
Search processes with comma-separated queries, incl regexes
This commit is contained in:
parent
ce69f52fad
commit
934b0f46b7
@ -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