mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Respect static list of allowed namespaces (#1639)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
67f3f83610
commit
29f2497d48
2 files changed
+14
-2
No files matched your search
@@ -5,6 +5,7 @@ import { Namespace, namespacesApi } from "../../api/endpoints";
|
||||
import { IQueryParams, navigation, setQueryParams } from "../../navigation";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { isAllowedResource } from "../../../common/rbac";
|
||||
import { getHostedCluster } from "../../../common/cluster-store";
|
||||
|
||||
@autobind()
|
||||
export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
@@ -41,6 +42,17 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
};
|
||||
}
|
||||
|
||||
subscribe(apis = [this.api]) {
|
||||
const { allowedNamespaces } = getHostedCluster();
|
||||
|
||||
// if user has given static list of namespaces let's not start watches because watch adds stuff that's not wanted
|
||||
if (allowedNamespaces.length > 0) {
|
||||
return () => { return; };
|
||||
}
|
||||
|
||||
return super.subscribe(apis);
|
||||
}
|
||||
|
||||
protected updateUrl(namespaces: string[]) {
|
||||
setQueryParams({ namespaces }, { replace: true });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user