mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
feature @k8slens/routing
Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
f3b13b0816
commit
e8c94abc0b
61
package-lock.json
generated
61
package-lock.json
generated
@ -3979,6 +3979,10 @@
|
||||
"resolved": "packages/resource-templates",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@k8slens/routing": {
|
||||
"resolved": "packages/routing",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@k8slens/run-many": {
|
||||
"resolved": "packages/utility-features/run-many",
|
||||
"link": true
|
||||
@ -36188,6 +36192,7 @@
|
||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||
"@k8slens/messaging-for-main": "^1.0.0-alpha.1",
|
||||
"@k8slens/messaging-for-renderer": "^1.0.0-alpha.1",
|
||||
"@k8slens/routing": "^1.0.0-alpha.5",
|
||||
"@k8slens/run-many": "^1.0.0-alpha.1",
|
||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||
"@k8slens/test-utils": "^1.0.0-alpha.1",
|
||||
@ -37190,6 +37195,62 @@
|
||||
"version": "1.0.0-alpha.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"packages/routing": {
|
||||
"name": "@k8slens/routing",
|
||||
"version": "1.0.0-alpha.5",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "^1.6.4",
|
||||
"@k8slens/eslint-config": "6.5.0-alpha.1",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0-alpha.3",
|
||||
"@testing-library/react": "^12.1.5",
|
||||
"@testing-library/user-event": "^13.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/react-application": "^1.0.0-alpha.0",
|
||||
"@ogre-tools/fp": "^15.3.1",
|
||||
"@ogre-tools/injectable": "^15.3.1",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||
"@ogre-tools/injectable-react": "^15.3.0",
|
||||
"auto-bind": "^4.0.0",
|
||||
"history": "^4.10.1",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.8.0",
|
||||
"mobx-observable-history": "^2.0.3",
|
||||
"mobx-react": "^7.6.0",
|
||||
"react": "^17",
|
||||
"react-dom": "^17.0.2"
|
||||
}
|
||||
},
|
||||
"packages/routing/node_modules/@k8slens/eslint-config": {
|
||||
"version": "6.5.0-alpha.1",
|
||||
"resolved": "https://registry.npmjs.org/@k8slens/eslint-config/-/eslint-config-6.5.0-alpha.1.tgz",
|
||||
"integrity": "sha512-6DdfKe/iafX85GBK/UlKgz29FOIOp/UVS03bFGLyw7Vmm7pauB0FEHTAdbr3g1qG/Zcn6nxhOM3uqQyRY/uEyA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"lens-lint": "bin/lint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": ">= 5",
|
||||
"@typescript-eslint/parser": ">= 5",
|
||||
"eslint": ">= 7",
|
||||
"eslint-config-airbnb-typescript": ">= 17",
|
||||
"eslint-config-prettier": ">= 8",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"eslint-plugin-import": ">= 2",
|
||||
"eslint-plugin-jest": ">= 27",
|
||||
"eslint-plugin-jsx-a11y": ">= 6",
|
||||
"eslint-plugin-no-unsanitized": ">= 4.0.2",
|
||||
"eslint-plugin-prettier": ">= 4",
|
||||
"eslint-plugin-react-hooks": ">= 4",
|
||||
"eslint-plugin-security": ">= 1.6.0",
|
||||
"eslint-plugin-simple-import-sort": ">= 7",
|
||||
"eslint-plugin-unused-imports": ">= 2",
|
||||
"eslint-plugin-xss": ">= 0.1.12",
|
||||
"prettier": ">= 2"
|
||||
}
|
||||
},
|
||||
"packages/semver": {
|
||||
"name": "@k8slens/semver",
|
||||
"version": "6.5.0-alpha.4",
|
||||
|
||||
@ -315,6 +315,7 @@
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/application-for-electron-main": "^6.5.0-alpha.0",
|
||||
"@k8slens/button": "^1.0.0-alpha.0",
|
||||
"@k8slens/routing": "^1.0.0-alpha.5",
|
||||
"@k8slens/cluster-settings": "^6.5.0-alpha.1",
|
||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
||||
"@k8slens/legacy-extensions": "^1.0.0-alpha.0",
|
||||
|
||||
@ -12,13 +12,12 @@ 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 "../../renderer/navigation/observable-history.injectable";
|
||||
import { observableHistoryInjectable, searchParamsOptions } 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";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { preferenceItemInjectionToken } from "./renderer/preference-items/preference-item-injection-token";
|
||||
import { searchParamsOptions } from "../../renderer/navigation/search-params";
|
||||
|
||||
describe("preferences - closing-preferences", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
@ -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 "../../../../renderer/navigation/observable-history.injectable";
|
||||
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 "../../navigation/observable-history.injectable";
|
||||
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 "../../navigation/observable-history.injectable";
|
||||
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 "../../navigation/observable-history.injectable";
|
||||
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 "../../navigation/history.injectable";
|
||||
import { historyInjectable } from "@k8slens/routing";
|
||||
import type { History } from "history";
|
||||
import type { StorageLayer } from "../../utils/storage-helper";
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import { issuesTrackerUrl, forumsUrl } from "../../../common/vars";
|
||||
import type { SingleOrMany } from "@k8slens/utilities";
|
||||
import type { ObservableHistory } from "mobx-observable-history";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import observableHistoryInjectable from "../../navigation/observable-history.injectable";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
|
||||
export interface ErrorBoundaryProps {
|
||||
children?: SingleOrMany<React.ReactNode>;
|
||||
|
||||
@ -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 "../../navigation/observable-history.injectable";
|
||||
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 "../../navigation/observable-history.injectable";
|
||||
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 "../../navigation/observable-history.injectable";
|
||||
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 "../error-boundary";
|
||||
import type { ObservableHistory } from "mobx-observable-history";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import observableHistoryInjectable from "../../navigation/observable-history.injectable";
|
||||
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 "../../navigation/history.injectable";
|
||||
import { historyInjectable } 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";
|
||||
|
||||
@ -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 "../../navigation/history.injectable";
|
||||
import { historyInjectable } from "@k8slens/routing";
|
||||
import { computed } from "mobx";
|
||||
import { Cluster } from "../../../common/cluster/cluster";
|
||||
import subscribeStoresInjectable from "../../kube-watch-api/subscribe-stores.injectable";
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { Router } from "react-router";
|
||||
import historyInjectable from "../navigation/history.injectable";
|
||||
import { historyInjectable } from "@k8slens/routing";
|
||||
import React from "react";
|
||||
|
||||
import {
|
||||
|
||||
@ -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 "./observable-history.injectable";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
import type { PageParamDependencies, PageParamInit } from "./page-param";
|
||||
import { PageParam } from "./page-param";
|
||||
|
||||
|
||||
@ -5,6 +5,6 @@
|
||||
|
||||
import { createMemoryHistory } from "history";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import historyInjectable from "./history.injectable";
|
||||
import { historyInjectable } from "@k8slens/routing";
|
||||
|
||||
export default getGlobalOverride(historyInjectable, () => 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 "./observable-history.injectable";
|
||||
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 "./observable-history.injectable";
|
||||
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 "./observable-history.injectable";
|
||||
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 "../navigation/observable-history.injectable";
|
||||
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 "../navigation/observable-history.injectable";
|
||||
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 "../navigation/observable-history.injectable";
|
||||
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 "../navigation/observable-history.injectable";
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
|
||||
const queryParametersInjectable = getInjectable({
|
||||
id: "query-parameters",
|
||||
|
||||
@ -20,6 +20,7 @@ import { registerInjectableReact } from "@ogre-tools/injectable-react";
|
||||
import { messagingFeatureForRenderer } from "@k8slens/messaging-for-renderer";
|
||||
import { keyboardShortcutsFeature } from "@k8slens/keyboard-shortcuts";
|
||||
import { reactApplicationFeature } from "@k8slens/react-application";
|
||||
import { routingFeature } from "@k8slens/routing";
|
||||
|
||||
const environment = "renderer";
|
||||
|
||||
@ -38,6 +39,7 @@ runInAction(() => {
|
||||
messagingFeatureForRenderer,
|
||||
keyboardShortcutsFeature,
|
||||
reactApplicationFeature,
|
||||
routingFeature,
|
||||
metricsFeature
|
||||
);
|
||||
|
||||
|
||||
6
packages/routing/.eslintrc.json
Normal file
6
packages/routing/.eslintrc.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@k8slens/eslint-config/eslint",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
}
|
||||
}
|
||||
19
packages/routing/.swcrc
Normal file
19
packages/routing/.swcrc
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"module": {
|
||||
"type": "commonjs"
|
||||
},
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true,
|
||||
"decorators": true,
|
||||
"dynamicImport": false
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true,
|
||||
"decoratorMetadata": true
|
||||
},
|
||||
"target": "es2019"
|
||||
}
|
||||
}
|
||||
|
||||
16
packages/routing/README.md
Normal file
16
packages/routing/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# @k8slens/routing
|
||||
|
||||
This package contains stuff related to creating Lens-applications.
|
||||
|
||||
# Usage
|
||||
|
||||
```bash
|
||||
$ npm install @k8slens/routing
|
||||
```
|
||||
|
||||
```typescript
|
||||
import { observableHistoryInjectable } from "@k8slens/routing";
|
||||
import { searchParamsOptions } from "@k8slens/routing";
|
||||
```
|
||||
|
||||
## Extendability
|
||||
9
packages/routing/index.ts
Normal file
9
packages/routing/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export { historyInjectable } from "./src/history.injectable";
|
||||
export { observableHistoryInjectable } from "./src/observable-history.injectable";
|
||||
export { searchParamsOptions } from "./src/search-params";
|
||||
export { routingFeature } from "./src/feature";
|
||||
4
packages/routing/jest.config.js
Normal file
4
packages/routing/jest.config.js
Normal file
@ -0,0 +1,4 @@
|
||||
const { configForReact } =
|
||||
require("@k8slens/jest").monorepoPackageConfig(__dirname);
|
||||
|
||||
module.exports = configForReact;
|
||||
54
packages/routing/package.json
Normal file
54
packages/routing/package.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "@k8slens/routing",
|
||||
"private": false,
|
||||
"version": "1.0.0-alpha.5",
|
||||
"description": "Highly extendable routing in the Lens.",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": {
|
||||
"name": "OpenLens Authors",
|
||||
"email": "info@k8slens.dev"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"lint": "lens-lint",
|
||||
"lint:fix": "lens-lint --fix"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/react-application": "^1.0.0-alpha.0",
|
||||
"@ogre-tools/fp": "^15.3.1",
|
||||
"@ogre-tools/injectable": "^15.3.1",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||
"@ogre-tools/injectable-react": "^15.3.0",
|
||||
"history": "^4.10.1",
|
||||
"mobx-observable-history": "^2.0.3",
|
||||
"auto-bind": "^4.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.8.0",
|
||||
"mobx-react": "^7.6.0",
|
||||
"react": "^17",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "^1.6.4",
|
||||
"@k8slens/eslint-config": "6.5.0-alpha.1",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0-alpha.3",
|
||||
"@testing-library/react": "^12.1.5",
|
||||
"@testing-library/user-event": "^13.5.0"
|
||||
}
|
||||
}
|
||||
19
packages/routing/src/feature.ts
Normal file
19
packages/routing/src/feature.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { getFeature } from "@k8slens/feature-core";
|
||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||
import { reactApplicationFeature } from "@k8slens/react-application";
|
||||
|
||||
export const routingFeature = getFeature({
|
||||
id: "routing",
|
||||
|
||||
register: (di) => {
|
||||
autoRegister({
|
||||
di,
|
||||
targetModule: module,
|
||||
getRequireContexts: () => [
|
||||
require.context("./", true, /\.injectable\.(ts|tsx)$/),
|
||||
],
|
||||
});
|
||||
},
|
||||
|
||||
dependencies: [reactApplicationFeature],
|
||||
});
|
||||
@ -6,9 +6,7 @@ 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;
|
||||
@ -5,19 +5,17 @@
|
||||
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) => {
|
||||
const history = di.inject(historyInjectable);
|
||||
const navigation = createObservableHistory(history, {
|
||||
const navigation = createObservableHistory(history, {
|
||||
searchParams: searchParamsOptions,
|
||||
});
|
||||
|
||||
return navigation;
|
||||
},
|
||||
});
|
||||
|
||||
export default observableHistoryInjectable;
|
||||
28
packages/routing/tailwind.config.js
Normal file
28
packages/routing/tailwind.config.js
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
content: [path.join(__dirname, "src/**/*.tsx")],
|
||||
darkMode: "class",
|
||||
theme: {
|
||||
fontFamily: {
|
||||
sans: ["Roboto", "Helvetica", "Arial", "sans-serif"],
|
||||
},
|
||||
extend: {
|
||||
colors: {
|
||||
textAccent: "var(--textColorAccent)",
|
||||
textPrimary: "var(--textColorPrimary)",
|
||||
textTertiary: "var(--textColorTertiary)",
|
||||
textDimmed: "var(--textColorDimmed)",
|
||||
},
|
||||
},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
4
packages/routing/tsconfig.json
Normal file
4
packages/routing/tsconfig.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "@k8slens/typescript/config/base.json",
|
||||
"include": ["**/*.ts", "**/*.tsx"],
|
||||
}
|
||||
1
packages/routing/webpack.config.js
Normal file
1
packages/routing/webpack.config.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/webpack").configForReact;
|
||||
Loading…
Reference in New Issue
Block a user