1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add workload 'kind' param to 'show-details' event (#7464)

* Introduce getWorkloadKindFromUrl() method

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Whitelist kind param to 'show-details' event

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Using parseKubeApi instead of new utility

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding checks for empty selfLink

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

---------

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2023-04-04 09:59:36 +03:00 committed by GitHub
parent df9db01be5
commit 2cf8a2f188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import type { AppEvent } from "../../../common/app-event-bus/event-bus"; import type { AppEvent } from "../../../common/app-event-bus/event-bus";
import { parseKubeApi } from "../../../common/k8s-api/kube-api-parse";
const navigateTo = [ const navigateTo = [
"navigate-to-preference-tab-id", "navigate-to-preference-tab-id",
@ -91,13 +92,20 @@ const extensions = [
const externalActions = ["open-link-in-browser"]; 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"]; const terminal = ["create-terminal-tab"];
export type WhiteListItem = export type WhiteListItem =
| string | string
| { id: string; getParams: (...args: unknown[]) => AppEvent["params"] }; | { id: string; getParams: (...args: any[]) => AppEvent["params"] };
const telemetryWhiteListForFunctionsInjectable = getInjectable({ const telemetryWhiteListForFunctionsInjectable = getInjectable({
id: "telemetry-white-list-for-functions", id: "telemetry-white-list-for-functions",