feat: tableau de bord classeur - plages nommees, TCD/graphiques et KPI par feuille #153

A17 — nouveau endpoint GET /api/file/{vault}/xlsx/dashboard (read_workbook_
dashboard : plages nommees avec portee depuis defined_names read_only,
comptage graphiques/TCD par parts OPC, stats par feuille bornées 500x40 :
cellules/lignes/colonnes/formules/numerique + 8 premieres valeurs en cartes
KPI) et panneau frontend toggled depuis la toolbar (table des plages,
cartes KPI par feuille, hint actions IA). Bouton absent pour .csv et
formats en lecture seule ; le menu structure est saute quand le bouton
n'existe pas. i18n FR/EN (xlsx.dashboard_*), 8 tests backend + 2 tests
JSDOM + contre-preuve (5 echecs sur neutralisation), ruff/mypy 0.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
This commit is contained in:
2026-09-28 16:40:09 -04:00
parent ca6407e0c0
commit c4b8e66206
18 changed files with 562 additions and 15 deletions
+44
View File
@@ -648,6 +648,50 @@ await test("the 409 lossy flow re-emits with force after confirmation", async ()
assert.equal(calls[1].body.force, true);
});
// ── A17 — dashboard panel ─────────────────────────────────────────────
await test("the dashboard button fetches the metadata and renders named ranges + KPIs", async () => {
const area = mount();
const dashBtn = area.querySelector("#xlsx-dashboard-btn");
assert.ok(dashBtn, "the dashboard button exists for an editable workbook");
apiQueue.push({
ok: true,
status: 200,
body: {
vault: "V",
path: "data.xlsx",
named_ranges: [{ name: "MaPlage", scope: "", ref: "Data!$A$1:$B$5" }],
objects: { charts: 2, pivots: 1 },
sheets: [{ name: "Feuille1", cells: 9, rows: 3, cols: 3, formulas: 1, numeric: 2, kpi: [{ label: "A2", value: 12 }] }],
},
});
dashBtn.click();
await new Promise((r) => setTimeout(r, 5));
assert.match(calls[0].url, /\/xlsx\/dashboard\?path=data\.xlsx/);
const panel = area.querySelector(".xlsx-dashboard");
assert.ok(panel, "the dashboard panel is rendered");
assert.ok(panel.textContent.includes("MaPlage"), "named range is listed");
assert.ok(panel.textContent.includes("A2"), "KPI label is rendered");
assert.ok(panel.textContent.includes("12"), "KPI value is rendered");
// Second click closes the panel.
dashBtn.click();
assert.equal(area.querySelector(".xlsx-dashboard"), null, "panel toggles closed");
});
await test("a csv mounts without the dashboard button", () => {
const area = document.getElementById("content-area");
area.innerHTML = "";
renderXlsxViewer(area, {
vault: "V",
path: "data.csv",
is_csv: true,
xlsx_sheets: [{ name: "Feuille1", html: sheetHtml("100") }],
xlsx_lossy_features: [],
});
assert.equal(area.querySelector("#xlsx-dashboard-btn"), null, "no dashboard for csv");
assert.equal(area.querySelector("#xlsx-structure-btn"), null, "no structure menu for csv");
assert.ok(area.querySelector("td[data-cell=\"A1\"]"), "the grid is still editable");
});
await test("two windows in a row walk the whole sheet", async () => {
const area = mountTruncated({ total: 1200 });
apiQueue.push({