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; max-width: 600px;
min-width: calc(45 * var(--unit)); min-width: calc(45 * var(--unit));
} }
b {
word-break: break-all;
}
} }
.dialogContent { .dialogContent {
+7 -14
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)
});
}); });
} }