diff --git a/src/common/k8s-api/api-manager.ts b/src/common/k8s-api/api-manager.ts index d4fa4bc707..59f004009f 100644 --- a/src/common/k8s-api/api-manager.ts +++ b/src/common/k8s-api/api-manager.ts @@ -11,16 +11,16 @@ import type { KubeApi } from "./kube-api"; import type { KubeObject } from "./kube-object"; import { IKubeObjectRef, parseKubeApi, createKubeApiURL } from "./kube-api-parse"; -export class ApiManager { - private apis = observable.map>(); - private stores = observable.map>(); +export class ApiManager { + private apis = observable.map>(); + private stores = observable.map>(); constructor() { makeObservable(this); autoBind(this); } - getApi(pathOrCallback: string | ((api: KubeApi) => boolean)) { + getApi(pathOrCallback: string | ((api: KubeApi) => boolean)) { if (typeof pathOrCallback === "string") { return this.apis.get(pathOrCallback) || this.apis.get(parseKubeApi(pathOrCallback).apiBase); } @@ -32,7 +32,7 @@ export class ApiManager { return iter.find(this.apis.values(), api => api.kind === kind && api.apiVersionWithGroup === apiVersion); } - registerApi(apiBase: string, api: KubeApi) { + registerApi(apiBase: string, api: KubeApi) { if (!api.apiBase) return; if (!this.apis.has(apiBase)) { @@ -46,13 +46,13 @@ export class ApiManager { } } - protected resolveApi(api?: string | KubeApi): KubeApi | undefined { + protected resolveApi(api?: string | KubeApi): KubeApi | undefined { if (!api) { return undefined; } if (typeof api === "string") { - return this.getApi(api) as KubeApi; + return this.getApi(api) as KubeApi; } return api; @@ -75,7 +75,7 @@ export class ApiManager { }); } - getStore>(api: string | KubeApi): S | undefined { + getStore>(api: string | KubeApi): S | undefined { return this.stores.get(this.resolveApi(api)?.apiBase) as S; }