1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+storage-classes/store.injectable.ts
Sebastian Malton 4504283041 Extract ClusterContext into deps for KubeObjectStore to fix circular import
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-12-19 08:16:57 -05:00

30 lines
1.4 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import assert from "assert";
import getPersistentVolumesByStorageClassInjectable from "../+storage-volumes/get-persisten-volumes-by-storage-class.injectable";
import { kubeObjectStoreInjectionToken } from "../../../common/k8s-api/api-manager/manager.injectable";
import storageClassApiInjectable from "../../../common/k8s-api/endpoints/storage-class.api.injectable";
import clusterFrameContextForClusterScopedResourcesInjectable from "../../cluster-frame-context/for-cluster-scoped-resources.injectable";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import { StorageClassStore } from "./store";
const storageClassStoreInjectable = getInjectable({
id: "storage-class-store",
instantiate: (di) => {
assert(di.inject(storesAndApisCanBeCreatedInjectable), "storageClassStore is only available in certain environments");
const api = di.inject(storageClassApiInjectable);
return new StorageClassStore({
getPersistentVolumesByStorageClass: di.inject(getPersistentVolumesByStorageClassInjectable),
context: di.inject(clusterFrameContextForClusterScopedResourcesInjectable),
}, api);
},
injectionToken: kubeObjectStoreInjectionToken,
});
export default storageClassStoreInjectable;