mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Implement contextNamespaces logic in forNamespacedResources
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
7f6b946ce3
commit
410d66ac0f
@ -8,6 +8,7 @@ import namespaceStoreInjectable from "../components/+namespaces/store.injectable
|
||||
import hostedClusterInjectable from "./hosted-cluster.injectable";
|
||||
import assert from "assert";
|
||||
import { computed } from "mobx";
|
||||
import selectedNamespacesStorageInjectable from "../../features/namespace-filtering/renderer/storage.injectable";
|
||||
|
||||
const clusterFrameContextForNamespacedResourcesInjectable = getInjectable({
|
||||
id: "cluster-frame-context-for-namespaced-resources",
|
||||
@ -15,6 +16,7 @@ const clusterFrameContextForNamespacedResourcesInjectable = getInjectable({
|
||||
instantiate: (di): ClusterContext => {
|
||||
const cluster = di.inject(hostedClusterInjectable);
|
||||
const namespaceStore = di.inject(namespaceStoreInjectable);
|
||||
const selectedNamespacesStorage = di.inject(selectedNamespacesStorageInjectable);
|
||||
|
||||
assert(cluster, "This can only be injected within a cluster frame");
|
||||
|
||||
@ -32,7 +34,13 @@ const clusterFrameContextForNamespacedResourcesInjectable = getInjectable({
|
||||
// fallback to cluster resolved namespaces because we could not load list
|
||||
return cluster.allowedNamespaces.slice();
|
||||
});
|
||||
const contextNamespaces = computed(() => namespaceStore.contextNamespaces);
|
||||
const contextNamespaces = computed(() => {
|
||||
const selectedNamespaces = selectedNamespacesStorage.get();
|
||||
|
||||
return selectedNamespaces.length > 0
|
||||
? selectedNamespaces
|
||||
: allNamespaces.get();
|
||||
});
|
||||
const hasSelectedAll = computed(() => {
|
||||
const namespaces = new Set(contextNamespaces.get());
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user