mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move cluster deactivation logic to cluster store
Signed-off-by: Alex Culliere <alozhkin@mirantis.com>
This commit is contained in:
parent
e0dd177014
commit
de1fa12ba6
@ -225,6 +225,12 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
|||||||
workspaceStore.setLastActiveClusterId(clusterId);
|
workspaceStore.setLastActiveClusterId(clusterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deactivate(id: ClusterId) {
|
||||||
|
if (this.isActive(id)) {
|
||||||
|
this.setActive(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
swapIconOrders(workspace: WorkspaceId, from: number, to: number) {
|
swapIconOrders(workspace: WorkspaceId, from: number, to: number) {
|
||||||
const clusters = this.getByWorkspaceId(workspace);
|
const clusters = this.getByWorkspaceId(workspace);
|
||||||
|
|||||||
@ -11,13 +11,6 @@ import { Cluster } from "../../../main/cluster";
|
|||||||
const navigate = (route: string) =>
|
const navigate = (route: string) =>
|
||||||
broadcastMessage("renderer:navigate", route);
|
broadcastMessage("renderer:navigate", route);
|
||||||
|
|
||||||
const deactivateCluster = (clusterId: string) => {
|
|
||||||
if (clusterStore.isActive(clusterId)) {
|
|
||||||
clusterStore.setActive(null);
|
|
||||||
}
|
|
||||||
navigate(landingURL());
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates handlers for high-level actions
|
* Creates handlers for high-level actions
|
||||||
* that could be performed on an individual cluster
|
* that could be performed on an individual cluster
|
||||||
@ -28,7 +21,8 @@ export const ClusterActions = (cluster: Cluster) => ({
|
|||||||
params: { clusterId: cluster.id }
|
params: { clusterId: cluster.id }
|
||||||
})),
|
})),
|
||||||
disconnect: async () => {
|
disconnect: async () => {
|
||||||
deactivateCluster(cluster.id);
|
clusterStore.deactivate(cluster.id);
|
||||||
|
navigate(landingURL());
|
||||||
await requestMain(clusterDisconnectHandler, cluster.id);
|
await requestMain(clusterDisconnectHandler, cluster.id);
|
||||||
},
|
},
|
||||||
remove: () => ConfirmDialog.open({
|
remove: () => ConfirmDialog.open({
|
||||||
@ -38,8 +32,9 @@ export const ClusterActions = (cluster: Cluster) => ({
|
|||||||
label: "Remove"
|
label: "Remove"
|
||||||
},
|
},
|
||||||
ok: () => {
|
ok: () => {
|
||||||
deactivateCluster(cluster.id);
|
clusterStore.deactivate(cluster.id);
|
||||||
clusterStore.removeById(cluster.id);
|
clusterStore.removeById(cluster.id);
|
||||||
|
navigate(landingURL());
|
||||||
},
|
},
|
||||||
message: <p>Are you sure want to remove cluster <b title={cluster.id}>{cluster.contextName}</b>?</p>,
|
message: <p>Are you sure want to remove cluster <b title={cluster.id}>{cluster.contextName}</b>?</p>,
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user