Skip to content

fix(admin): case-insensitive document status filter (#832)

Jérôme Revillard requested to merge fix/832-status-filter-case into main

Root cause

Document Management tab → Status filter returned an empty list for every status.

filteredDocuments compared doc.dataprep.status against the lowercase filter option values (pending/ingested/retracted) using strict ===. But dataprep persists the status in Title Case (Ingested, Pending, Retracted — see genie-ai-overlay/dataprep/genieai_dataprep_arangodb.py), so the comparison never matched.

The identical case-sensitive comparison in showIngestButton also left the Ingest Selected button visible for already-ingested selected files.

Fix

Normalize both sides via String(...).toLowerCase().trim() — the same convention already used by getStatusVariant in this file and by the document-repository backend (fileController.js).

-const selectedStatus = this.documentFilters.status;
+const selectedStatus = String(this.documentFilters.status).toLowerCase().trim();
-return this.documents.filter((doc) => doc.dataprep && doc.dataprep.status === selectedStatus);
+return this.documents.filter(
+  (doc) => doc.dataprep && String(doc.dataprep.status).toLowerCase().trim() === selectedStatus
+);

Tests

3 regression tests added (red on old code, green after fix) using realistic Title Case dataprep.status. Full AdminDashboard.test.js suite: 109 passed.

Deployment

Bug is present on release/el-salvador too (identical code). rebase to release after this merges.

Closes #832 (closed)

Edited by Jérôme Revillard

Merge request reports

Loading