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

simplify fix

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-10-28 08:18:52 -04:00
parent 3bdb3dfba9
commit 8c8bb94e0f
2 changed files with 5 additions and 12 deletions

View File

@ -121,7 +121,10 @@ export class NamespaceSelectFilter extends React.Component<SelectProps> {
namespaceStore.toggleSingle(namespace);
}
} else {
namespaceStore.selectAll();
/**
* WARNING: only ever call this method with `false` as an argument
*/
namespaceStore.toggleAll(false);
}
};

View File

@ -149,7 +149,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
}
@computed get hasAllContexts(): boolean {
return this.contextNamespaces.length === this.allowedNamespaces.length;
return this.selectedNamespaces.length === this.allowedNamespaces.length;
}
@action
@ -167,18 +167,8 @@ 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);