mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
allow extensions to regiter extra details
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
c67dad54e3
commit
9a70238596
@ -77,6 +77,7 @@ export class ExtensionLoader {
|
||||
registries.clusterPageRegistry.add(...extension.clusterPages),
|
||||
registries.kubeObjectMenuRegistry.add(...extension.kubeObjectMenuItems),
|
||||
registries.kubeObjectDetailRegistry.add(...extension.kubeObjectDetailItems),
|
||||
registries.kubeObjectExtraDetailRegistry.add(...extension.kubeObjectExtraDetailItems),
|
||||
registries.kubeObjectStatusRegistry.add(...extension.kubeObjectStatusTexts)
|
||||
])
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type {
|
||||
AppPreferenceRegistration, ClusterFeatureRegistration,
|
||||
KubeObjectMenuRegistration, KubeObjectDetailRegistration,
|
||||
KubeObjectMenuRegistration, KubeObjectDetailRegistration, KubeObjectExtraDetailRegistration,
|
||||
PageRegistration, StatusBarRegistration, KubeObjectStatusRegistration
|
||||
} from "./registries"
|
||||
import { observable } from "mobx";
|
||||
@ -14,5 +14,6 @@ export class LensRendererExtension extends LensExtension {
|
||||
@observable.shallow clusterFeatures: ClusterFeatureRegistration[] = []
|
||||
@observable.shallow statusBarItems: StatusBarRegistration[] = []
|
||||
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = []
|
||||
@observable.shallow kubeObjectExtraDetailItems: KubeObjectExtraDetailRegistration[] = []
|
||||
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = []
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ export * from "./menu-registry"
|
||||
export * from "./app-preference-registry"
|
||||
export * from "./status-bar-registry"
|
||||
export * from "./kube-object-detail-registry";
|
||||
export * from "./kube-object-extra-detail-registry";
|
||||
export * from "./kube-object-menu-registry";
|
||||
export * from "./cluster-feature-registry"
|
||||
export * from "./kube-object-status-registry"
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
import React from "react"
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
|
||||
export interface KubeObjectExtraDetailComponents {
|
||||
Details: React.ComponentType<any>;
|
||||
}
|
||||
|
||||
export interface KubeObjectExtraDetailRegistration {
|
||||
kind: string;
|
||||
apiVersions: string[];
|
||||
components: KubeObjectExtraDetailComponents;
|
||||
}
|
||||
|
||||
export class KubeObjectExtraDetailRegistry extends BaseRegistry<KubeObjectExtraDetailRegistration> {
|
||||
getItemsForKind(kind: string, apiVersion: string) {
|
||||
return this.items.filter((item) => {
|
||||
return item.kind === kind && item.apiVersions.includes(apiVersion)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export const kubeObjectExtraDetailRegistry = new KubeObjectExtraDetailRegistry()
|
||||
Loading…
Reference in New Issue
Block a user