mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
refactor registering extensions
extension implementors do not need to be aware of disposer and registry internals Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
1 parent
e9ebd06664
commit
aa1e18c148
7 files changed
+94
-52
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { LensRendererExtension, Registry } from "@k8slens/extensions";
|
||||
import { LensRendererExtension } from "@k8slens/extensions";
|
||||
import { ExamplePage, ExampleIcon } from "./page"
|
||||
import React from "react"
|
||||
|
||||
@@ -7,17 +7,17 @@ export default class ExampleExtension extends LensRendererExtension {
|
||||
console.log('EXAMPLE EXTENSION RENDERER: ACTIVATED', this.getMeta());
|
||||
}
|
||||
|
||||
registerClusterPage(registry: Registry.ClusterPageRegistry) {
|
||||
this.disposers.push(
|
||||
registry.add({
|
||||
clusterPages() {
|
||||
return [
|
||||
{
|
||||
path: "/extension-example",
|
||||
title: "Example Extension",
|
||||
components: {
|
||||
Page: () => <ExamplePage extension={this} />,
|
||||
MenuIcon: ExampleIcon,
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
onDeactivate() {
|
||||
|
||||
Reference in new issue
Block a user