mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleaning up
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
008c397267
commit
c76b4d59d5
@ -31,3 +31,5 @@ export const catalogRoute: RouteProps = {
|
||||
};
|
||||
|
||||
export const catalogURL = buildURL<CatalogViewRouteParam>(catalogRoute.path);
|
||||
|
||||
export const browseCatalogTab = "browse";
|
||||
|
||||
@ -39,13 +39,12 @@ import { MainLayout } from "../layout/main-layout";
|
||||
import { createAppStorage, cssNames } from "../../utils";
|
||||
import { makeCss } from "../../../common/utils/makeCss";
|
||||
import { CatalogEntityDetails } from "./catalog-entity-details";
|
||||
import { catalogURL, CatalogViewRouteParam } from "../../../common/routes";
|
||||
import { browseCatalogTab, catalogURL, CatalogViewRouteParam } from "../../../common/routes";
|
||||
import { CatalogMenu } from "./catalog-menu";
|
||||
import { HotbarIcon } from "../hotbar/hotbar-icon";
|
||||
import { RenderDelay } from "../render-delay/render-delay";
|
||||
|
||||
export const browseCatalogPage = "browse";
|
||||
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", browseCatalogPage);
|
||||
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", browseCatalogTab);
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@ -76,7 +75,7 @@ export class Catalog extends React.Component<Props> {
|
||||
return `${group}/${kind}`;
|
||||
}
|
||||
|
||||
return browseCatalogPage;
|
||||
return browseCatalogTab;
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
@ -90,7 +89,7 @@ export class Catalog extends React.Component<Props> {
|
||||
previousActiveTab.set(this.routeActiveTab);
|
||||
|
||||
try {
|
||||
await when(() => (routeTab === browseCatalogPage || !!catalogCategoryRegistry.filteredItems.find(i => i.getId() === routeTab)), { timeout: 5_000 }); // we need to wait because extensions might take a while to load
|
||||
await when(() => (routeTab === browseCatalogTab || !!catalogCategoryRegistry.filteredItems.find(i => i.getId() === routeTab)), { timeout: 5_000 }); // we need to wait because extensions might take a while to load
|
||||
const item = catalogCategoryRegistry.filteredItems.find(i => i.getId() === routeTab);
|
||||
|
||||
runInAction(() => {
|
||||
@ -154,7 +153,7 @@ export class Catalog extends React.Component<Props> {
|
||||
if (activeCategory) {
|
||||
navigate(catalogURL({ params: {group: activeCategory.spec.group, kind: activeCategory.spec.names.kind }}));
|
||||
} else {
|
||||
navigate(`${catalogURL()}/browse`);
|
||||
navigate(catalogURL({ params: { group: browseCatalogTab }}));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ import React from "react";
|
||||
import { Redirect, Route, Switch } from "react-router";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { BottomBar } from "./bottom-bar";
|
||||
import { browseCatalogPage, Catalog, previousActiveTab } from "../+catalog";
|
||||
import { Catalog, previousActiveTab } from "../+catalog";
|
||||
import { Preferences } from "../+preferences";
|
||||
import { AddCluster } from "../+add-cluster";
|
||||
import { ClusterView } from "./cluster-view";
|
||||
@ -40,7 +40,7 @@ import { reaction } from "mobx";
|
||||
import { navigation } from "../../navigation";
|
||||
import { setEntityOnRouteMatch } from "../../../main/catalog-sources/helpers/general-active-sync";
|
||||
import { TopBar } from "../layout/topbar";
|
||||
import { catalogURL } from "../../../common/routes";
|
||||
import { browseCatalogTab, catalogURL } from "../../../common/routes";
|
||||
|
||||
@observer
|
||||
export class ClusterManager extends React.Component {
|
||||
@ -57,7 +57,7 @@ export class ClusterManager extends React.Component {
|
||||
<main>
|
||||
<div id="lens-views"/>
|
||||
<Switch>
|
||||
<Redirect exact from={catalogURL()} to={`${catalogURL()}/${previousActiveTab.get() || browseCatalogPage}`}/>
|
||||
<Redirect exact from={catalogURL()} to={`${catalogURL()}/${previousActiveTab.get() || browseCatalogTab}`}/>
|
||||
<Route component={Welcome} {...routes.welcomeRoute} />
|
||||
<Route component={Catalog} {...routes.catalogRoute} />
|
||||
<Route component={Preferences} {...routes.preferencesRoute} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user