mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
responding to comments
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
f91ce92666
commit
a046272afd
@ -48,7 +48,7 @@ export interface ClusterState {
|
|||||||
isAdmin: boolean;
|
isAdmin: boolean;
|
||||||
allowedNamespaces: string[]
|
allowedNamespaces: string[]
|
||||||
allowedResources: string[]
|
allowedResources: string[]
|
||||||
watchApiAllEnabled: boolean;
|
isGlobalWatchEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +182,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
*
|
*
|
||||||
* @observable
|
* @observable
|
||||||
*/
|
*/
|
||||||
@observable watchApiAllEnabled = false;
|
@observable isGlobalWatchEnabled = false;
|
||||||
/**
|
/**
|
||||||
* Preferences
|
* Preferences
|
||||||
*
|
*
|
||||||
@ -440,7 +440,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
*/
|
*/
|
||||||
async refreshAccessibility(): Promise<void> {
|
async refreshAccessibility(): Promise<void> {
|
||||||
this.isAdmin = await this.isClusterAdmin();
|
this.isAdmin = await this.isClusterAdmin();
|
||||||
this.watchApiAllEnabled = await this.canUseWatchApi({ resource: "*" });
|
this.isGlobalWatchEnabled = await this.canUseWatchApi({ resource: "*" });
|
||||||
|
|
||||||
await this.refreshAllowedResources();
|
await this.refreshAllowedResources();
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
isAdmin: this.isAdmin,
|
isAdmin: this.isAdmin,
|
||||||
allowedNamespaces: this.allowedNamespaces,
|
allowedNamespaces: this.allowedNamespaces,
|
||||||
allowedResources: this.allowedResources,
|
allowedResources: this.allowedResources,
|
||||||
watchApiAllEnabled: this.watchApiAllEnabled,
|
isGlobalWatchEnabled: this.isGlobalWatchEnabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
return toJS(state, {
|
return toJS(state, {
|
||||||
|
|||||||
@ -52,12 +52,6 @@ export class KubeWatchApi {
|
|||||||
@observable subscribers = observable.map<KubeApi, number>();
|
@observable subscribers = observable.map<KubeApi, number>();
|
||||||
@observable isConnected = false;
|
@observable isConnected = false;
|
||||||
|
|
||||||
@computed get watchAllEnabled(): boolean {
|
|
||||||
const { isAdmin, watchApiAllEnabled } = this?.cluster;
|
|
||||||
|
|
||||||
return Boolean(isAdmin || watchApiAllEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed get isReady(): boolean {
|
@computed get isReady(): boolean {
|
||||||
return Boolean(this.cluster && this.namespaces);
|
return Boolean(this.cluster && this.namespaces);
|
||||||
}
|
}
|
||||||
@ -76,7 +70,7 @@ export class KubeWatchApi {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api.isNamespaced && !this.watchAllEnabled) {
|
if (api.isNamespaced && !this.cluster.isGlobalWatchEnabled) {
|
||||||
return this.namespaces.map(namespace => api.getWatchUrl(namespace));
|
return this.namespaces.map(namespace => api.getWatchUrl(namespace));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user