mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow to pass KubeObjectStore.api via constructor (#3596)
* allow to pass KubeObjectStore.api via constructor Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cleanup Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * remove throw for backward compat reasons Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
443186d4f5
commit
be6df7d25a
@ -42,7 +42,7 @@ export interface KubeObjectStoreLoadingParams<K extends KubeObject> {
|
|||||||
export abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T> {
|
export abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T> {
|
||||||
static defaultContext = observable.box<ClusterContext>(); // TODO: support multiple cluster contexts
|
static defaultContext = observable.box<ClusterContext>(); // TODO: support multiple cluster contexts
|
||||||
|
|
||||||
abstract api: KubeApi<T>;
|
public api: KubeApi<T>;
|
||||||
public readonly limit?: number;
|
public readonly limit?: number;
|
||||||
public readonly bufferSize: number = 50000;
|
public readonly bufferSize: number = 50000;
|
||||||
@observable private loadedNamespaces?: string[];
|
@observable private loadedNamespaces?: string[];
|
||||||
@ -55,8 +55,10 @@ export abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T>
|
|||||||
return when(() => Boolean(this.loadedNamespaces));
|
return when(() => Boolean(this.loadedNamespaces));
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor(api?: KubeApi<T>) {
|
||||||
super();
|
super();
|
||||||
|
if (api) this.api = api;
|
||||||
|
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
autoBind(this);
|
autoBind(this);
|
||||||
this.bindWatchEventsUpdater();
|
this.bindWatchEventsUpdater();
|
||||||
|
|||||||
@ -24,10 +24,7 @@ import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
|||||||
import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||||
|
|
||||||
export class CRDResourceStore<K extends KubeObject> extends KubeObjectStore<K> {
|
export class CRDResourceStore<K extends KubeObject> extends KubeObjectStore<K> {
|
||||||
api: KubeApi<K>;
|
|
||||||
|
|
||||||
constructor(api: KubeApi<K>) {
|
constructor(api: KubeApi<K>) {
|
||||||
super();
|
super(api);
|
||||||
this.api = api;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user