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
42
dashboard/test/workplan-search.test.mjs
Normal file
42
dashboard/test/workplan-search.test.mjs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import {readFileSync} from "node:fs";
|
||||
import {dirname, join} from "node:path";
|
||||
import {fileURLToPath} from "node:url";
|
||||
|
||||
import {workplanMatchesSearch} from "../src/components/workplan-search.js";
|
||||
|
||||
const root = dirname(fileURLToPath(import.meta.url));
|
||||
const indexMd = readFileSync(join(root, "../src/index.md"), "utf-8");
|
||||
|
||||
const sample = {
|
||||
id: "abc-123",
|
||||
title: "Overview Workstream Stage Counts",
|
||||
repo_label: "state-hub",
|
||||
domain: "infotech",
|
||||
workplan_filename: "STATE-WP-0057-overview-workstream-stage-counts.md",
|
||||
owner: "codex",
|
||||
};
|
||||
|
||||
test("empty query matches all workplans", () => {
|
||||
assert.equal(workplanMatchesSearch(sample, ""), true);
|
||||
assert.equal(workplanMatchesSearch(sample, " "), true);
|
||||
assert.equal(workplanMatchesSearch(sample, null), true);
|
||||
});
|
||||
|
||||
test("matches title, repo, domain, filename, owner, and id", () => {
|
||||
assert.equal(workplanMatchesSearch(sample, "stage counts"), true);
|
||||
assert.equal(workplanMatchesSearch(sample, "STATE-HUB"), true);
|
||||
assert.equal(workplanMatchesSearch(sample, "Infotech"), true);
|
||||
assert.equal(workplanMatchesSearch(sample, "wp-0057"), true);
|
||||
assert.equal(workplanMatchesSearch(sample, "codex"), true);
|
||||
assert.equal(workplanMatchesSearch(sample, "abc-123"), true);
|
||||
assert.equal(workplanMatchesSearch(sample, "railiance"), false);
|
||||
});
|
||||
|
||||
test("overview chart wires the text filter into Workplans by Repository", () => {
|
||||
assert.match(indexMd, /workplanMatchesSearch/);
|
||||
assert.match(indexMd, /ws-search-input/);
|
||||
assert.match(indexMd, /Filter by title, repo, domain/);
|
||||
assert.match(indexMd, /## Workplans by Repository/);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue