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

Cleaning up more

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-09-27 07:54:56 +03:00
parent c76b4d59d5
commit 5f5b1efadb
2 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,10 @@ export const catalogRoute: RouteProps = {
path: "/catalog/:group?/:kind?" path: "/catalog/:group?/:kind?"
}; };
export const getPreviousTabUrl = (path: string) => {
return `${catalogURL()}/${path || browseCatalogTab}`;
};
export const catalogURL = buildURL<CatalogViewRouteParam>(catalogRoute.path); export const catalogURL = buildURL<CatalogViewRouteParam>(catalogRoute.path);
export const browseCatalogTab = "browse"; export const browseCatalogTab = "browse";

View File

@ -40,7 +40,7 @@ import { reaction } from "mobx";
import { navigation } from "../../navigation"; import { navigation } from "../../navigation";
import { setEntityOnRouteMatch } from "../../../main/catalog-sources/helpers/general-active-sync"; import { setEntityOnRouteMatch } from "../../../main/catalog-sources/helpers/general-active-sync";
import { TopBar } from "../layout/topbar"; import { TopBar } from "../layout/topbar";
import { browseCatalogTab, catalogURL } from "../../../common/routes"; import { catalogURL, getPreviousTabUrl } from "../../../common/routes";
@observer @observer
export class ClusterManager extends React.Component { export class ClusterManager extends React.Component {
@ -57,7 +57,7 @@ export class ClusterManager extends React.Component {
<main> <main>
<div id="lens-views"/> <div id="lens-views"/>
<Switch> <Switch>
<Redirect exact from={catalogURL()} to={`${catalogURL()}/${previousActiveTab.get() || browseCatalogTab}`}/> <Redirect exact from={catalogURL()} to={getPreviousTabUrl(previousActiveTab.get())}/>
<Route component={Welcome} {...routes.welcomeRoute} /> <Route component={Welcome} {...routes.welcomeRoute} />
<Route component={Catalog} {...routes.catalogRoute} /> <Route component={Catalog} {...routes.catalogRoute} />
<Route component={Preferences} {...routes.preferencesRoute} /> <Route component={Preferences} {...routes.preferencesRoute} />