Skip to content

Commit

Permalink
Fix cluster sort on Overview list view
Browse files Browse the repository at this point in the history
  • Loading branch information
jshaughn committed Sep 14, 2023
1 parent 52b15ba commit e468367
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions frontend/src/pages/Overview/Sorts.ts
Expand Up @@ -88,6 +88,23 @@ export const sortFields: SortField<NamespaceInfo>[] = [
// default comparison fallback
return a.name.localeCompare(b.name);
}
},
{
id: 'cluster',
title: 'Cluster',
isNumeric: false,
param: 'cl',
compare: (a: NamespaceInfo, b: NamespaceInfo) => {
if (a.cluster && b.cluster) {
let sortValue = a.cluster.localeCompare(b.cluster);
if (sortValue === 0) {
sortValue = a.name.localeCompare(b.name);
}
return sortValue;
} else {
return 0;
}
}
}
];

Expand Down

0 comments on commit e468367

Please sign in to comment.