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

fix: redirect to catalog when disconnecting active cluster

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2021-05-18 13:40:24 +03:00
parent 267b070771
commit 8882e65456

View File

@ -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,
}),
]);