proper select-all option for NamespaceSelect (#2084)

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman authored and GitHub committed 2021-02-04 19:24:39 +02:00
1 parent ad6de71826
commit b514e5c833
3 files changed
+22 -5

No files matched your search

@@ -85,10 +85,9 @@ export class NamespaceSelectFilter extends React.Component {
const namespaces = namespaceStore.getContextNamespaces();
switch (namespaces.length) {
case 0:
case namespaceStore.allowedNamespaces.length:
return <>All namespaces</>;
case 0:
return <>Select a namespace</>;
case 1:
return <>Namespace: {namespaces[0]}</>;
default:
@@ -116,7 +115,7 @@ export class NamespaceSelectFilter extends React.Component {
if (namespace) {
namespaceStore.toggleContext(namespace);
} else {
namespaceStore.toggleAll(); // "All namespaces" option clicked
namespaceStore.resetContext(); // "All namespaces" clicked, empty list considered as "all"
}
};