From 6cfe65542190483259e3e70d4833b91756b5df36 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 16 Mar 2021 10:33:26 -0400 Subject: [PATCH] add changing workspace on protocol handlers Signed-off-by: Sebastian Malton --- src/renderer/protocol-handler/app-handlers.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/renderer/protocol-handler/app-handlers.ts b/src/renderer/protocol-handler/app-handlers.ts index 1e97066a9b..d6b34181a9 100644 --- a/src/renderer/protocol-handler/app-handlers.ts +++ b/src/renderer/protocol-handler/app-handlers.ts @@ -6,6 +6,8 @@ import { preferencesURL } from "../components/+preferences"; import { clusterViewURL } from "../components/cluster-manager/cluster-view.route"; import { LensProtocolRouterRenderer } from "./router"; import { navigate } from "../navigation/helpers"; +import { clusterStore } from "../../common/cluster-store"; +import { workspaceStore } from "../../common/workspace-store"; export function bindProtocolAddRouteHandlers() { LensProtocolRouterRenderer @@ -23,10 +25,20 @@ export function bindProtocolAddRouteHandlers() { navigate(addClusterURL()); }) .addInternalHandler("/cluster/:clusterId", ({ pathname: { clusterId } }) => { - navigate(clusterViewURL({ params: { clusterId } })); + const cluster = clusterStore.getById(clusterId); + + if (cluster) { + workspaceStore.setActive(cluster.workspace); + navigate(clusterViewURL({ params: { clusterId } })); + } }) .addInternalHandler("/cluster/:clusterId/settings", ({ pathname: { clusterId } }) => { - navigate(clusterSettingsURL({ params: { clusterId } })); + const cluster = clusterStore.getById(clusterId); + + if (cluster) { + workspaceStore.setActive(cluster.workspace); + navigate(clusterSettingsURL({ params: { clusterId } })); + } }) .addInternalHandler("/extensions", () => { navigate(extensionsURL());