mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Get rid of this.disposers while registering stuff in extensions (#1148)
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
b765ee11bb
commit
67754ffbb9
15 files changed
+141
-197
No files matched your search
@@ -1,20 +1,14 @@
|
||||
import { LensMainExtension, Registry, windowManager } from "@k8slens/extensions";
|
||||
import { LensMainExtension, windowManager } from "@k8slens/extensions";
|
||||
import { supportPageURL } from "./src/support.route";
|
||||
|
||||
export default class SupportPageMainExtension extends LensMainExtension {
|
||||
async onActivate() {
|
||||
console.log("support page extension activated")
|
||||
}
|
||||
|
||||
async registerAppMenus(registry: Registry.MenuRegistry) {
|
||||
this.disposers.push(
|
||||
registry.add({
|
||||
parentId: "help",
|
||||
label: "Support",
|
||||
click() {
|
||||
windowManager.navigate(supportPageURL());
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
appMenus = [
|
||||
{
|
||||
parentId: "help",
|
||||
label: "Support",
|
||||
click() {
|
||||
windowManager.navigate(supportPageURL());
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,39 +1,31 @@
|
||||
import React from "react";
|
||||
import { Component, LensRendererExtension, Navigation, Registry } from "@k8slens/extensions";
|
||||
import { Component, LensRendererExtension, Navigation } from "@k8slens/extensions";
|
||||
import { supportPageRoute, supportPageURL } from "./src/support.route";
|
||||
import { Support } from "./src/support";
|
||||
|
||||
export default class SupportPageRendererExtension extends LensRendererExtension {
|
||||
async onActivate() {
|
||||
console.log("support page extension activated")
|
||||
}
|
||||
globalPages = [
|
||||
{
|
||||
...supportPageRoute,
|
||||
url: supportPageURL(),
|
||||
hideInMenu: true,
|
||||
components: {
|
||||
Page: Support,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
registerGlobalPage(registry: Registry.GlobalPageRegistry) {
|
||||
this.disposers.push(
|
||||
registry.add({
|
||||
...supportPageRoute,
|
||||
url: supportPageURL(),
|
||||
hideInMenu: true,
|
||||
components: {
|
||||
Page: Support,
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
registerStatusBarItem(registry: Registry.StatusBarRegistry) {
|
||||
this.disposers.push(
|
||||
registry.add({
|
||||
item: (
|
||||
<div
|
||||
className="flex align-center gaps hover-highlight"
|
||||
onClick={() => Navigation.navigate(supportPageURL())}
|
||||
>
|
||||
<Component.Icon material="help_outline" small />
|
||||
<span>Support</span>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
statusBarItems = [
|
||||
{
|
||||
item: (
|
||||
<div
|
||||
className="flex align-center gaps hover-highlight"
|
||||
onClick={() => Navigation.navigate(supportPageURL())}
|
||||
>
|
||||
<Component.Icon material="help_outline" small/>
|
||||
<span>Support</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user