Skip to content

Commit

Permalink
frontend: k8s: Sort namespaces in UI
Browse files Browse the repository at this point in the history
This change alphabetically sorts namespaces in the UI, addressing the
case where namespace lists from k3d/k3s clusters are not sorted by
default.

Fixes: #2656

Signed-off-by: Evangelos Skopelitis <[email protected]>
  • Loading branch information
skoeva committed Dec 17, 2024
1 parent c97a07c commit 01324b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/components/common/NamespacesAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ function NamespacesFromClusterAutocomplete(
) {
const [namespacesList] = Namespace.useList();
const namespaceNames = useMemo(
() => namespacesList?.map(namespace => namespace.metadata.name) ?? [],
() =>
namespacesList
?.map(namespace => namespace.metadata.name)
.slice()
.sort((a, b) => a.localeCompare(b)) ?? [],
[namespacesList]
);

Expand Down

0 comments on commit 01324b5

Please sign in to comment.