mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- fix: navigate to landing on workspace switch Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
e17b87b2f0
commit
505a5c7d9f
5 files changed
+73
-65
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { action, computed, observable, toJS } from "mobx";
|
||||
import { BaseStore } from "./base-store";
|
||||
import { clusterStore } from "./cluster-store"
|
||||
import { landingURL } from "../renderer/components/+landing-page/landing-page.route";
|
||||
import { navigate } from "../renderer/navigation";
|
||||
|
||||
export type WorkspaceId = string;
|
||||
|
||||
@@ -50,12 +52,18 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
||||
}
|
||||
|
||||
@action
|
||||
setActive(id = WorkspaceStore.defaultId) {
|
||||
setActive(id = WorkspaceStore.defaultId, { redirectToLanding = true, resetActiveCluster = true } = {}) {
|
||||
if (id === this.currentWorkspaceId) return;
|
||||
if (!this.getById(id)) {
|
||||
throw new Error(`workspace ${id} doesn't exist`);
|
||||
}
|
||||
|
||||
this.currentWorkspaceId = id;
|
||||
if (resetActiveCluster) {
|
||||
clusterStore.setActive(null)
|
||||
}
|
||||
if (redirectToLanding) {
|
||||
navigate(landingURL())
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
Reference in new issue
Block a user