forked from andrea-falco/lens-multi-pod-logs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderer.tsx
42 lines (38 loc) · 1.44 KB
/
renderer.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from "react";
import { Renderer } from "@k8slens/extensions";
import { DeploymentMultiPodLogsMenu } from "./src/deployment-menu";
type Deployment = Renderer.K8sApi.Deployment;
/**
*
* RendererExtension which extends LensRendererExtension runs in Lens' 'renderer' process (NOT 'main' process)
* main vs renderer <https://www.electronjs.org/docs/tutorial/quick-start#main-and-renderer-processes>
*
* LensRendererExtension is the interface to Lens' renderer process. Its api allows you to access, configure,
* and customize Lens data add custom Lens UI elements, and generally run custom code in Lens' renderer process.
*
* To see console statements in 'renderer' process, go to the console tab in DevTools in Lens
* View > Toggle Developer Tools > Console.
*
*/
export default class MultiPodLogsRenderer extends Renderer.LensExtension {
// Array of objects matching the KubeObjectMenuRegistration interface
kubeObjectMenuItems = [
{
kind: "Deployment",
apiVersions: ["apps/v1"],
components: {
MenuItem: (
props: Renderer.Component.KubeObjectMenuProps<Deployment>
) => <DeploymentMultiPodLogsMenu {...props} />,
},
},
];
// Enabling extension calls onActivate()
onActivate() {
console.log("lens-multi-pod-logs extension | activated");
}
// Disabling extension calls onDeactivate()
onDeactivate() {
console.log("lens-multi-pod-logs extension | de-activated");
}
}