From 8882e65456e1f03126d7a2f255000a53669b8c29 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 18 May 2021 13:40:24 +0300 Subject: [PATCH] fix: redirect to catalog when disconnecting active cluster Signed-off-by: Roman --- .../components/cluster-manager/cluster-view.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/cluster-manager/cluster-view.tsx b/src/renderer/components/cluster-manager/cluster-view.tsx index 6717b86ebc..1dd9747257 100644 --- a/src/renderer/components/cluster-manager/cluster-view.tsx +++ b/src/renderer/components/cluster-manager/cluster-view.tsx @@ -30,7 +30,8 @@ import { ClusterStore } from "../../../common/cluster-store"; import { requestMain } from "../../../common/ipc"; import { clusterActivateHandler } from "../../../common/cluster-ipc"; import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; -import { getMatchedClusterId } from "../../navigation"; +import { getMatchedClusterId, navigate } from "../../navigation"; +import { catalogURL } from "../+catalog/catalog.route"; @observer export class ClusterView extends React.Component { @@ -67,8 +68,13 @@ export class ClusterView extends React.Component { fireImmediately: true, }), - // show cluster's iframe when ready/connected - reaction(() => this.isReady, () => refreshViews(this.clusterId), { + reaction(() => this.isReady, (ready) => { + if (ready) { + refreshViews(this.clusterId); // show cluster's view (iframe) + } else if (hasLoadedView(this.clusterId)) { + navigate(catalogURL()); // redirect to catalog when active cluster get disconnected/not available + } + }, { fireImmediately: true, }), ]);