1
0
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:
Alex Andreev 2021-09-08 13:38:22 +03:00
parent 45a78d2df7
commit a9d68d29a2

View File

@ -123,7 +123,15 @@ export class DeleteClusterDialog extends React.Component {
}
@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() {
@ -172,7 +180,7 @@ export class DeleteClusterDialog extends React.Component {
</div>
);
}
getWarningMessage() {
const { cluster, config } = dialogState;
const contexts = config.contexts.filter(context => context.name !== cluster.contextName);