mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
auto-select contexts up to 10, main-layout small fix
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
b698b7f22a
commit
17185cd04b
@ -71,7 +71,7 @@ export class AddCluster extends React.Component {
|
||||
}
|
||||
|
||||
@action
|
||||
refreshContexts() {
|
||||
refreshContexts(autoSelect = true) {
|
||||
this.selectedContexts.clear();
|
||||
this.kubeContexts.clear();
|
||||
|
||||
@ -91,6 +91,12 @@ export class AddCluster extends React.Component {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (autoSelect) {
|
||||
const allContexts = Array.from(this.kubeContexts.keys());
|
||||
if (allContexts.length <= 10) {
|
||||
this.selectedContexts.replace(allContexts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getContexts(config: KubeConfig): Map<string, KubeConfig> {
|
||||
|
||||
@ -48,11 +48,14 @@ export class MainLayout extends React.Component<Props> {
|
||||
const { className, contentClass, headerClass, tabs, footer, footerClass, children } = this.props;
|
||||
const routePath = navigation.location.pathname;
|
||||
const cluster = getHostedCluster();
|
||||
if (!cluster) {
|
||||
return null; // fix: skip render when removing active (visible) cluster
|
||||
}
|
||||
return (
|
||||
<div className={cssNames("MainLayout", className)}>
|
||||
<header className={cssNames("flex gaps align-center", headerClass)}>
|
||||
<span className="cluster">
|
||||
{cluster.preferences?.clusterName || cluster.contextName}
|
||||
{cluster.preferences.clusterName || cluster.contextName}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user