From c28b56e1c118bfca23f9e4d2f514f9ffc9189935 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 3 Mar 2023 16:41:34 -0500 Subject: [PATCH] Mark many NamespaceStore methods as deprecated Signed-off-by: Sebastian Malton --- .../renderer/components/+namespaces/store.ts | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/core/src/renderer/components/+namespaces/store.ts b/packages/core/src/renderer/components/+namespaces/store.ts index dac4445f31..1d8656a879 100644 --- a/packages/core/src/renderer/components/+namespaces/store.ts +++ b/packages/core/src/renderer/components/+namespaces/store.ts @@ -30,6 +30,9 @@ export class NamespaceStore extends KubeObjectStore { autoBind(this); } + /** + * @deprecated + */ public onContextChange(callback: (namespaces: string[]) => void, opts: { fireImmediately?: boolean } = {}): IReactionDisposer { return reaction(() => Array.from(this.contextNamespaces), callback, { fireImmediately: opts.fireImmediately, @@ -45,12 +48,16 @@ export class NamespaceStore extends KubeObjectStore { return this.dependencies.storage.get() ?? []; } + /** + * @deprecated + */ @computed get allowedNamespaces(): string[] { return this.items.map(item => item.getName()); } /** * The list of selected namespace names (for filtering) + * @deprecated */ @computed get contextNamespaces() { if (!this.selectedNamespaces.length) { @@ -62,6 +69,7 @@ export class NamespaceStore extends KubeObjectStore { /** * The set of select namespace names (for filtering) + * @deprecated */ @computed get selectedNames(): Set { return new Set(this.contextNamespaces); @@ -72,6 +80,7 @@ export class NamespaceStore extends KubeObjectStore { * * Namely, this will be true if the user has deselected all namespaces from * the filter or if the user has clicked the "All Namespaces" option + * @deprecated */ @computed get areAllSelectedImplicitly(): boolean { return this.selectedNamespaces.length === 0; @@ -101,12 +110,18 @@ export class NamespaceStore extends KubeObjectStore { return super.loadItems(params); } + /** + * @deprecated + */ @action selectNamespaces = (namespace: string | string[]) => { const namespaces = Array.from(new Set([namespace].flat())); this.dependencies.storage.set(namespaces); }; + /** + * @deprecated + */ @action clearSelected(namespaces?: string | string[]) { if (namespaces) { @@ -120,6 +135,7 @@ export class NamespaceStore extends KubeObjectStore { } /** + * @deprecated * Checks if namespace names are selected for filtering * @param namespaces One or several names of namespaces to check if they are selected * @returns `true` if all the provided names are selected @@ -131,6 +147,7 @@ export class NamespaceStore extends KubeObjectStore { } /** + * @deprecated * Is `true` if all available namespaces are selected, otherwise `false` */ @computed get hasAllContexts(): boolean { @@ -138,6 +155,7 @@ export class NamespaceStore extends KubeObjectStore { } /** + * @deprecated * Acts like `toggleSingle` but can work on several at a time * @param namespaces One or many names of namespaces to select */ @@ -153,6 +171,7 @@ export class NamespaceStore extends KubeObjectStore { } /** + * @deprecated * Toggles the selection state of `namespace`. Namely, if it was previously * specifically or implicitly selected then after this call it will be * explicitly deselected. @@ -166,6 +185,7 @@ export class NamespaceStore extends KubeObjectStore { } /** + * @deprecated * Makes the given namespace the sole selected namespace */ selectSingle(namespace: string) { @@ -173,6 +193,7 @@ export class NamespaceStore extends KubeObjectStore { } /** + * @deprecated * Selects all available namespaces. * * Note: If new namespaces appear in the future those will be selected too @@ -202,12 +223,6 @@ export class NamespaceStore extends KubeObjectStore { children: children.map(this.getNamespaceTree), }; } - - @action - async remove(item: Namespace) { - await super.remove(item); - this.clearSelected(item.getName()); - } } export function getDummyNamespace(name: string) {