From 2cf8a2f1887f86b6b5b720d4a99a549ec4354aec Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Tue, 4 Apr 2023 09:59:36 +0300 Subject: [PATCH] Add workload 'kind' param to 'show-details' event (#7464) * Introduce getWorkloadKindFromUrl() method Signed-off-by: Alex Andreev * Whitelist kind param to 'show-details' event Signed-off-by: Alex Andreev * Using parseKubeApi instead of new utility Signed-off-by: Alex Andreev * Adding checks for empty selfLink Signed-off-by: Alex Andreev --------- Signed-off-by: Alex Andreev --- .../telemetry-white-list-for-functions.injectable.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core/src/features/telemetry/renderer/telemetry-white-list-for-functions.injectable.ts b/packages/core/src/features/telemetry/renderer/telemetry-white-list-for-functions.injectable.ts index 0d2970f75e..b4d6634d94 100644 --- a/packages/core/src/features/telemetry/renderer/telemetry-white-list-for-functions.injectable.ts +++ b/packages/core/src/features/telemetry/renderer/telemetry-white-list-for-functions.injectable.ts @@ -4,6 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import type { AppEvent } from "../../../common/app-event-bus/event-bus"; +import { parseKubeApi } from "../../../common/k8s-api/kube-api-parse"; const navigateTo = [ "navigate-to-preference-tab-id", @@ -91,13 +92,20 @@ const extensions = [ const externalActions = ["open-link-in-browser"]; -const uiInteraction = ["show-details"]; +const uiInteraction = [{ + id: "show-details", + getParams: (selfLink: string) => { + return { + kind: selfLink ? parseKubeApi(selfLink).resource : "", + }; + }, +}]; const terminal = ["create-terminal-tab"]; export type WhiteListItem = | string - | { id: string; getParams: (...args: unknown[]) => AppEvent["params"] }; + | { id: string; getParams: (...args: any[]) => AppEvent["params"] }; const telemetryWhiteListForFunctionsInjectable = getInjectable({ id: "telemetry-white-list-for-functions",