fix: observableHistoryInjectable is not the only default

Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
Gabriel committed 2023-04-24 20:58:37 +02:00
1 parent f386f44819
commit 6c5b643340
29 files changed
+40 -51

No files matched your search

@@ -12,7 +12,7 @@ import { frontEndRouteInjectionToken } from "../../common/front-end-routing/fron
import { computed, runInAction } from "mobx";
import React from "react";
import { routeSpecificComponentInjectionToken } from "../../renderer/routes/route-specific-component-injection-token";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import { createMemoryHistory } from "history";
import { createObservableHistory } from "mobx-observable-history";
import navigateToFrontPageInjectable from "../../common/front-end-routing/navigate-to-front-page.injectable";
@@ -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 { observableHistoryInjectable } from "@k8slens/routing";
import navigateToFrontPageInjectable from "../../../../common/front-end-routing/navigate-to-front-page.injectable";
const closePreferencesInjectable = getInjectable({
@@ -7,7 +7,7 @@ import { reaction, when } from "mobx";
import type { GeneralEntity } from "../../../common/catalog-entities";
import generalCategoryInjectable from "../../../common/catalog/categories/general.injectable";
import isActiveRouteInjectable from "../../navigation/is-route-active.injectable";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import type { Disposer } from "@k8slens/utilities";
import { disposer } from "@k8slens/utilities";
import catalogEntityRegistryInjectable from "../catalog/entity/registry.injectable";
@@ -6,7 +6,7 @@ import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { action } from "mobx";
import { byOrderNumber } from "../../../common/utils/composable-responsibilities/orderable/orderable";
import type { CatalogEntity } from "../../api/catalog-entity";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import type { RegisteredEntitySetting } from "./extension-registrator.injectable";
import catalogEntitySettingItemsInjectable from "./settings.injectable";
@@ -13,7 +13,7 @@ import { Animate } from "../animate";
import { cssNames, noop, stopPropagation } from "@k8slens/utilities";
import type { ObservableHistory } from "mobx-observable-history";
import { withInjectables } from "@ogre-tools/injectable-react";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import requestAnimationFrameInjectable from "../animate/request-animation-frame.injectable";
// todo: refactor + handle animation-end in props.onClose()?
@@ -16,7 +16,7 @@ import { Animate } from "../animate";
import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "../resizing-anchor";
import drawerStorageInjectable, { defaultDrawerWidth } from "./drawer-storage/drawer-storage.injectable";
import { withInjectables } from "@ogre-tools/injectable-react";
import historyInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import type { History } from "history";
import type { StorageLayer } from "../../utils/storage-helper";
@@ -251,7 +251,7 @@ class NonInjectedDrawer extends React.Component<DrawerProps & Dependencies & typ
export const Drawer = withInjectables<Dependencies, DrawerProps>(NonInjectedDrawer as React.ElementType<DrawerProps & Dependencies>, {
getProps: (di, props) => ({
...props,
history: di.inject(historyInjectable),
history: di.inject(observableHistoryInjectable),
drawerStorage: di.inject(drawerStorageInjectable),
}),
});
@@ -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 { observableHistoryInjectable } from "@k8slens/routing";
import kubeDetailsUrlParamInjectable from "./kube-details-url.injectable";
import kubeSelectedUrlParamInjectable from "./kube-selected-url.injectable";
@@ -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 { observableHistoryInjectable } from "@k8slens/routing";
import getDetailsUrlInjectable from "./get-details-url.injectable";
/**
@@ -12,7 +12,7 @@ import { cssNames } from "@k8slens/utilities";
import { CloseButton } from "./close-button";
import { getLegacyGlobalDiForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
import navigateToCatalogInjectable from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
export interface SettingLayoutProps extends React.DOMAttributes<any> {
className?: IClassName;
@@ -15,7 +15,7 @@ import { Tab, Tabs } from "../tabs";
import { ErrorBoundary } from "@k8slens/error-boundary";
import type { ObservableHistory } from "mobx-observable-history";
import { withInjectables } from "@ogre-tools/injectable-react";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import type { Navigate } from "../../navigation/navigate.injectable";
import navigateInjectable from "../../navigation/navigate.injectable";
@@ -24,7 +24,7 @@ import navigateToHelmChartsInjectable from "../../../common/front-end-routing/ro
import hostedClusterInjectable from "../../cluster-frame-context/hosted-cluster.injectable";
import { Cluster } from "../../../common/cluster/cluster";
import type { NamespaceStore } from "../+namespaces/store";
import historyInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import type { MinimalTrayMenuItem } from "../../../main/tray/electron-tray/electron-tray.injectable";
import electronTrayInjectable from "../../../main/tray/electron-tray/electron-tray.injectable";
import { getDiForUnitTesting as getRendererDi } from "../../getDiForUnitTesting";
@@ -292,7 +292,7 @@ export const getApplicationBuilder = () => {
await callback({ windowDi });
}
const history = windowDi.inject(historyInjectable);
const history = windowDi.inject(observableHistoryInjectable);
const render = renderFor(windowDi);
@@ -12,7 +12,7 @@ import { DiContextProvider } from "@ogre-tools/injectable-react";
import { Router } from "react-router";
import { DefaultProps } from "../../mui-base-theme";
import { ClusterFrame } from "./cluster-frame";
import historyInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import { computed } from "mobx";
import { Cluster } from "../../../common/cluster/cluster";
import subscribeStoresInjectable from "../../kube-watch-api/subscribe-stores.injectable";
@@ -34,7 +34,7 @@ describe("<ClusterFrame />", () => {
di = getDiForUnitTesting();
render = () => testingLibraryRender((
<DiContextProvider value={{ di }}>
<Router history={di.inject(historyInjectable)}>
<Router history={di.inject(observableHistoryInjectable)}>
{DefaultProps(ClusterFrame)}
</Router>
</DiContextProvider>
@@ -4,7 +4,7 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { Router } from "react-router";
import historyInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import React from "react";
import {
@@ -15,7 +15,7 @@ const routingReactApplicationHocInjectable = getInjectable({
id: "routing-react-application-hoc",
instantiate: (di) => {
const history = di.inject(historyInjectable);
const history = di.inject(observableHistoryInjectable);
return ({ children }) =>
(
@@ -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 { observableHistoryInjectable } from "@k8slens/routing";
import type { PageParamDependencies, PageParamInit } from "./page-param";
import { PageParam } from "./page-param";
@@ -3,8 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { createMemoryHistory } from "@k8slens/routing";
import { createMemoryHistory } from "history";
import { getGlobalOverride } from "@k8slens/test-utils";
import historyInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
export default getGlobalOverride(historyInjectable, () => createMemoryHistory());
export default getGlobalOverride(observableHistoryInjectable, () => createMemoryHistory());
@@ -5,7 +5,7 @@
import { getInjectable } from "@ogre-tools/injectable";
import type { match, RouteProps } from "react-router";
import { matchPath } from "react-router";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
export type MatchRoute = <Params extends { [K in keyof Params]?: string }>(route: string | string[] | RouteProps) => match<Params> | null;
@@ -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 { observableHistoryInjectable } from "@k8slens/routing";
import { createPath } from "history";
export type Navigate = (location: LocationDescriptor) => void;
@@ -5,7 +5,7 @@
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 { observableHistoryInjectable } from "@k8slens/routing";
const setupLoggingForNavigationInjectable = getInjectable({
id: "setup-logging-for-navigation",
@@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
import { emitWindowLocationChanged } from "../ipc";
import { reaction } from "mobx";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
const watchHistoryStateInjectable = getInjectable({
id: "watch-history-state",
@@ -4,7 +4,7 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
const currentPathInjectable = getInjectable({
id: "current-path",
@@ -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 { observableHistoryInjectable } from "@k8slens/routing";
import { runInAction } from "mobx";
import type { NavigateToUrl } from "../../common/front-end-routing/navigate-to-url-injection-token";
import { navigateToUrlInjectionToken } from "../../common/front-end-routing/navigate-to-url-injection-token";
@@ -5,7 +5,7 @@
import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx";
import { parse as parseQueryString } from "query-string";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
const queryParametersInjectable = getInjectable({
id: "query-parameters",
+2 -2
View File
@@ -9,8 +9,8 @@ $ npm install @k8slens/routing
```
```typescript
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
import { searchParamsOptions } from "@k8slens/routing";
```
## Extendability
-4
View File
@@ -3,8 +3,4 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import observableHistoryInjectable from "./src/observable-history.injectable";
export * from "./src";
export default observableHistoryInjectable;
+1 -2
View File
@@ -6,9 +6,8 @@ import { getInjectable } from "@ogre-tools/injectable";
import { createBrowserHistory } from "history";
import type { History } from "history";
const historyInjectable = getInjectable({
export const historyInjectable = getInjectable({
id: "history",
instantiate: (): History => createBrowserHistory(),
});
export default historyInjectable;
-4
View File
@@ -3,10 +3,6 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import observableHistoryInjectable from "./observable-history.injectable";
export * from "./history.injectable";
export * from "./observable-history.injectable";
export * from "./search-params";
export { createMemoryHistory } from "history";
export default observableHistoryInjectable;
@@ -5,9 +5,9 @@
import { getInjectable } from "@ogre-tools/injectable";
import { createObservableHistory } from "mobx-observable-history";
import { searchParamsOptions } from "./search-params";
import historyInjectable from "./history.injectable";
import { historyInjectable } from "./history.injectable";
const observableHistoryInjectable = getInjectable({
export const observableHistoryInjectable = getInjectable({
id: "observable-history",
instantiate: (di) => {
@@ -19,5 +19,3 @@ const observableHistoryInjectable = getInjectable({
return navigation;
},
});
export default observableHistoryInjectable;
@@ -12,7 +12,7 @@ import { Button } from "@k8slens/button";
import type { SingleOrMany } from "@k8slens/utilities";
import type { ObservableHistory } from "mobx-observable-history";
import { withInjectables } from "@ogre-tools/injectable-react";
import observableHistoryInjectable from "@k8slens/routing";
import { observableHistoryInjectable } from "@k8slens/routing";
const issuesTrackerUrl = "https://github.com/lensapp/lens/issues";
const forumsUrl = "https://forums.k8slens.dev";