From a4c16705a26d558ebbe35b88dbb9d766a3e1ce6d Mon Sep 17 00:00:00 2001 From: Nick Gerace Date: Wed, 4 Dec 2024 11:17:39 -0500 Subject: [PATCH] Fix filter option sorting for audit dashboard With this commit, the filter options should be sorted alphabetically, like they were in the past. Signed-off-by: Nick Gerace --- app/web/src/store/logs.store.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/web/src/store/logs.store.ts b/app/web/src/store/logs.store.ts index 048841a278..4359278529 100644 --- a/app/web/src/store/logs.store.ts +++ b/app/web/src/store/logs.store.ts @@ -150,7 +150,9 @@ export const useLogsStore = (forceChangeSetId?: ChangeSetId) => { Object.keys(inProgressChangeSets).forEach((key) => { resultForChangeSet.push({ label: key, value: key }); }); - resultForChangeSet.sort(); + resultForChangeSet.sort((a, b) => + a.label.localeCompare(b.label), + ); this.headerOptions.changeSet = resultForChangeSet; const resultForEntityName: { label: string; value: string }[] = @@ -158,7 +160,9 @@ export const useLogsStore = (forceChangeSetId?: ChangeSetId) => { Object.keys(inProgressEntityNames).forEach((key) => { resultForEntityName.push({ label: key, value: key }); }); - resultForEntityName.sort(); + resultForEntityName.sort((a, b) => + a.label.localeCompare(b.label), + ); this.headerOptions.entityName = resultForEntityName; const resultForEntityType: { label: string; value: string }[] = @@ -166,21 +170,23 @@ export const useLogsStore = (forceChangeSetId?: ChangeSetId) => { Object.keys(inProgressEntityTypes).forEach((key) => { resultForEntityType.push({ label: key, value: key }); }); - resultForEntityType.sort(); + resultForEntityType.sort((a, b) => + a.label.localeCompare(b.label), + ); this.headerOptions.entityType = resultForEntityType; const resultForTitle: { label: string; value: string }[] = []; Object.keys(inProgressTitles).forEach((key) => { resultForTitle.push({ label: key, value: key }); }); - resultForTitle.sort(); + resultForTitle.sort((a, b) => a.label.localeCompare(b.label)); this.headerOptions.title = resultForTitle; const resultForUser: { label: string; value: string }[] = []; Object.keys(inProgressUsers).forEach((key) => { resultForUser.push({ label: key, value: key }); }); - resultForUser.sort(); + resultForUser.sort((a, b) => a.label.localeCompare(b.label)); this.headerOptions.user = resultForUser; }, });