From c527014011eb1e87723de1861895d2ea97985cbb Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Fri, 4 Nov 2022 09:15:16 +0300 Subject: [PATCH] Expose a way to add cluster frame components in Extension API (#6385) * Add cluster modals registrator Signed-off-by: Alex Andreev * Add ClusterModal components and injection token Signed-off-by: Alex Andreev * Add clusterModals tests Signed-off-by: Alex Andreev * Update snapshots and use css modules Signed-off-by: Alex Andreev * Linter fixes Signed-off-by: Alex Andreev * Setting 0 height as an inline style Signed-off-by: Alex Andreev * Update snapshots Signed-off-by: Alex Andreev * Do not export clusterModalsInjectionToken to extensions Signed-off-by: Alex Andreev * Testing changing visibility flag Signed-off-by: Alex Andreev * Linter fix Signed-off-by: Alex Andreev * Refactor cluster modals registrator and injectable Signed-off-by: Alex Andreev * Linter fixes Signed-off-by: Alex Andreev * Harder linter fix Signed-off-by: Alex Andreev * Fix linter again Signed-off-by: Alex Andreev * Using clusterFrameChildComponentsInjectionToken for specific extension elements Signed-off-by: Alex Andreev * Removing unused files Signed-off-by: Alex Andreev * Removing unused modal registration Signed-off-by: Alex Andreev * Improving tests Signed-off-by: Alex Andreev * Fix linting Signed-off-by: Janne Savolainen * Update snapshots Signed-off-by: Janne Savolainen * Rename test suite for consistency Signed-off-by: Janne Savolainen Signed-off-by: Alex Andreev Signed-off-by: Janne Savolainen Co-authored-by: Janne Savolainen --- src/extensions/lens-renderer-extension.ts | 2 + ...ing-cluster-frame-components.test.tsx.snap | 514 ++++++++++++++++++ ...n-adding-cluster-frame-components.test.tsx | 78 +++ ...-frame-component-registrator.injectable.ts | 42 ++ .../frames/cluster-frame/cluster-frame.tsx | 22 +- 5 files changed, 650 insertions(+), 8 deletions(-) create mode 100644 src/features/cluster/__snapshots__/legacy-extension-adding-cluster-frame-components.test.tsx.snap create mode 100644 src/features/cluster/legacy-extension-adding-cluster-frame-components.test.tsx create mode 100644 src/renderer/frames/cluster-frame/cluster-frame-component-registrator.injectable.ts diff --git a/src/extensions/lens-renderer-extension.ts b/src/extensions/lens-renderer-extension.ts index 12203cc932..d0a2a979e6 100644 --- a/src/extensions/lens-renderer-extension.ts +++ b/src/extensions/lens-renderer-extension.ts @@ -28,11 +28,13 @@ import type { LensRendererExtensionDependencies } from "./lens-extension-set-dep import type { KubeObjectHandlerRegistration } from "../renderer/kube-object/handler"; import type { AppPreferenceTabRegistration } from "../features/preferences/renderer/compliance-for-legacy-extension-api/app-preference-tab-registration"; import type { KubeObjectDetailRegistration } from "../renderer/components/kube-object-details/kube-object-detail-registration"; +import type { ClusterFrameChildComponent } from "../renderer/frames/cluster-frame/cluster-frame-child-component-injection-token"; export class LensRendererExtension extends LensExtension { globalPages: registries.PageRegistration[] = []; clusterPages: registries.PageRegistration[] = []; clusterPageMenus: registries.ClusterPageMenuRegistration[] = []; + clusterFrameComponents: ClusterFrameChildComponent[] = []; kubeObjectStatusTexts: KubeObjectStatusRegistration[] = []; appPreferences: AppPreferenceRegistration[] = []; appPreferenceTabs: AppPreferenceTabRegistration[] = []; diff --git a/src/features/cluster/__snapshots__/legacy-extension-adding-cluster-frame-components.test.tsx.snap b/src/features/cluster/__snapshots__/legacy-extension-adding-cluster-frame-components.test.tsx.snap new file mode 100644 index 0000000000..7d9748dcbd --- /dev/null +++ b/src/features/cluster/__snapshots__/legacy-extension-adding-cluster-frame-components.test.tsx.snap @@ -0,0 +1,514 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`legacy extension adding cluster frame components given custom components for cluster view available renders 1`] = ` +
+
+
+