mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix saving last cluster while jumping from tray
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
cb13079077
commit
07f44f9454
@ -1,4 +1,4 @@
|
||||
import type { WorkspaceId } from "./workspace-store";
|
||||
import { WorkspaceId, workspaceStore } from "./workspace-store";
|
||||
import path from "path";
|
||||
import { app, ipcRenderer, remote, webFrame } from "electron";
|
||||
import { unlink } from "fs-extra";
|
||||
@ -138,7 +138,9 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
||||
|
||||
@action
|
||||
setActive(id: ClusterId) {
|
||||
this.activeCluster = this.clusters.has(id) ? id : null;
|
||||
const clusterId = this.clusters.has(id) ? id : null;
|
||||
this.activeCluster = clusterId;
|
||||
workspaceStore.setLastActiveClusterId(clusterId);
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@ -72,7 +72,8 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
ownerRef: this.ownerRef
|
||||
ownerRef: this.ownerRef,
|
||||
lastActiveClusterId: this.lastActiveClusterId
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -191,6 +192,7 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
||||
|
||||
@action
|
||||
setLastActiveClusterId(clusterId: ClusterId, workspaceId = this.currentWorkspaceId) {
|
||||
console.log("Passed cluster ID", clusterId, "current workspace id = ", workspaceId)
|
||||
if (clusterId != null) {
|
||||
this.getById(workspaceId).lastActiveClusterId = clusterId;
|
||||
}
|
||||
|
||||
@ -94,7 +94,6 @@ export function createTrayMenu(windowManager: WindowManager): Menu {
|
||||
toolTip: clusterId,
|
||||
async click() {
|
||||
workspaceStore.setActive(workspace);
|
||||
clusterStore.setActive(clusterId);
|
||||
windowManager.navigate(clusterViewURL({ params: { clusterId } }));
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,6 @@ export class AddCluster extends React.Component {
|
||||
if (newClusters.length === 1) {
|
||||
const clusterId = newClusters[0].id;
|
||||
clusterStore.setActive(clusterId);
|
||||
workspaceStore.setLastActiveClusterId(clusterId);
|
||||
navigate(clusterViewURL({ params: { clusterId } }));
|
||||
} else {
|
||||
if (newClusters.length > 1) {
|
||||
|
||||
@ -31,7 +31,6 @@ interface Props {
|
||||
@observer
|
||||
export class ClustersMenu extends React.Component<Props> {
|
||||
showCluster = (clusterId: ClusterId) => {
|
||||
workspaceStore.setLastActiveClusterId(clusterId);
|
||||
navigate(clusterViewURL({ params: { clusterId } }));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user