aboutsummaryrefslogtreecommitdiff
path: root/web/frontend/data-quality.ts
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-24 09:06:37 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-24 09:06:37 +0200
commit7f33c7c55773663a0c7fe30585e2099d4b5ba6d2 (patch)
treeb11329627aaddb085ae96253d0e896c30054edcd /web/frontend/data-quality.ts
parent08fdd6964fd9ef29356420b035e2d186546f674a (diff)
Add data quality bulk categorisation page
Diffstat (limited to 'web/frontend/data-quality.ts')
-rw-r--r--web/frontend/data-quality.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/web/frontend/data-quality.ts b/web/frontend/data-quality.ts
new file mode 100644
index 0000000..32c3563
--- /dev/null
+++ b/web/frontend/data-quality.ts
@@ -0,0 +1,31 @@
+function initDataQuality(): void {
+ const form = document.getElementById("data-quality-form") as HTMLFormElement | null;
+ const selectAll = document.getElementById("data-quality-select-all") as HTMLInputElement | null;
+ const counter = document.getElementById("data-quality-selected");
+ if (!form || !selectAll) return;
+ const checkboxes = Array.from(form.querySelectorAll<HTMLInputElement>("input.data-quality-checkbox"));
+
+ function updateCount(): void {
+ const selected = checkboxes.filter((c) => c.checked).length;
+ if (counter) counter.textContent = `${selected} selected`;
+ const allChecked = selected === checkboxes.length && checkboxes.length > 0;
+ const noneChecked = selected === 0;
+ selectAll!.checked = allChecked;
+ selectAll!.indeterminate = !allChecked && !noneChecked;
+ }
+
+ selectAll!.addEventListener("change", () => {
+ for (const cb of checkboxes) cb.checked = selectAll!.checked;
+ updateCount();
+ });
+
+ for (const cb of checkboxes) cb.addEventListener("change", updateCount);
+
+ updateCount();
+}
+
+if (document.readyState === "loading") {
+ document.addEventListener("DOMContentLoaded", initDataQuality);
+} else {
+ initDataQuality();
+}