1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Navigate to landing page on cluster disconnect

Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
alexfront 2020-08-13 10:54:00 +03:00
parent 2960c03897
commit 3c6b229ccc
3 changed files with 9 additions and 2 deletions

View File

@ -83,6 +83,10 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
return Array.from(this.clusters.values());
}
isActive(id: ClusterId) {
return this.activeCluster.id === id;
}
setActive(id: ClusterId) {
this.activeClusterId = id;
}

View File

@ -47,11 +47,11 @@ export class ClusterStatus extends React.Component<Props> {
}
componentWillUnmount() {
ipcRenderer.removeAllListeners(`kube-auth:${this.cluster.id}`);
ipcRenderer.removeAllListeners(`kube-auth:${this.props.clusterId}`);
}
refreshCluster = async () => {
await clusterIpc.activate.invokeFromRenderer(this.cluster.id);
await clusterIpc.activate.invokeFromRenderer(this.props.clusterId);
}
reconnect = async () => {

View File

@ -59,6 +59,9 @@ export class ClustersMenu extends React.Component<Props> {
menu.append(new MenuItem({
label: _i18n._(t`Disconnect`),
click: async () => {
if (clusterStore.isActive(cluster.id)) {
navigate(landingURL());
}
await clusterIpc.disconnect.invokeFromRenderer(cluster.id);
}
}))