1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Show Delete menu item only for local cluster

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-08-22 15:57:53 +03:00 committed by Sebastian Malton
parent 7d6209a31c
commit 08215c8184
2 changed files with 11 additions and 14 deletions

View File

@ -15,6 +15,10 @@
max-width: 600px; max-width: 600px;
min-width: calc(45 * var(--unit)); min-width: calc(45 * var(--unit));
} }
b {
word-break: break-all;
}
} }
.dialogContent { .dialogContent {

View File

@ -49,20 +49,13 @@ function initKubernetesClusters() {
catalogCategoryRegistry catalogCategoryRegistry
.getForGroupKind("entity.k8slens.dev", "KubernetesCluster") .getForGroupKind("entity.k8slens.dev", "KubernetesCluster")
.on("contextMenuOpen", (entity, context) => { .on("contextMenuOpen", (entity, context) => {
context.menuItems.push({ if (entity.metadata?.source == "local") {
title: "Delete", context.menuItems.push({
icon: "delete", title: "Delete",
onClick: () => deleteLocalCluster(entity.metadata.uid), icon: "delete",
confirm: { onClick: () => onClusterDelete(entity.metadata.uid)
// TODO: change this to be a <p> tag with better formatting once this code can accept it. });
message: `Delete the "${entity.metadata.name}" context from "${entity.spec.kubeconfigPath}"?` }
}
});
context.menuItems.push({
title: "Remove",
icon: "delete",
onClick: () => onClusterDelete(entity.metadata.uid)
});
}); });
} }