1
0
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:
Roman 2021-02-02 19:13:47 +02:00
parent f91ce92666
commit a046272afd
2 changed files with 5 additions and 11 deletions

View File

@ -48,7 +48,7 @@ export interface ClusterState {
isAdmin: boolean;
allowedNamespaces: string[]
allowedResources: string[]
watchApiAllEnabled: boolean;
isGlobalWatchEnabled: boolean;
}
/**
@ -182,7 +182,7 @@ export class Cluster implements ClusterModel, ClusterState {
*
* @observable
*/
@observable watchApiAllEnabled = false;
@observable isGlobalWatchEnabled = false;
/**
* Preferences
*
@ -440,7 +440,7 @@ export class Cluster implements ClusterModel, ClusterState {
*/
async refreshAccessibility(): Promise<void> {
this.isAdmin = await this.isClusterAdmin();
this.watchApiAllEnabled = await this.canUseWatchApi({ resource: "*" });
this.isGlobalWatchEnabled = await this.canUseWatchApi({ resource: "*" });
await this.refreshAllowedResources();
@ -629,7 +629,7 @@ export class Cluster implements ClusterModel, ClusterState {
isAdmin: this.isAdmin,
allowedNamespaces: this.allowedNamespaces,
allowedResources: this.allowedResources,
watchApiAllEnabled: this.watchApiAllEnabled,
isGlobalWatchEnabled: this.isGlobalWatchEnabled,
};
return toJS(state, {

View File

@ -52,12 +52,6 @@ export class KubeWatchApi {
@observable subscribers = observable.map<KubeApi, number>();
@observable isConnected = false;
@computed get watchAllEnabled(): boolean {
const { isAdmin, watchApiAllEnabled } = this?.cluster;
return Boolean(isAdmin || watchApiAllEnabled);
}
@computed get isReady(): boolean {
return Boolean(this.cluster && this.namespaces);
}
@ -76,7 +70,7 @@ export class KubeWatchApi {
return [];
}
if (api.isNamespaced && !this.watchAllEnabled) {
if (api.isNamespaced && !this.cluster.isGlobalWatchEnabled) {
return this.namespaces.map(namespace => api.getWatchUrl(namespace));
}