1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/kube-object/static-handlers.ts
Sebastian Malton 597f22003d Allow extensions to iteract with kube detail menu items like CatalogEntity menu items
- Allow registering handlers

- Cannot remove menu items

- Can add menu items in any location

- Add example of StatefulSets

- Could be used to deprecate the old API

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-04-20 08:17:51 -04:00

23 lines
740 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { KubeObjectHandlerRegistration } from "./handler";
import { StatefulSetScaleDialog } from "../components/+workloads-statefulsets/statefulset-scale-dialog";
import type { StatefulSet } from "../../common/k8s-api/endpoints";
export const staticKubeObjectContextMenuHandlers: KubeObjectHandlerRegistration[] = [
{
kind: "StatefulSet",
apiVersions: ["apps/v1"],
onContextMenuOpen: (ctx) => {
ctx.menuItems.push({
icon: "open_with",
title: "Scale",
onClick: (obj: StatefulSet) => StatefulSetScaleDialog.open(obj),
});
},
},
];