mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Navigate to catalog explicitly on cluster disconnect (#7304)
* Navigate to catalog explicitly on cluster disconnect Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Linter fix Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> --------- Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
0084af56d6
commit
963c816b17
@ -127,7 +127,13 @@ export class KubernetesCluster<
|
|||||||
context.menuItems.push({
|
context.menuItems.push({
|
||||||
title: "Disconnect",
|
title: "Disconnect",
|
||||||
icon: "link_off",
|
icon: "link_off",
|
||||||
onClick: () => requestClusterDisconnection(this.getId()),
|
onClick: () => {
|
||||||
|
requestClusterDisconnection(this.getId());
|
||||||
|
broadcastMessage(
|
||||||
|
IpcRendererNavigationEvents.NAVIGATE_IN_APP,
|
||||||
|
"/catalog",
|
||||||
|
);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case LensKubernetesClusterStatus.DISCONNECTED:
|
case LensKubernetesClusterStatus.DISCONNECTED:
|
||||||
|
|||||||
@ -69,7 +69,11 @@ class NonInjectedClusterView extends React.Component<Dependencies> {
|
|||||||
disposeOnUnmount(this, [
|
disposeOnUnmount(this, [
|
||||||
reaction(() => this.clusterId, async (clusterId) => {
|
reaction(() => this.clusterId, async (clusterId) => {
|
||||||
// TODO: replace with better handling
|
// TODO: replace with better handling
|
||||||
if (clusterId && !this.props.entityRegistry.getById(clusterId)) {
|
if (!this.clusterId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.props.entityRegistry.getById(clusterId)) {
|
||||||
return this.props.navigateToCatalog(); // redirect to catalog when the clusterId does not correspond to an entity
|
return this.props.navigateToCatalog(); // redirect to catalog when the clusterId does not correspond to an entity
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,12 +84,6 @@ class NonInjectedClusterView extends React.Component<Dependencies> {
|
|||||||
}, {
|
}, {
|
||||||
fireImmediately: true,
|
fireImmediately: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
reaction(() => [this.cluster?.ready, this.cluster?.disconnected], ([, disconnected]) => {
|
|
||||||
if (this.isViewLoaded.get() && disconnected) {
|
|
||||||
this.props.navigateToCatalog(); // redirect to catalog when active cluster get disconnected/not available
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user