1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+namespaces/store.injectable.ts
Sebastian Malton bb7bdf2264
Remove kludge from KubeApi (#6867)
* Add support for concating iterators

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make clear the seperation of extenal and internal stores and apis

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove old kludge

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add kludge to extension api to maintain functionality

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix imports

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix KubeApi tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add failing test to maintain behaviour

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests for KubeApi

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix build

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix reactively-hide-kube-object-detail-item tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add some technical tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* More clear apiBase initialization

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2023-01-11 10:50:16 -05:00

36 lines
1.7 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 { NamespaceStore } from "./store";
import { kubeObjectStoreInjectionToken } from "../../../common/k8s-api/api-manager/kube-object-store-token";
import createStorageInjectable from "../../utils/create-storage/create-storage.injectable";
import namespaceApiInjectable from "../../../common/k8s-api/endpoints/namespace.api.injectable";
import assert from "assert";
import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-created.injectable";
import clusterFrameContextForClusterScopedResourcesInjectable from "../../cluster-frame-context/for-cluster-scoped-resources.injectable";
import clusterConfiguredAccessibleNamespacesInjectable from "../../cluster/accessible-namespaces.injectable";
import loggerInjectable from "../../../common/logger.injectable";
const namespaceStoreInjectable = getInjectable({
id: "namespace-store",
instantiate: (di) => {
assert(di.inject(storesAndApisCanBeCreatedInjectable), "namespaceStore is only available in certain environments");
const createStorage = di.inject(createStorageInjectable);
const api = di.inject(namespaceApiInjectable);
return new NamespaceStore({
context: di.inject(clusterFrameContextForClusterScopedResourcesInjectable),
storage: createStorage<string[] | undefined>("selected_namespaces", undefined),
clusterConfiguredAccessibleNamespaces: di.inject(clusterConfiguredAccessibleNamespacesInjectable),
logger: di.inject(loggerInjectable),
}, api);
},
injectionToken: kubeObjectStoreInjectionToken,
});
export default namespaceStoreInjectable;