mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: observableHistoryInjectionToken and 1 revert for GlobalOverride
Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
1 parent
db9a3675e1
commit
8c0220c353
22 files changed
+51
-45
No files matched your search
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
||||
import type { PageParamDependencies, PageParamInit } from "./page-param";
|
||||
import { PageParam } from "./page-param";
|
||||
|
||||
@@ -13,7 +13,7 @@ const createPageParamInjectable = getInjectable({
|
||||
id: "create-page-param",
|
||||
instantiate: (di): CreatePageParam => {
|
||||
const deps: PageParamDependencies = {
|
||||
history: di.inject(observableHistoryInjectable),
|
||||
history: di.inject(observableHistoryInjectionToken),
|
||||
};
|
||||
|
||||
return (init) => new PageParam(deps, init);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
import { createMemoryHistory } from "history";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import { historyInjectionToken } from "@k8slens/routing";
|
||||
import { historyInjectable } from "@k8slens/routing";
|
||||
|
||||
export default getGlobalOverride(historyInjectionToken, () => createMemoryHistory());
|
||||
export default getGlobalOverride(historyInjectable, () => createMemoryHistory());
|
||||
@@ -5,14 +5,14 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { match, RouteProps } from "react-router";
|
||||
import { matchPath } from "react-router";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
||||
|
||||
export type MatchRoute = <Params extends { [K in keyof Params]?: string }>(route: string | string[] | RouteProps) => match<Params> | null;
|
||||
|
||||
const matchRouteInjectable = getInjectable({
|
||||
id: "match-route",
|
||||
instantiate: (di): MatchRoute => {
|
||||
const observableHistory = di.inject(observableHistoryInjectable);
|
||||
const observableHistory = di.inject(observableHistoryInjectionToken);
|
||||
|
||||
return (route) => matchPath(observableHistory.location.pathname, route);
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { LocationDescriptor } from "history";
|
||||
import { action } from "mobx";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
||||
import { createPath } from "history";
|
||||
|
||||
export type Navigate = (location: LocationDescriptor) => void;
|
||||
@@ -13,7 +13,7 @@ export type Navigate = (location: LocationDescriptor) => void;
|
||||
const navigateInjectable = getInjectable({
|
||||
id: "navigate",
|
||||
instantiate: (di): Navigate => {
|
||||
const observableHistory = di.inject(observableHistoryInjectable);
|
||||
const observableHistory = di.inject(observableHistoryInjectionToken);
|
||||
|
||||
return action((location) => {
|
||||
const currentLocation = createPath(observableHistory.location);
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
import { beforeFrameStartsSecondInjectionToken } from "../before-frame-starts/tokens";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
||||
|
||||
const setupLoggingForNavigationInjectable = getInjectable({
|
||||
id: "setup-logging-for-navigation",
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const observableHistory = di.inject(observableHistoryInjectable);
|
||||
const observableHistory = di.inject(observableHistoryInjectionToken);
|
||||
|
||||
observableHistory.listen((location, action) => {
|
||||
const isClusterView = !process.isMainFrame;
|
||||
|
||||
Reference in new issue
Block a user