mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add cluster modals registrator
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
032e6d968c
commit
a12f5d7872
@ -33,6 +33,7 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
|
||||
globalPages: registries.PageRegistration[] = [];
|
||||
clusterPages: registries.PageRegistration[] = [];
|
||||
clusterPageMenus: registries.ClusterPageMenuRegistration[] = [];
|
||||
clusterModals: registries.ClusterModalRegistration[] = [];
|
||||
kubeObjectStatusTexts: KubeObjectStatusRegistration[] = [];
|
||||
appPreferences: AppPreferenceRegistration[] = [];
|
||||
appPreferenceTabs: AppPreferenceTabRegistration[] = [];
|
||||
|
||||
@ -10,3 +10,4 @@ export * from "./page-menu-registry";
|
||||
export * from "./entity-setting-registry";
|
||||
export * from "./catalog-entity-detail-registry";
|
||||
export * from "./protocol-handler";
|
||||
export * from "./modal-registry";
|
||||
|
||||
10
src/extensions/registries/modal-registry.ts
Normal file
10
src/extensions/registries/modal-registry.ts
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
// Extensions-api -> Cluster frame custom modal registration
|
||||
|
||||
import type { IComputedValue } from "mobx";
|
||||
|
||||
export interface ClusterModalRegistration {
|
||||
id: string;
|
||||
component: React.ComponentType;
|
||||
visible?: IComputedValue<boolean>;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import { clusterFrameChildComponentInjectionToken } from "../frames/cluster-frame/cluster-frame-child-component-injection-token";
|
||||
|
||||
const clusterModalsClusterFrameChildComponentInjectable = getInjectable({
|
||||
id: "cluster-modals-cluster-frame-child-component",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "cluster-modals",
|
||||
shouldRender: computed(() => true),
|
||||
Component: ClusterModals,
|
||||
}),
|
||||
|
||||
injectionToken: clusterFrameChildComponentInjectionToken,
|
||||
});
|
||||
|
||||
export default clusterModalsClusterFrameChildComponentInjectable;
|
||||
@ -0,0 +1,25 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { extensionRegistratorInjectionToken } from "../../extensions/extension-loader/extension-registrator-injection-token";
|
||||
import type { LensRendererExtension } from "../../extensions/lens-renderer-extension";
|
||||
|
||||
const clusterModalsRegistratorInjectable = getInjectable({
|
||||
id: "cluster-modals-registrator",
|
||||
|
||||
instantiate: (): ExtensionRegistrator => {
|
||||
return (ext) => {
|
||||
const extension = ext as LensRendererExtension;
|
||||
|
||||
return extension.clusterModals.map((registration) => {
|
||||
return {
|
||||
id: registration.id,
|
||||
Component: registration.component,
|
||||
visible: registration.visible,
|
||||
}
|
||||
})
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: extensionRegistratorInjectionToken,
|
||||
});
|
||||
|
||||
export default clusterModalsRegistratorInjectable;
|
||||
Loading…
Reference in New Issue
Block a user