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 {
|
export default class ExampleExtensionMain extends LensMainExtension {
|
||||||
onActivate() {
|
onActivate() {
|
||||||
console.log('EXAMPLE EXTENSION MAIN: ACTIVATED', this.getMeta());
|
console.log('EXAMPLE EXTENSION MAIN: ACTIVATED');
|
||||||
}
|
}
|
||||||
|
|
||||||
onDeactivate() {
|
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 {
|
export default class ExampleExtension extends LensRendererExtension {
|
||||||
clusterPages = [
|
clusterPages = [
|
||||||
{
|
{
|
||||||
path: "/extension-example",
|
id: "example",
|
||||||
|
routePath: "/extension-example",
|
||||||
title: "Example Extension",
|
title: "Example Extension",
|
||||||
components: {
|
components: {
|
||||||
Page: () => <ExamplePage extension={this}/>,
|
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 {
|
export interface PageMenuTarget {
|
||||||
pageId: string;
|
pageId: string;
|
||||||
extensionId: string;
|
extensionId?: string;
|
||||||
params: object;
|
params?: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PageMenuRegistration {
|
export interface PageMenuRegistration {
|
||||||
@ -33,7 +33,9 @@ export class PageMenuRegistry<T extends PageMenuRegistration> extends BaseRegist
|
|||||||
@action
|
@action
|
||||||
add(items: T[], ext?: LensExtension) {
|
add(items: T[], ext?: LensExtension) {
|
||||||
const normalizedItems = items.map((i) => {
|
const normalizedItems = items.map((i) => {
|
||||||
i.target.extensionId = ext.name
|
if (!i.target.extensionId) {
|
||||||
|
i.target.extensionId = ext.name
|
||||||
|
}
|
||||||
return i
|
return i
|
||||||
})
|
})
|
||||||
return super.add(normalizedItems);
|
return super.add(normalizedItems);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user