mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
add changing workspace on protocol handlers
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
c9237be548
commit
6cfe655421
@ -6,6 +6,8 @@ import { preferencesURL } from "../components/+preferences";
|
|||||||
import { clusterViewURL } from "../components/cluster-manager/cluster-view.route";
|
import { clusterViewURL } from "../components/cluster-manager/cluster-view.route";
|
||||||
import { LensProtocolRouterRenderer } from "./router";
|
import { LensProtocolRouterRenderer } from "./router";
|
||||||
import { navigate } from "../navigation/helpers";
|
import { navigate } from "../navigation/helpers";
|
||||||
|
import { clusterStore } from "../../common/cluster-store";
|
||||||
|
import { workspaceStore } from "../../common/workspace-store";
|
||||||
|
|
||||||
export function bindProtocolAddRouteHandlers() {
|
export function bindProtocolAddRouteHandlers() {
|
||||||
LensProtocolRouterRenderer
|
LensProtocolRouterRenderer
|
||||||
@ -23,10 +25,20 @@ export function bindProtocolAddRouteHandlers() {
|
|||||||
navigate(addClusterURL());
|
navigate(addClusterURL());
|
||||||
})
|
})
|
||||||
.addInternalHandler("/cluster/:clusterId", ({ pathname: { clusterId } }) => {
|
.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 } }) => {
|
.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", () => {
|
.addInternalHandler("/extensions", () => {
|
||||||
navigate(extensionsURL());
|
navigate(extensionsURL());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user