mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fixes
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
334fd06ae7
commit
7077dba9f3
@ -2,10 +2,10 @@ import { LensMainExtension } from "@k8slens/extensions";
|
||||
|
||||
export default class ExampleExtensionMain extends LensMainExtension {
|
||||
onActivate() {
|
||||
console.log('EXAMPLE EXTENSION MAIN: ACTIVATED', this.getMeta());
|
||||
console.log('EXAMPLE EXTENSION MAIN: ACTIVATED');
|
||||
}
|
||||
|
||||
onDeactivate() {
|
||||
console.log('EXAMPLE EXTENSION MAIN: DEACTIVATED', this.getMeta());
|
||||
console.log('EXAMPLE EXTENSION MAIN: DEACTIVATED');
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,11 +5,21 @@ import React from "react"
|
||||
export default class ExampleExtension extends LensRendererExtension {
|
||||
clusterPages = [
|
||||
{
|
||||
path: "/extension-example",
|
||||
id: "example",
|
||||
routePath: "/extension-example",
|
||||
title: "Example Extension",
|
||||
components: {
|
||||
Page: () => <ExamplePage extension={this}/>,
|
||||
MenuIcon: ExampleIcon,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
clusterPageMenus = [
|
||||
{
|
||||
target: { pageId: "example", params: {} },
|
||||
title: "Example Extension",
|
||||
components: {
|
||||
Icon: ExampleIcon,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -9,8 +9,8 @@ import { PageRegistration } from "../interfaces";
|
||||
|
||||
export interface PageMenuTarget {
|
||||
pageId: string;
|
||||
extensionId: string;
|
||||
params: object;
|
||||
extensionId?: string;
|
||||
params?: object;
|
||||
}
|
||||
|
||||
export interface PageMenuRegistration {
|
||||
@ -33,7 +33,9 @@ export class PageMenuRegistry<T extends PageMenuRegistration> extends BaseRegist
|
||||
@action
|
||||
add(items: T[], ext?: LensExtension) {
|
||||
const normalizedItems = items.map((i) => {
|
||||
i.target.extensionId = ext.name
|
||||
if (!i.target.extensionId) {
|
||||
i.target.extensionId = ext.name
|
||||
}
|
||||
return i
|
||||
})
|
||||
return super.add(normalizedItems);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user