diff --git a/src/renderer/components/cluster-manager/cluster-manager.scss b/src/renderer/components/cluster-manager/cluster-manager.scss index dec5a069a2..b5bfbbebae 100644 --- a/src/renderer/components/cluster-manager/cluster-manager.scss +++ b/src/renderer/components/cluster-manager/cluster-manager.scss @@ -25,6 +25,10 @@ grid-area: menu; } + .error { + z-index: 1; + } + #lens-views { position: absolute; left: 0; diff --git a/src/renderer/components/cluster-manager/cluster-manager.tsx b/src/renderer/components/cluster-manager/cluster-manager.tsx index 85fb8a80c0..ab418ec827 100644 --- a/src/renderer/components/cluster-manager/cluster-manager.tsx +++ b/src/renderer/components/cluster-manager/cluster-manager.tsx @@ -21,12 +21,14 @@ import { buildURL } from "../../../common/utils/buildUrl"; import type { StorageLayer } from "../../utils"; import type { WatchForGeneralEntityNavigation } from "../../api/helpers/watch-for-general-entity-navigation.injectable"; import watchForGeneralEntityNavigationInjectable from "../../api/helpers/watch-for-general-entity-navigation.injectable"; +import currentPathInjectable from "../../routes/current-path.injectable"; interface Dependencies { catalogPreviousActiveTabStorage: StorageLayer; currentRouteComponent: IComputedValue; welcomeUrl: string; watchForGeneralEntityNavigation: WatchForGeneralEntityNavigation; + currentPath: IComputedValue; } @observer @@ -37,19 +39,40 @@ class NonInjectedClusterManager extends React.Component { ]); } - render() { + renderMainComponent() { const Component = this.props.currentRouteComponent.get(); - if (!Component) { + if (Component) { + return ; + } + + const currentPath = this.props.currentPath.get(); + + if (currentPath !== this.props.welcomeUrl) { return ; } + return ( +
+

ERROR!!

+

+ No matching route for the current path: + {" "} + {currentPath} + {" "} + which is the welcomeUrl. This is a bug. +

+
+ ); + } + + render() { return (
- + {this.renderMainComponent()}
@@ -65,5 +88,6 @@ export const ClusterManager = withInjectables(NonInjectedClusterMa currentRouteComponent: di.inject(currentRouteComponentInjectable), welcomeUrl: buildURL(di.inject(welcomeRouteInjectable).path), watchForGeneralEntityNavigation: di.inject(watchForGeneralEntityNavigationInjectable), + currentPath: di.inject(currentPathInjectable), }), }); diff --git a/src/renderer/routes/current-route-component.injectable.ts b/src/renderer/routes/current-route-component.injectable.ts index 56b047c37b..a4a8133c4f 100644 --- a/src/renderer/routes/current-route-component.injectable.ts +++ b/src/renderer/routes/current-route-component.injectable.ts @@ -4,7 +4,6 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx"; -import { matches } from "lodash/fp"; import { computed } from "mobx"; import currentRouteInjectable from "./current-route.injectable"; import { routeSpecificComponentInjectionToken } from "./route-specific-component-injection-token"; @@ -24,11 +23,13 @@ const currentRouteComponentInjectable = getInjectable({ return undefined; } - const routeSpecificComponent = routeComponents + return routeComponents .get() - .find(matches({ route: currentRoute })); - - return routeSpecificComponent?.Component; + .find(({ route }) => ( + route.path === currentRoute.path + && route.clusterFrame === currentRoute.clusterFrame + )) + ?.Component; }); }, });