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 authored and GitHub committed 2023-04-04 09:59:36 +03:00
1 parent df9db01be5
commit 2cf8a2f188
1 file changed
+10 -2
@@ -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",