mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Show delete button if no more contexts available
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
45a78d2df7
commit
a9d68d29a2
@ -123,7 +123,15 @@ export class DeleteClusterDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@computed get disableDelete() {
|
@computed get disableDelete() {
|
||||||
return this.showContextSwitch && (this.newCurrentContext === "");
|
const { cluster, config } = dialogState;
|
||||||
|
const noContextsAvailable = config.contexts.filter(context => context.name !== cluster.contextName).length == 0;
|
||||||
|
const newContextNotSelected = this.newCurrentContext === "";
|
||||||
|
|
||||||
|
if (noContextsAvailable) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.showContextSwitch && newContextNotSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
isCurrentContext() {
|
isCurrentContext() {
|
||||||
@ -172,7 +180,7 @@ export class DeleteClusterDialog extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWarningMessage() {
|
getWarningMessage() {
|
||||||
const { cluster, config } = dialogState;
|
const { cluster, config } = dialogState;
|
||||||
const contexts = config.contexts.filter(context => context.name !== cluster.contextName);
|
const contexts = config.contexts.filter(context => context.name !== cluster.contextName);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user