mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
moving store to v1
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
parent
4dad9eec13
commit
00c9358775
@ -1,7 +1,7 @@
|
|||||||
import { computed, reaction } from "mobx";
|
import { computed, reaction } from "mobx";
|
||||||
import { KubeObjectStore } from "../../kube-object.store";
|
import { KubeObjectStore } from "../../kube-object.store";
|
||||||
import { autobind } from "../../utils";
|
import { autobind } from "../../utils";
|
||||||
import { crdBetaApi, CustomResourceDefinition } from "../../api/endpoints/crd.api";
|
import { CustomResourceDefinition, crdApi } from "../../api/endpoints/crd.api";
|
||||||
import { apiManager } from "../../api/api-manager";
|
import { apiManager } from "../../api/api-manager";
|
||||||
import { KubeApi } from "../../api/kube-api";
|
import { KubeApi } from "../../api/kube-api";
|
||||||
import { CRDResourceStore } from "./crd-resource.store";
|
import { CRDResourceStore } from "./crd-resource.store";
|
||||||
@ -9,15 +9,18 @@ import { KubeObject } from "../../api/kube-object";
|
|||||||
|
|
||||||
function initStore(crd: CustomResourceDefinition) {
|
function initStore(crd: CustomResourceDefinition) {
|
||||||
const apiBase = crd.getResourceApiBase();
|
const apiBase = crd.getResourceApiBase();
|
||||||
const [kind, isNamespaced] = [crd.getResourceKind(), crd.isNamespaced()];
|
const kind = crd.getResourceKind();
|
||||||
|
const isNamespaced = crd.isNamespaced();
|
||||||
const api = apiManager.getApi(apiBase) || new KubeApi({ apiBase, kind, isNamespaced });
|
const api = apiManager.getApi(apiBase) || new KubeApi({ apiBase, kind, isNamespaced });
|
||||||
const store = apiManager.getStore(api) || new CRDResourceStore(api);
|
|
||||||
apiManager.registerStore(api, store);
|
if (!apiManager.getStore(api)) {
|
||||||
|
apiManager.registerStore(api, new CRDResourceStore(api));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind()
|
@autobind()
|
||||||
export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
||||||
api = crdBetaApi
|
api = crdApi
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -61,4 +64,4 @@ export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
|||||||
|
|
||||||
export const crdStore = new CRDStore();
|
export const crdStore = new CRDStore();
|
||||||
|
|
||||||
apiManager.registerStore(crdBetaApi, crdStore);
|
apiManager.registerStore(crdApi, crdStore);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user