1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix: observableHistoryInjectable is not the only default

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

12
package-lock.json generated
View File

@ -13945,9 +13945,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.4.369",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.369.tgz",
"integrity": "sha512-LfxbHXdA/S+qyoTEA4EbhxGjrxx7WK2h6yb5K2v0UCOufUKX+VZaHbl3svlzZfv9sGseym/g3Ne4DpsgRULmqg=="
"version": "1.4.370",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.370.tgz",
"integrity": "sha512-c+wzD4sCYQeNeasbnArwsU3ig6+lR6bwQmxfMjB6bx+XoopVSPFp+7ZLxqa90MTC+Tq9QQ5l7zsMNG9GgMBorg=="
},
"node_modules/electron-updater": {
"version": "4.6.5",
@ -48508,9 +48508,9 @@
}
},
"electron-to-chromium": {
"version": "1.4.369",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.369.tgz",
"integrity": "sha512-LfxbHXdA/S+qyoTEA4EbhxGjrxx7WK2h6yb5K2v0UCOufUKX+VZaHbl3svlzZfv9sGseym/g3Ne4DpsgRULmqg=="
"version": "1.4.370",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.370.tgz",
"integrity": "sha512-c+wzD4sCYQeNeasbnArwsU3ig6+lR6bwQmxfMjB6bx+XoopVSPFp+7ZLxqa90MTC+Tq9QQ5l7zsMNG9GgMBorg=="
},
"electron-updater": {
"version": "4.6.5",

View File

@ -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";

View File

@ -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({

View File

@ -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";

View File

@ -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";

View File

@ -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()?

View File

@ -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),
}),
});

View File

@ -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";

View File

@ -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";
/**

View File

@ -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;

View File

@ -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";

View File

@ -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);

View File

@ -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>

View File

@ -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 }) =>
(

View File

@ -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";

View File

@ -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());

View File

@ -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;

View File

@ -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;

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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";

View File

@ -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",

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

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;

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;

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;

View File

@ -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;

View File

@ -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";