mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Navigate back to last viewed catalog catagory (#3163)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
e49576ee8c
commit
7058193295
4 files changed
+15
-4
No files matched your search
@@ -30,6 +30,7 @@ import { MaterialTooltip } from "../material-tooltip/material-tooltip";
|
||||
import type { Cluster } from "../../../main/cluster";
|
||||
import { ClusterStore } from "../../../common/cluster-store";
|
||||
import type { ClusterViewRouteParams } from "../../../common/routes";
|
||||
import { previousActiveTab } from "../+catalog";
|
||||
|
||||
interface Props extends RouteComponentProps<ClusterViewRouteParams> {
|
||||
}
|
||||
@@ -43,7 +44,9 @@ export const ClusterTopbar = observer((props: Props) => {
|
||||
<TopBar label={getCluster()?.name}>
|
||||
<div>
|
||||
<MaterialTooltip title="Back to Catalog" placement="left">
|
||||
<Icon style={{ cursor: "default" }} material="close" onClick={() => navigate(catalogURL())}/>
|
||||
<Icon style={{ cursor: "default" }} material="close" onClick={() => {
|
||||
navigate(`${catalogURL()}/${previousActiveTab.get()}`);
|
||||
}}/>
|
||||
</MaterialTooltip>
|
||||
</div>
|
||||
</TopBar>
|
||||
|
||||
@@ -33,6 +33,7 @@ import { clusterActivateHandler } from "../../../common/cluster-ipc";
|
||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||
import { navigate } from "../../navigation";
|
||||
import { catalogURL, ClusterViewRouteParams } from "../../../common/routes";
|
||||
import { previousActiveTab } from "../+catalog";
|
||||
|
||||
interface Props extends RouteComponentProps<ClusterViewRouteParams> {
|
||||
}
|
||||
@@ -84,7 +85,7 @@ export class ClusterView extends React.Component<Props> {
|
||||
const disconnected = values[1];
|
||||
|
||||
if (hasLoadedView(this.clusterId) && disconnected) {
|
||||
navigate(catalogURL()); // redirect to catalog when active cluster get disconnected/not available
|
||||
navigate(`${catalogURL()}/${previousActiveTab.get()}`); // redirect to catalog when active cluster get disconnected/not available
|
||||
}
|
||||
}),
|
||||
]);
|
||||
|
||||
Reference in new issue
Block a user