From e46836769a2aa8588bcadeba39844f96d3072705 Mon Sep 17 00:00:00 2001 From: Jay Shaughnessy Date: Thu, 7 Sep 2023 17:35:38 -0400 Subject: [PATCH] Fix cluster sort on Overview list view https://github.com/kiali/kiali/issues/6504 --- frontend/src/pages/Overview/Sorts.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frontend/src/pages/Overview/Sorts.ts b/frontend/src/pages/Overview/Sorts.ts index 88ae2a89fc..99817be85e 100644 --- a/frontend/src/pages/Overview/Sorts.ts +++ b/frontend/src/pages/Overview/Sorts.ts @@ -88,6 +88,23 @@ export const sortFields: SortField[] = [ // 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; + } + } } ];