mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow to configure default namespace used in terminal (#3706)
* Allow to configure default namespace used in terminal Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> * Fix lint issues Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
1 parent
1f7cdcdb01
commit
584d45c5e0
4 files changed
+86
-16
No files matched your search
@@ -216,6 +216,18 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
return toJS({ prometheus, prometheusProvider });
|
||||
}
|
||||
|
||||
/**
|
||||
* defaultNamespace preference
|
||||
*
|
||||
* @computed
|
||||
* @internal
|
||||
*/
|
||||
@computed get defaultNamespace(): string {
|
||||
const { defaultNamespace } = this.preferences;
|
||||
|
||||
return defaultNamespace;
|
||||
}
|
||||
|
||||
constructor(model: ClusterModel) {
|
||||
makeObservable(this);
|
||||
this.id = model.id;
|
||||
@@ -298,10 +310,25 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
clearInterval(refreshTimer);
|
||||
clearInterval(refreshMetadataTimer);
|
||||
},
|
||||
reaction(() => this.defaultNamespace, () => this.recreateProxyKubeconfig()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async recreateProxyKubeconfig() {
|
||||
logger.info("Recreate proxy kubeconfig");
|
||||
|
||||
try {
|
||||
this.kubeconfigManager.clear();
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
this.getProxyKubeconfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* internal
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user