Function: registerClusterProviderDeleteHandler()
function registerClusterProviderDeleteHandler(handler: ClusterDeleteHandler): void;
Defined in: plugin/registry.tsx:1087
Route Delete in the Home page's cluster action menu to a plugin's dialog.
Headlamp's Delete removes a cluster from the kubeconfig. A plugin that manages
a cluster's lifecycle can claim that cluster's Delete instead: the menu then
opens the plugin's dialog (registered with registerClusterProviderDialog)
for every cluster owns returns true for. The first registered handler that
owns a cluster is used; a handler that throws owns nothing. owns must be a
function, and dialog must be a non-empty name other than Headlamp's own
deleteDynamic, which opens the kubeconfig-only confirmation; any other
handler is ignored.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | ClusterDeleteHandler | Which clusters the plugin owns, and the dialog that deletes them. |
Returns
void
Nothing.
Example
import {
registerClusterProviderDeleteHandler,
registerClusterProviderDialog,
} from '@kinvolk/headlamp-plugin/lib';
registerClusterProviderDeleteHandler({
owns: cluster =>
cluster.meta_data?.extensions?.context_info?.provider === 'minikube.sigs.k8s.io',
dialog: 'deleteMinikube',
});
registerClusterProviderDialog(({ cluster, openConfirmDialog, setOpenConfirmDialog }) => (
<DeleteMinikube
cluster={cluster}
open={openConfirmDialog === 'deleteMinikube'}
onClose={() => setOpenConfirmDialog('')}
/>
));