1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix NamespaceSelectFilter all namespaces button

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-10-07 09:58:47 -04:00
parent ae96ae7d50
commit 3bdb3dfba9
2 changed files with 12 additions and 2 deletions

View File

@ -121,7 +121,7 @@ export class NamespaceSelectFilter extends React.Component<SelectProps> {
namespaceStore.toggleSingle(namespace);
}
} else {
namespaceStore.toggleAll(true); // "All namespaces" clicked
namespaceStore.selectAll();
}
};

View File

@ -149,7 +149,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
}
@computed get hasAllContexts(): boolean {
return this.selectedNamespaces.length === this.allowedNamespaces.length;
return this.contextNamespaces.length === this.allowedNamespaces.length;
}
@action
@ -167,8 +167,18 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
this.selectNamespaces(namespace);
}
@action
selectAll() {
this.selectNamespaces([]); // Empty array means "all"
}
/**
* @deprecated This function is broken, `showAll` is opposite of what
*/
@action
toggleAll(showAll?: boolean) {
console.warn("NamespaceStore.toggleAll is deprecated. Use selectAll");
if (typeof showAll === "boolean") {
if (showAll) {
this.selectNamespaces(this.allowedNamespaces);