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 authored and Sebastian Malton committed 2021-08-26 12:24:29 -04:00
1 parent 7d6209a31c
commit 08215c8184
2 files changed
+11 -14

No files matched your search

@@ -15,6 +15,10 @@
max-width: 600px;
min-width: calc(45 * var(--unit));
}
b {
word-break: break-all;
}
}
.dialogContent {
+7 -14
View File
@@ -49,20 +49,13 @@ function initKubernetesClusters() {
catalogCategoryRegistry
.getForGroupKind("entity.k8slens.dev", "KubernetesCluster")
.on("contextMenuOpen", (entity, context) => {
context.menuItems.push({
title: "Delete",
icon: "delete",
onClick: () => deleteLocalCluster(entity.metadata.uid),
confirm: {
// 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)
});
if (entity.metadata?.source == "local") {
context.menuItems.push({
title: "Delete",
icon: "delete",
onClick: () => onClusterDelete(entity.metadata.uid)
});
}
});
}