mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Redirect from /catalog to last catalog page (#3807)
* Redirect from /catalog to last catalog page Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Cleaning up Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Cleaning up more Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Splitting url params to pass in catalogURL() Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
8bca8dd7dc
commit
6b123dc4c0
5 files changed
+23
-10
No files matched your search
@@ -39,12 +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 previousActiveTab = createAppStorage("catalog-previous-active-tab", "");
|
||||
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", browseCatalogTab);
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@@ -75,7 +75,7 @@ export class Catalog extends React.Component<Props> {
|
||||
return `${group}/${kind}`;
|
||||
}
|
||||
|
||||
return "";
|
||||
return browseCatalogTab;
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
@@ -89,7 +89,7 @@ export class Catalog extends React.Component<Props> {
|
||||
previousActiveTab.set(this.routeActiveTab);
|
||||
|
||||
try {
|
||||
await when(() => (routeTab === "" || !!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(() => {
|
||||
@@ -157,7 +157,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());
|
||||
navigate(catalogURL({ params: { group: browseCatalogTab }}));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user