feat(dashboard): text filter for Overview workplans chart
Add a search field next to the Workplans by Repository mode selector so operators can narrow large lists by title, repo, domain, filename, or owner.
This commit is contained in:
parent
c363549388
commit
b5747d1104
4 changed files with 111 additions and 2 deletions
22
dashboard/src/components/workplan-search.js
Normal file
22
dashboard/src/components/workplan-search.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Case-insensitive substring match for Overview "Workplans by Repository".
|
||||
* Matches title, repo, domain, filename, owner, and id.
|
||||
*
|
||||
* @param {object} workplan Row from overview workplan_rows
|
||||
* @param {string} query Free-text filter
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function workplanMatchesSearch(workplan, query) {
|
||||
const q = String(query ?? "").trim().toLowerCase();
|
||||
if (!q) return true;
|
||||
if (!workplan || typeof workplan !== "object") return false;
|
||||
const haystack = [
|
||||
workplan.title,
|
||||
workplan.repo_label,
|
||||
workplan.domain,
|
||||
workplan.workplan_filename,
|
||||
workplan.owner,
|
||||
workplan.id,
|
||||
].filter(Boolean).join("\n").toLowerCase();
|
||||
return haystack.includes(q);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue