mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Split UserManagement into seperate Cluster and Namespace Roles and RoleBindings (#2755)
This commit is contained in:
1 parent
1ed7892b26
commit
a1a1c240e9
69 files changed
+2896
-901
No files matched your search
@@ -32,14 +32,12 @@ import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||
|
||||
interface Props extends SelectProps {
|
||||
showIcons?: boolean;
|
||||
showClusterOption?: boolean; // show "Cluster" option on the top (default: false)
|
||||
showAllNamespacesOption?: boolean; // show "All namespaces" option on the top (default: false)
|
||||
customizeOptions?(options: SelectOption[]): SelectOption[];
|
||||
}
|
||||
|
||||
const defaultProps: Partial<Props> = {
|
||||
showIcons: true,
|
||||
showClusterOption: false,
|
||||
};
|
||||
|
||||
@observer
|
||||
@@ -61,13 +59,11 @@ export class NamespaceSelect extends React.Component<Props> {
|
||||
}
|
||||
|
||||
@computed.struct get options(): SelectOption[] {
|
||||
const { customizeOptions, showClusterOption, showAllNamespacesOption } = this.props;
|
||||
const { customizeOptions, showAllNamespacesOption } = this.props;
|
||||
let options: SelectOption[] = namespaceStore.items.map(ns => ({ value: ns.getName() }));
|
||||
|
||||
if (showAllNamespacesOption) {
|
||||
options.unshift({ label: "All Namespaces", value: "" });
|
||||
} else if (showClusterOption) {
|
||||
options.unshift({ label: "Cluster", value: "" });
|
||||
}
|
||||
|
||||
if (customizeOptions) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import { action, comparer, computed, IReactionDisposer, IReactionOptions, makeObservable, reaction, } from "mobx";
|
||||
import { autoBind, createStorage } from "../../utils";
|
||||
import { autoBind, createStorage, noop } from "../../utils";
|
||||
import { KubeObjectStore, KubeObjectStoreLoadingParams } from "../../kube-object.store";
|
||||
import { Namespace, namespacesApi } from "../../api/endpoints/namespaces.api";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
@@ -97,13 +97,16 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
return this.selectedNamespaces;
|
||||
}
|
||||
|
||||
getSubscribeApis() {
|
||||
// if user has given static list of namespaces let's not start watches because watch adds stuff that's not wanted
|
||||
subscribe() {
|
||||
/**
|
||||
* if user has given static list of namespaces let's not start watches
|
||||
* because watch adds stuff that's not wanted or will just fail
|
||||
*/
|
||||
if (this.context?.cluster.accessibleNamespaces.length > 0) {
|
||||
return [];
|
||||
return noop;
|
||||
}
|
||||
|
||||
return super.getSubscribeApis();
|
||||
return super.subscribe();
|
||||
}
|
||||
|
||||
protected async loadItems(params: KubeObjectStoreLoadingParams) {
|
||||
|
||||
Reference in new issue
Block a user