simplify fix

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

No files matched your search

@@ -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);
}
};
@@ -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);