From dfd30e627a042173bbaac532262e70e4170124c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Dombya?= <135591453+hervedombya@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:47:35 +0100 Subject: [PATCH] Refactor history type definitions and update package versions --- shell-ui/package-lock.json | 97 +++++-- shell-ui/package.json | 6 +- shell-ui/src/FederatedApp.tsx | 3 +- shell-ui/src/navbar/NavBar.tsx | 3 +- .../compiled-types/src/FederatedApp.d.ts | 66 +---- .../src/NotificationCenterProvider.d.ts | 11 +- .../compiled-types/src/alerts/alertHooks.d.ts | 2 +- .../src/hooks/useShellHooks.d.ts | 45 ++++ .../@scality/core-ui/package.json | 15 +- .../node_modules/@types/history/DOMUtils.d.ts | 17 -- .../@types/history/ExecutionEnvironment.d.ts | 1 - .../@types/history/LocationUtils.d.ts | 9 - .../@types/history/PathUtils.d.ts | 9 - .../@types/history/createBrowserHistory.d.ts | 11 - .../@types/history/createHashHistory.d.ts | 12 - .../@types/history/createMemoryHistory.d.ts | 19 -- .../history/createTransitionManager.d.ts | 20 -- .../node_modules/@types/history/index.d.ts | 95 ------- .../node_modules/@types/history/package.json | 40 --- .../@types/react-router/index.d.ts | 198 -------------- .../@types/react-router/package.json | 130 --------- .../@types/react-router/ts4.6/index.d.ts | 173 ------------ .../@types/react/jsx-dev-runtime.d.ts | 47 +++- .../@types/react/jsx-runtime.d.ts | 38 ++- .../node_modules/@types/react/package.json | 165 ++++++++---- .../@types/react/ts5.0/jsx-dev-runtime.d.ts | 44 +++ .../@types/react/ts5.0/jsx-runtime.d.ts | 35 +++ .../oidc-client-ts/dist/esm/package.json | 2 +- .../node_modules/oidc-client-ts/package.json | 42 +-- .../node_modules/react-query/package.json | 13 +- .../node_modules/react-router/package.json | 127 +++++++++ ui/package-lock.json | 165 +++++++++--- ui/package.json | 6 +- ui/src/FederableApp.tsx | 33 +-- ui/src/components/NodeListTable.tsx | 21 +- ui/src/components/VolumeListTable.tsx | 7 +- ui/src/containers/Layout.tsx | 203 +++++++------- ui/src/containers/NodePage.tsx | 9 +- ui/src/containers/NodePageContent.tsx | 27 +- ui/src/containers/NodePageRSP.tsx | 15 +- ui/src/containers/PrivateRoute.tsx | 38 +-- ui/src/containers/VolumePageContent.tsx | 252 ++---------------- ui/src/containers/VolumePageRSP.tsx | 205 ++++++++++++++ 43 files changed, 1074 insertions(+), 1402 deletions(-) create mode 100644 ui/@mf-types/shell/compiled-types/src/hooks/useShellHooks.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/DOMUtils.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/ExecutionEnvironment.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/LocationUtils.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/PathUtils.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/createBrowserHistory.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/createHashHistory.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/createMemoryHistory.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/createTransitionManager.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/index.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/history/package.json delete mode 100644 ui/@mf-types/shell/node_modules/@types/react-router/index.d.ts delete mode 100644 ui/@mf-types/shell/node_modules/@types/react-router/package.json delete mode 100644 ui/@mf-types/shell/node_modules/@types/react-router/ts4.6/index.d.ts create mode 100644 ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts create mode 100644 ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-runtime.d.ts create mode 100644 ui/@mf-types/shell/node_modules/react-router/package.json create mode 100644 ui/src/containers/VolumePageRSP.tsx diff --git a/shell-ui/package-lock.json b/shell-ui/package-lock.json index c0d146ae09..af77b622d9 100644 --- a/shell-ui/package-lock.json +++ b/shell-ui/package-lock.json @@ -8,7 +8,7 @@ "name": "shell-ui", "version": "1.0.0", "dependencies": { - "@scality/core-ui": "git+https://github.com/scality/core-ui#33e22729ee7317f5afecb79f06b4f873dc3e376d", + "@scality/core-ui": "git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", "@scality/module-federation": "git+https://github.com/scality/module-federation#c571388783a2a51ae3bf5d36ae66753c8b014bb5", "downshift": "^8.0.0", "history": "^5.3.0", @@ -20,8 +20,8 @@ "react-error-boundary": "^4.0.2", "react-intl": "^5.15.3", "react-query": "^3.34.0", - "react-router": "^6.28.0", - "react-router-dom": "^6.28.0", + "react-router": "^7.0.1", + "react-router-dom": "^7.0.1", "styled-components": "^5.3.11", "typescript": "^5.6.3" }, @@ -4171,8 +4171,8 @@ }, "node_modules/@scality/core-ui": { "version": "0.151.0", - "resolved": "git+ssh://git@github.com/scality/core-ui.git#33e22729ee7317f5afecb79f06b4f873dc3e376d", - "integrity": "sha512-OFdbDWjVWBxnSuWYlWcyX2w8KtvTNNfb1tWABUe2wxGQwcLetbvZCaLCnpGg2+HPysrB+Uzd1ol6t4yLLdpzrg==", + "resolved": "git+ssh://git@github.com/scality/core-ui.git#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", + "integrity": "sha512-J1k8BtcEPGbzyFexYXkDdS/6sk1jBY+gN/QeljvuloMRr29OlVqTaoUtOgr6C8i0OvcanNx2OiWcWfw8za2Q7Q==", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@floating-ui/dom": "^1.6.3", @@ -4234,6 +4234,36 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "node_modules/@scality/core-ui/node_modules/react-router": { + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", + "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "dependencies": { + "@remix-run/router": "1.21.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/@scality/core-ui/node_modules/react-router-dom": { + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", + "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "dependencies": { + "@remix-run/router": "1.21.0", + "react-router": "6.28.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/@scality/module-federation": { "version": "1.3.4", "resolved": "git+ssh://git@github.com/scality/module-federation.git#c571388783a2a51ae3bf5d36ae66753c8b014bb5", @@ -14719,33 +14749,54 @@ } }, "node_modules/react-router": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", - "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.1.tgz", + "integrity": "sha512-WVAhv9oWCNsja5AkK6KLpXJDSJCQizOIyOd4vvB/+eHGbYx5vkhcmcmwWjQ9yqkRClogi+xjEg9fNEOd5EX/tw==", "dependencies": { - "@remix-run/router": "1.21.0" + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } } }, "node_modules/react-router-dom": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", - "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.1.tgz", + "integrity": "sha512-duBzwAAiIabhFPZfDjcYpJ+f08TMbPMETgq254GWne2NW1ZwRHhZLj7tpSp8KGb7JvZzlLcjGUnqLxpZQVEPng==", "dependencies": { - "@remix-run/router": "1.21.0", - "react-router": "6.28.0" + "react-router": "7.0.1" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/react-router/node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, + "node_modules/react-router/node_modules/cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", + "engines": { + "node": ">=18" } }, "node_modules/react-select": { @@ -15796,8 +15847,7 @@ "node_modules/set-cookie-parser": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", - "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==", - "dev": true + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==" }, "node_modules/set-function-length": { "version": "1.2.2", @@ -16958,6 +17008,11 @@ "node": ">=0.6.x" } }, + "node_modules/turbo-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==" + }, "node_modules/type-detect": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", diff --git a/shell-ui/package.json b/shell-ui/package.json index ca491edebd..3231754951 100644 --- a/shell-ui/package.json +++ b/shell-ui/package.json @@ -45,7 +45,7 @@ "ts-node": "^10.9.2" }, "dependencies": { - "@scality/core-ui": "git+https://github.com/scality/core-ui#33e22729ee7317f5afecb79f06b4f873dc3e376d", + "@scality/core-ui": "git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", "@scality/module-federation": "git+https://github.com/scality/module-federation#c571388783a2a51ae3bf5d36ae66753c8b014bb5", "downshift": "^8.0.0", "history": "^5.3.0", @@ -57,8 +57,8 @@ "react-error-boundary": "^4.0.2", "react-intl": "^5.15.3", "react-query": "^3.34.0", - "react-router": "^6.28.0", - "react-router-dom": "^6.28.0", + "react-router": "^7.0.1", + "react-router-dom": "^7.0.1", "styled-components": "^5.3.11", "typescript": "^5.6.3" } diff --git a/shell-ui/src/FederatedApp.tsx b/shell-ui/src/FederatedApp.tsx index c0c2931cb7..67fc6059d2 100644 --- a/shell-ui/src/FederatedApp.tsx +++ b/shell-ui/src/FederatedApp.tsx @@ -186,6 +186,7 @@ function InternalRouter() { .map(({ app, view, groups }) => ({ path: app.appHistoryBasePath + view.path, + basename: app.appHistoryBasePath, exact: view.exact, strict: view.strict, sensitive: view.sensitive, @@ -213,7 +214,7 @@ function InternalRouter() { {routes.map((route) => ( ))} diff --git a/shell-ui/src/navbar/NavBar.tsx b/shell-ui/src/navbar/NavBar.tsx index adf1ff2519..0b21d7a4a6 100644 --- a/shell-ui/src/navbar/NavBar.tsx +++ b/shell-ui/src/navbar/NavBar.tsx @@ -155,7 +155,7 @@ export const useNavbarLinksToActions = ( const location = useLocation(); const doesRouteMatch = useCallback( (path: RouteProps) => { - return matchPath(location.pathname, path.path); + return matchPath(path.path + '*', location.pathname); }, [location], ); @@ -300,6 +300,7 @@ export const Navbar = ({ const url = link.view.isFederated ? link.view.app.appHistoryBasePath + link.view.view.path : (link.view as NonFederatedView).url; + navigate(url, { replace: true }); } }, [navbarMainActions]); diff --git a/ui/@mf-types/shell/compiled-types/src/FederatedApp.d.ts b/ui/@mf-types/shell/compiled-types/src/FederatedApp.d.ts index ddcf5462a5..0c3b50b4cb 100644 --- a/ui/@mf-types/shell/compiled-types/src/FederatedApp.d.ts +++ b/ui/@mf-types/shell/compiled-types/src/FederatedApp.d.ts @@ -1,67 +1,13 @@ import React from 'react'; import { QueryClient } from 'react-query'; -import { NotificationCenterContextType } from './NotificationCenterProvider'; -import { useAuthConfig } from './auth/AuthConfigProvider'; -import { useAuth } from './auth/AuthProvider'; +import { ShellAlerts, ShellHooks } from './hooks/useShellHooks'; import './index.css'; -import { useConfigRetriever, useConfig, useDiscoveredViews, useLinkOpener, BuildtimeWebFinger, RuntimeWebFinger } from './initFederation/ConfigurationProviders'; -import { useShellConfig } from './initFederation/ShellConfigProvider'; -import { useShellThemeSelector } from './initFederation/ShellThemeSelectorProvider'; -import { useDeployedApps } from './initFederation/UIListProvider'; -import { useLanguage } from './navbar/lang'; -import AlertProvider from './alerts/AlertProvider'; -import { getAlertingAlertSelectors, getAuthenticationAlertSelectors, getBootstrapAlertSelectors, getDashboardingAlertSelectors, getIngressControllerAlertSelectors, getK8SMasterAlertSelectors, getLoggingAlertSelectors, getMonitoringAlertSelectors, getNetworksAlertSelectors, getNodesAlertSelectors, getPlatformAlertSelectors, getServicesAlertSelectors, getVolumesAlertSelectors, useAlerts, useHighestSeverityAlerts } from './alerts'; -import { useHistory } from 'react-router'; -import { UseQueryResult } from 'react-query'; export declare const queryClient: QueryClient; -export type ShellTypes = { - shellHooks: { - useAuthConfig: typeof useAuthConfig; - useAuth: typeof useAuth; - useConfigRetriever: typeof useConfigRetriever; - useDiscoveredViews: typeof useDiscoveredViews; - useShellConfig: typeof useShellConfig; - useLanguage: typeof useLanguage; - useConfig: typeof useConfig; - useLinkOpener: typeof useLinkOpener; - useDeployedApps: typeof useDeployedApps; - useShellThemeSelector: typeof useShellThemeSelector; - }; - shellAlerts: { - AlertsProvider: typeof AlertProvider; - hooks: { - useAlerts: typeof useAlerts; - useHighestSeverityAlerts: typeof useHighestSeverityAlerts; - }; - alertSelectors: { - getPlatformAlertSelectors: typeof getPlatformAlertSelectors; - getNodesAlertSelectors: typeof getNodesAlertSelectors; - getVolumesAlertSelectors: typeof getVolumesAlertSelectors; - getNetworksAlertSelectors: typeof getNetworksAlertSelectors; - getServicesAlertSelectors: typeof getServicesAlertSelectors; - getK8SMasterAlertSelectors: typeof getK8SMasterAlertSelectors; - getBootstrapAlertSelectors: typeof getBootstrapAlertSelectors; - getMonitoringAlertSelectors: typeof getMonitoringAlertSelectors; - getAlertingAlertSelectors: typeof getAlertingAlertSelectors; - getLoggingAlertSelectors: typeof getLoggingAlertSelectors; - getDashboardingAlertSelectors: typeof getDashboardingAlertSelectors; - getIngressControllerAlertSelectors: typeof getIngressControllerAlertSelectors; - getAuthenticationAlertSelectors: typeof getAuthenticationAlertSelectors; - }; - }; +export type FederatedAppProps = { + shellHooks: ShellHooks; + shellAlerts: ShellAlerts; }; -declare global { - interface Window { - shellContexts: { - ShellHistoryContext: React.Context | null>; - NotificationContext: React.Context; - WebFingersContext: React.Context>, unknown>[]>; - }; - shellHooks: ShellTypes['shellHooks']; - shellAlerts: ShellTypes['shellAlerts']; - } -} export declare function WithInitFederationProviders({ children, }: { children: React.ReactNode; -}): JSX.Element; -export default function App(): JSX.Element; +}): import("react/jsx-runtime").JSX.Element; +export default function App(): import("react/jsx-runtime").JSX.Element; diff --git a/ui/@mf-types/shell/compiled-types/src/NotificationCenterProvider.d.ts b/ui/@mf-types/shell/compiled-types/src/NotificationCenterProvider.d.ts index 1ffbc0d8d8..e85a158884 100644 --- a/ui/@mf-types/shell/compiled-types/src/NotificationCenterProvider.d.ts +++ b/ui/@mf-types/shell/compiled-types/src/NotificationCenterProvider.d.ts @@ -1,4 +1,4 @@ -import React, { Dispatch } from 'react'; +import { Dispatch, FC, ReactNode } from 'react'; export type Notification = { id: string; title: string; @@ -14,7 +14,10 @@ export type NotificationCenterContextType = { notifications: InternalNotification[]; dispatch: Dispatch; }; -export declare const NotificationCenterContext: React.Context; +export declare const NotificationCenterContext: import("react").Context; +type NotificationCenterProviderProps = { + children: ReactNode; +}; export declare enum NotificationActionType { PUBLISH = 0, UNPUBLISH = 1, @@ -29,7 +32,5 @@ export type NotificationCenterActions = { } | { type: NotificationActionType.READ_ALL; }; -declare const NotificationCenterProvider: ({ children }: { - children: any; -}) => JSX.Element; +declare const NotificationCenterProvider: FC; export default NotificationCenterProvider; diff --git a/ui/@mf-types/shell/compiled-types/src/alerts/alertHooks.d.ts b/ui/@mf-types/shell/compiled-types/src/alerts/alertHooks.d.ts index 64f13b1b0f..927c5621a9 100644 --- a/ui/@mf-types/shell/compiled-types/src/alerts/alertHooks.d.ts +++ b/ui/@mf-types/shell/compiled-types/src/alerts/alertHooks.d.ts @@ -23,4 +23,4 @@ export declare const useHighestSeverityAlerts: (filters: FilterLabels) => Alert[ * * @returns react query result */ -export declare function useAlerts(filters: FilterLabels): any; +export declare function useAlerts(filters?: FilterLabels): any; diff --git a/ui/@mf-types/shell/compiled-types/src/hooks/useShellHooks.d.ts b/ui/@mf-types/shell/compiled-types/src/hooks/useShellHooks.d.ts new file mode 100644 index 0000000000..15ea2b8a49 --- /dev/null +++ b/ui/@mf-types/shell/compiled-types/src/hooks/useShellHooks.d.ts @@ -0,0 +1,45 @@ +import { useAlerts, getPlatformAlertSelectors, getNodesAlertSelectors, getVolumesAlertSelectors, getNetworksAlertSelectors, getServicesAlertSelectors, getK8SMasterAlertSelectors, getBootstrapAlertSelectors, getMonitoringAlertSelectors, getAlertingAlertSelectors, getLoggingAlertSelectors, getDashboardingAlertSelectors, getIngressControllerAlertSelectors, getAuthenticationAlertSelectors, useHighestSeverityAlerts } from '../alerts'; +import AlertProvider from '../alerts/AlertProvider'; +import { useAuthConfig } from '../auth/AuthConfigProvider'; +import { useAuth } from '../auth/AuthProvider'; +import { useConfig, useConfigRetriever, useDiscoveredViews, useLinkOpener } from '../initFederation/ConfigurationProviders'; +import { useShellConfig } from '../initFederation/ShellConfigProvider'; +import { useShellThemeSelector } from '../initFederation/ShellThemeSelectorProvider'; +import { useDeployedApps } from '../initFederation/UIListProvider'; +import { useLanguage } from '../navbar/lang'; +export type ShellHooks = { + useAuthConfig: typeof useAuthConfig; + useAuth: typeof useAuth; + useConfigRetriever: typeof useConfigRetriever; + useDiscoveredViews: typeof useDiscoveredViews; + useShellConfig: typeof useShellConfig; + useLanguage: typeof useLanguage; + useConfig: typeof useConfig; + useLinkOpener: typeof useLinkOpener; + useDeployedApps: typeof useDeployedApps; + useShellThemeSelector: typeof useShellThemeSelector; +}; +export type ShellAlerts = { + AlertsProvider: typeof AlertProvider; + alertHooks: { + useAlerts: typeof useAlerts; + useHighestSeverityAlerts: typeof useHighestSeverityAlerts; + }; + alertSelectors: { + getPlatformAlertSelectors: typeof getPlatformAlertSelectors; + getNodesAlertSelectors: typeof getNodesAlertSelectors; + getVolumesAlertSelectors: typeof getVolumesAlertSelectors; + getNetworksAlertSelectors: typeof getNetworksAlertSelectors; + getServicesAlertSelectors: typeof getServicesAlertSelectors; + getK8SMasterAlertSelectors: typeof getK8SMasterAlertSelectors; + getBootstrapAlertSelectors: typeof getBootstrapAlertSelectors; + getMonitoringAlertSelectors: typeof getMonitoringAlertSelectors; + getAlertingAlertSelectors: typeof getAlertingAlertSelectors; + getLoggingAlertSelectors: typeof getLoggingAlertSelectors; + getDashboardingAlertSelectors: typeof getDashboardingAlertSelectors; + getIngressControllerAlertSelectors: typeof getIngressControllerAlertSelectors; + getAuthenticationAlertSelectors: typeof getAuthenticationAlertSelectors; + }; +}; +export declare const shellHooks: ShellHooks; +export declare const shellAlerts: ShellAlerts; diff --git a/ui/@mf-types/shell/node_modules/@scality/core-ui/package.json b/ui/@mf-types/shell/node_modules/@scality/core-ui/package.json index 64b897d83f..a868848960 100644 --- a/ui/@mf-types/shell/node_modules/@scality/core-ui/package.json +++ b/ui/@mf-types/shell/node_modules/@scality/core-ui/package.json @@ -49,12 +49,12 @@ "@storybook/storybook-deployer": "^2.8.16", "@storybook/theming": "^8.3.6", "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^11.2.7", + "@testing-library/react": "^15.0.7", "@testing-library/react-hooks": "^8.0.1", "@testing-library/user-event": "^13.5.0", "@types/jest": "^27.5.0", - "@types/react": "^17.0.39", - "@types/react-dom": "^17.0.11", + "@types/react": "^18.3.12", + "@types/react-dom": "^18.3.1", "@types/react-router": "^5.1.20", "@types/react-router-dom": "^5.3.3", "@types/react-table": "^7.7.11", @@ -109,16 +109,17 @@ "framer-motion": "^4.1.17", "polished": "3.4.1", "pretty-bytes": "^5.6.0", - "react": "^17.0.2", + "react": "^18.3.1", "react-debounce-input": "3.2.2", - "react-dom": "^17.0.2", + "react-dom": "^18.3.1", "react-dropzone": "^14.2.3", "react-hook-form": "^7.49.2", "react-query": "^3.34.0", - "react-router": "5.2.0", - "react-router-dom": "5.2.0", + "react-router": "^6.28.0", + "react-router-dom": "^6.28.0", "react-select": "4.3.1", "react-table": "^7.7.0", + "react-test-renderer": "^18.3.1", "react-virtualized": "9.22.3", "react-virtualized-auto-sizer": "^1.0.24", "react-window": "^1.8.6", diff --git a/ui/@mf-types/shell/node_modules/@types/history/DOMUtils.d.ts b/ui/@mf-types/shell/node_modules/@types/history/DOMUtils.d.ts deleted file mode 100644 index 2b0a597cea..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/DOMUtils.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -declare global { - // Some users of this package are don't use "dom" libs - interface EventTarget {} - interface EventListener {} - interface EventListenerObject {} -} - -export const isExtraneousPopstateEvent: boolean; -export function addEventListener(node: EventTarget, event: string, listener: EventListener | EventListenerObject): void; -export function removeEventListener( - node: EventTarget, - event: string, - listener: EventListener | EventListenerObject, -): void; -export function getConfirmation(message: string, callback: (result: boolean) => void): void; -export function supportsHistory(): boolean; -export function supportsGoWithoutReloadUsingHash(): boolean; diff --git a/ui/@mf-types/shell/node_modules/@types/history/ExecutionEnvironment.d.ts b/ui/@mf-types/shell/node_modules/@types/history/ExecutionEnvironment.d.ts deleted file mode 100644 index ac15888726..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/ExecutionEnvironment.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const canUseDOM: boolean; diff --git a/ui/@mf-types/shell/node_modules/@types/history/LocationUtils.d.ts b/ui/@mf-types/shell/node_modules/@types/history/LocationUtils.d.ts deleted file mode 100644 index 26e9324b62..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/LocationUtils.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Path, LocationState, LocationKey, Location, LocationDescriptor } from './index'; - -export function locationsAreEqual(lv: LocationDescriptor, rv: LocationDescriptor): boolean; -export function createLocation( - path: LocationDescriptor, - state?: S, - key?: LocationKey, - currentLocation?: Location, -): Location; diff --git a/ui/@mf-types/shell/node_modules/@types/history/PathUtils.d.ts b/ui/@mf-types/shell/node_modules/@types/history/PathUtils.d.ts deleted file mode 100644 index 18952a2b3e..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/PathUtils.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Path, Location, LocationDescriptorObject } from './index'; - -export function addLeadingSlash(path: Path): Path; -export function stripLeadingSlash(path: Path): Path; -export function hasBasename(path: Path): boolean; -export function stripBasename(path: Path, prefix: string): Path; -export function stripTrailingSlash(path: Path): Path; -export function parsePath(path: Path): Location; -export function createPath(location: LocationDescriptorObject): Path; diff --git a/ui/@mf-types/shell/node_modules/@types/history/createBrowserHistory.d.ts b/ui/@mf-types/shell/node_modules/@types/history/createBrowserHistory.d.ts deleted file mode 100644 index 09910bd8cd..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/createBrowserHistory.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { History, LocationState } from './index'; -import { getConfirmation } from './DOMUtils'; - -export interface BrowserHistoryBuildOptions { - basename?: string | undefined; - forceRefresh?: boolean | undefined; - getUserConfirmation?: typeof getConfirmation | undefined; - keyLength?: number | undefined; -} - -export default function createBrowserHistory(options?: BrowserHistoryBuildOptions): History; diff --git a/ui/@mf-types/shell/node_modules/@types/history/createHashHistory.d.ts b/ui/@mf-types/shell/node_modules/@types/history/createHashHistory.d.ts deleted file mode 100644 index 4351a48450..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/createHashHistory.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { History, LocationState } from './index'; -import { getConfirmation } from './DOMUtils'; - -export type HashType = 'hashbang' | 'noslash' | 'slash'; - -export interface HashHistoryBuildOptions { - basename?: string | undefined; - hashType?: HashType | undefined; - getUserConfirmation?: typeof getConfirmation | undefined; -} - -export default function createHashHistory(options?: HashHistoryBuildOptions): History; diff --git a/ui/@mf-types/shell/node_modules/@types/history/createMemoryHistory.d.ts b/ui/@mf-types/shell/node_modules/@types/history/createMemoryHistory.d.ts deleted file mode 100644 index fea27d940d..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/createMemoryHistory.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { History, Location, LocationState } from './index'; -import { getConfirmation } from './DOMUtils'; - -export type InitialEntry = string | Partial; - -export interface MemoryHistoryBuildOptions { - getUserConfirmation?: typeof getConfirmation | undefined; - initialEntries?: InitialEntry[] | undefined; - initialIndex?: number | undefined; - keyLength?: number | undefined; -} - -export interface MemoryHistory extends History { - index: number; - entries: Location[]; - canGo(n: number): boolean; -} - -export default function createMemoryHistory(options?: MemoryHistoryBuildOptions): MemoryHistory; diff --git a/ui/@mf-types/shell/node_modules/@types/history/createTransitionManager.d.ts b/ui/@mf-types/shell/node_modules/@types/history/createTransitionManager.d.ts deleted file mode 100644 index 135ee54f0e..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/createTransitionManager.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Location, Action, LocationListener, LocationState, UnregisterCallback } from './index'; -import { getConfirmation } from './DOMUtils'; - -export type PromptFunction = (location: Location, action: Action) => any; - -export type Prompt = PromptFunction | boolean; - -export interface TransitionManager { - setPrompt(nextPrompt?: Prompt): UnregisterCallback; - appendListener(listener: LocationListener): UnregisterCallback; - notifyListeners(location: Location, action: Action): void; - confirmTransitionTo( - location: Location, - action: Action, - getUserConfirmation: typeof getConfirmation, - callback: (result: boolean) => void, - ): void; -} - -export default function createTransitionManager(): TransitionManager; diff --git a/ui/@mf-types/shell/node_modules/@types/history/index.d.ts b/ui/@mf-types/shell/node_modules/@types/history/index.d.ts deleted file mode 100644 index c7fb53ec91..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/index.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -// Type definitions for history 4.7.2 -// Project: https://github.com/mjackson/history -// Definitions by: Sergey Buturlakin , Nathan Brown , Young Rok Kim , Daniel Nixon -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 -export as namespace History; - -export type Action = 'PUSH' | 'POP' | 'REPLACE'; -export type UnregisterCallback = () => void; - -export interface History { - length: number; - action: Action; - location: Location; - push(location: Path | LocationDescriptor, state?: HistoryLocationState): void; - replace(location: Path | LocationDescriptor, state?: HistoryLocationState): void; - go(n: number): void; - goBack(): void; - goForward(): void; - block(prompt?: boolean | string | TransitionPromptHook): UnregisterCallback; - listen(listener: LocationListener): UnregisterCallback; - createHref(location: LocationDescriptorObject): Href; -} - -export interface Location { - pathname: Pathname; - search: Search; - state: S; - hash: Hash; - key?: LocationKey | undefined; -} - -export interface LocationDescriptorObject { - pathname?: Pathname | undefined; - search?: Search | undefined; - state?: S | undefined; - hash?: Hash | undefined; - key?: LocationKey | undefined; -} - -export namespace History { - export type LocationDescriptor = Path | LocationDescriptorObject; - export type LocationKey = string; - export type LocationListener = (location: Location, action: Action) => void; - - export type LocationState = unknown; - export type Path = string; - export type Pathname = string; - export type Search = string; - export type TransitionHook = (location: Location, callback: (result: any) => void) => any; - export type TransitionPromptHook = ( - location: Location, - action: Action, - ) => string | false | void; - export type Hash = string; - export type Href = string; -} - -export type LocationDescriptor = History.LocationDescriptor; -export type LocationKey = History.LocationKey; -export type LocationListener = History.LocationListener; -export type LocationState = History.LocationState; -export type Path = History.Path; -export type Pathname = History.Pathname; -export type Search = History.Search; -export type TransitionHook = History.TransitionHook; -export type TransitionPromptHook = History.TransitionPromptHook; -export type Hash = History.Hash; -export type Href = History.Href; - -import { default as createBrowserHistory } from './createBrowserHistory'; -import { default as createHashHistory } from './createHashHistory'; -import { default as createMemoryHistory } from './createMemoryHistory'; -import { createLocation, locationsAreEqual } from './LocationUtils'; -import { parsePath, createPath } from './PathUtils'; - -// Global usage, without modules, needs the small trick, because lib.d.ts -// already has `history` and `History` global definitions: -// var createHistory = ((window as any).History as HistoryModule.Module).createHistory; -export interface Module { - createBrowserHistory: typeof createBrowserHistory; - createHashHistory: typeof createHashHistory; - createMemoryHistory: typeof createMemoryHistory; - createLocation: typeof createLocation; - locationsAreEqual: typeof locationsAreEqual; - parsePath: typeof parsePath; - createPath: typeof createPath; -} - -export * from './createBrowserHistory'; -export * from './createHashHistory'; -export * from './createMemoryHistory'; -export { createLocation, locationsAreEqual } from './LocationUtils'; -export { parsePath, createPath } from './PathUtils'; -export { createBrowserHistory, createHashHistory, createMemoryHistory }; diff --git a/ui/@mf-types/shell/node_modules/@types/history/package.json b/ui/@mf-types/shell/node_modules/@types/history/package.json deleted file mode 100644 index bfa4663363..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/history/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@types/history", - "version": "4.7.11", - "description": "TypeScript definitions for history", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history", - "license": "MIT", - "contributors": [ - { - "name": "Sergey Buturlakin", - "url": "https://github.com/sergey-buturlakin", - "githubUsername": "sergey-buturlakin" - }, - { - "name": "Nathan Brown", - "url": "https://github.com/ngbrown", - "githubUsername": "ngbrown" - }, - { - "name": "Young Rok Kim", - "url": "https://github.com/rokoroku", - "githubUsername": "rokoroku" - }, - { - "name": "Daniel Nixon", - "url": "https://github.com/danielnixon", - "githubUsername": "danielnixon" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/history" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "141516ba36ab9f2b221dc957cba4ac21d9a06776c05786e6773c5581f8cf7455", - "typeScriptVersion": "3.8" -} \ No newline at end of file diff --git a/ui/@mf-types/shell/node_modules/@types/react-router/index.d.ts b/ui/@mf-types/shell/node_modules/@types/react-router/index.d.ts deleted file mode 100644 index a19c916f1d..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/react-router/index.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -// Type definitions for React Router 5.1 -// Project: https://github.com/ReactTraining/react-router -// Definitions by: Sergey Buturlakin -// Yuichi Murata -// Václav Ostrožlík -// Nathan Brown -// Alex Wendland -// Kostya Esmukov -// John Reilly -// Karol Janyst -// Dovydas Navickas -// Huy Nguyen -// Jérémy Fauvel -// Daniel Roth -// Egor Shulga -// Rahul Raina -// Duong Tran -// Ben Smith -// Wesley Tsai -// Sebastian Silbermann -// Nicholas Hehr -// Pawel Fajfer -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 - -import * as React from 'react'; -import * as H from 'history'; - -// This is the type of the context object that will be passed down to all children of -// a `Router` component: -export interface RouterChildContext { - router: { - history: H.History; - route: { - location: H.Location; - match: match; - }; - }; -} -export interface MemoryRouterProps { - children?: React.ReactNode; - initialEntries?: H.LocationDescriptor[] | undefined; - initialIndex?: number | undefined; - getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined; - keyLength?: number | undefined; -} - -export class MemoryRouter extends React.Component {} - -export interface PromptProps { - message: string | ((location: H.Location, action: H.Action) => string | boolean); - when?: boolean | undefined; -} -export class Prompt extends React.Component {} - -export interface RedirectProps { - to: H.LocationDescriptor; - push?: boolean | undefined; - from?: string | undefined; - path?: string | undefined; - exact?: boolean | undefined; - strict?: boolean | undefined; -} -export class Redirect extends React.Component {} - -export interface StaticContext { - statusCode?: number | undefined; -} - -export interface RouteComponentProps< - Params extends { [K in keyof Params]?: string } = {}, - C extends StaticContext = StaticContext, - S = H.LocationState, -> { - history: H.History; - location: H.Location; - match: match; - staticContext?: C | undefined; -} - -export interface RouteChildrenProps { - history: H.History; - location: H.Location; - match: match | null; -} - -export interface RouteProps< - Path extends string = string, - Params extends { [K: string]: string | undefined } = ExtractRouteParams, -> { - location?: H.Location | undefined; - component?: React.ComponentType> | React.ComponentType | undefined; - render?: ((props: RouteComponentProps) => React.ReactNode) | undefined; - children?: ((props: RouteChildrenProps) => React.ReactNode) | React.ReactNode | undefined; - path?: Path | readonly Path[] | undefined; - exact?: boolean | undefined; - sensitive?: boolean | undefined; - strict?: boolean | undefined; -} -export class Route extends React.Component< - RouteProps & OmitNative, - any -> {} - -export interface RouterProps { - children?: React.ReactNode; - history: H.History; -} -export class Router extends React.Component {} - -export interface StaticRouterContext extends StaticContext { - url?: string | undefined; - action?: 'PUSH' | 'REPLACE' | undefined; - location?: object | undefined; -} -export interface StaticRouterProps { - basename?: string | undefined; - children?: React.ReactNode; - location?: string | object | undefined; - context?: StaticRouterContext | undefined; -} - -export class StaticRouter extends React.Component {} -export interface SwitchProps { - children?: React.ReactNode | undefined; - location?: H.Location | undefined; -} -export class Switch extends React.Component {} - -export interface match { - params: Params; - isExact: boolean; - path: string; - url: string; -} - -// Omit taken from https://github.com/Microsoft/TypeScript/issues/28339#issuecomment-467220238 -export type Omit = T extends any ? Pick> : never; - -// Newer Omit type: as the previous one is being exported, removing it would be a breaking change -export type OmitNative = { [P in Exclude]: T[P] }; - -export function matchPath( - pathname: string, - props: string | string[] | RouteProps, - parent?: match | null, -): match | null; - -export type ExtractRouteOptionalParam = T extends `${infer Param}?` - ? { [k in Param]?: U } - : T extends `${infer Param}*` - ? { [k in Param]?: U } - : T extends `${infer Param}+` - ? { [k in Param]: U } - : { [k in T]: U }; - -export type ExtractRouteParams = string extends T - ? { [k in string]?: U } - : T extends `${infer _Start}:${infer ParamWithOptionalRegExp}/${infer Rest}` - ? ParamWithOptionalRegExp extends `${infer Param}(${infer _RegExp})${infer Modifier extends '?' | '+' | '*' | ''}` - ? ExtractRouteOptionalParam<`${Param}${Modifier}`, U> & ExtractRouteParams - : ExtractRouteOptionalParam & ExtractRouteParams - : T extends `${infer _Start}:${infer ParamWithOptionalRegExp}` - ? ParamWithOptionalRegExp extends `${infer Param}(${infer _RegExp})${infer Modifier extends '?' | '+' | '*' | ''}` - ? ExtractRouteOptionalParam<`${Param}${Modifier}`, U> - : ExtractRouteOptionalParam - : {}; - -export function generatePath(path: S, params?: ExtractRouteParams): string; - -export type WithRouterProps> = C extends React.ComponentClass - ? { wrappedComponentRef?: React.Ref> | undefined } - : {}; - -export interface WithRouterStatics> { - WrappedComponent: C; -} - -// There is a known issue in TypeScript, which doesn't allow decorators to change the signature of the classes -// they are decorating. Due to this, if you are using @withRouter decorator in your code, -// you will see a bunch of errors from TypeScript. The current workaround is to use withRouter() as a function call -// on a separate line instead of as a decorator. -export function withRouter

, C extends React.ComponentType

>( - component: C & React.ComponentType

, -): React.ComponentClass> & WithRouterProps> & WithRouterStatics; - -export const __RouterContext: React.Context; - -export function useHistory(): H.History; - -export function useLocation(): H.Location; - -export function useParams(): Params; - -export function useRouteMatch(): match; -export function useRouteMatch( - path: string | string[] | RouteProps, -): match | null; diff --git a/ui/@mf-types/shell/node_modules/@types/react-router/package.json b/ui/@mf-types/shell/node_modules/@types/react-router/package.json deleted file mode 100644 index 62529f517a..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/react-router/package.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "name": "@types/react-router", - "version": "5.1.20", - "description": "TypeScript definitions for React Router", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router", - "license": "MIT", - "contributors": [ - { - "name": "Sergey Buturlakin", - "url": "https://github.com/sergey-buturlakin", - "githubUsername": "sergey-buturlakin" - }, - { - "name": "Yuichi Murata", - "url": "https://github.com/mrk21", - "githubUsername": "mrk21" - }, - { - "name": "Václav Ostrožlík", - "url": "https://github.com/vasek17", - "githubUsername": "vasek17" - }, - { - "name": "Nathan Brown", - "url": "https://github.com/ngbrown", - "githubUsername": "ngbrown" - }, - { - "name": "Alex Wendland", - "url": "https://github.com/awendland", - "githubUsername": "awendland" - }, - { - "name": "Kostya Esmukov", - "url": "https://github.com/KostyaEsmukov", - "githubUsername": "KostyaEsmukov" - }, - { - "name": "John Reilly", - "url": "https://github.com/johnnyreilly", - "githubUsername": "johnnyreilly" - }, - { - "name": "Karol Janyst", - "url": "https://github.com/LKay", - "githubUsername": "LKay" - }, - { - "name": "Dovydas Navickas", - "url": "https://github.com/DovydasNavickas", - "githubUsername": "DovydasNavickas" - }, - { - "name": "Huy Nguyen", - "url": "https://github.com/huy-nguyen", - "githubUsername": "huy-nguyen" - }, - { - "name": "Jérémy Fauvel", - "url": "https://github.com/grmiade", - "githubUsername": "grmiade" - }, - { - "name": "Daniel Roth", - "url": "https://github.com/DaIgeb", - "githubUsername": "DaIgeb" - }, - { - "name": "Egor Shulga", - "url": "https://github.com/egorshulga", - "githubUsername": "egorshulga" - }, - { - "name": "Rahul Raina", - "url": "https://github.com/rraina", - "githubUsername": "rraina" - }, - { - "name": "Duong Tran", - "url": "https://github.com/t49tran", - "githubUsername": "t49tran" - }, - { - "name": "Ben Smith", - "url": "https://github.com/8enSmith", - "githubUsername": "8enSmith" - }, - { - "name": "Wesley Tsai", - "url": "https://github.com/wezleytsai", - "githubUsername": "wezleytsai" - }, - { - "name": "Sebastian Silbermann", - "url": "https://github.com/eps1lon", - "githubUsername": "eps1lon" - }, - { - "name": "Nicholas Hehr", - "url": "https://github.com/HipsterBrown", - "githubUsername": "HipsterBrown" - }, - { - "name": "Pawel Fajfer", - "url": "https://github.com/pawfa", - "githubUsername": "pawfa" - } - ], - "main": "", - "types": "index.d.ts", - "typesVersions": { - "<=4.6": { - "*": [ - "ts4.6/*" - ] - } - }, - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/react-router" - }, - "scripts": {}, - "dependencies": { - "@types/history": "^4.7.11", - "@types/react": "*" - }, - "typesPublisherContentHash": "471509be13705fc944e92092c64b94ac19712efd46cd3b0bfe38faefb539955f", - "typeScriptVersion": "4.2" -} \ No newline at end of file diff --git a/ui/@mf-types/shell/node_modules/@types/react-router/ts4.6/index.d.ts b/ui/@mf-types/shell/node_modules/@types/react-router/ts4.6/index.d.ts deleted file mode 100644 index 88c2bfe1f6..0000000000 --- a/ui/@mf-types/shell/node_modules/@types/react-router/ts4.6/index.d.ts +++ /dev/null @@ -1,173 +0,0 @@ -import * as React from 'react'; -import * as H from 'history'; - -// This is the type of the context object that will be passed down to all children of -// a `Router` component: -export interface RouterChildContext { - router: { - history: H.History; - route: { - location: H.Location; - match: match; - }; - }; -} -export interface MemoryRouterProps { - children?: React.ReactNode; - initialEntries?: H.LocationDescriptor[] | undefined; - initialIndex?: number | undefined; - getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined; - keyLength?: number | undefined; -} - -export class MemoryRouter extends React.Component {} - -export interface PromptProps { - message: string | ((location: H.Location, action: H.Action) => string | boolean); - when?: boolean | undefined; -} -export class Prompt extends React.Component {} - -export interface RedirectProps { - to: H.LocationDescriptor; - push?: boolean | undefined; - from?: string | undefined; - path?: string | undefined; - exact?: boolean | undefined; - strict?: boolean | undefined; -} -export class Redirect extends React.Component {} - -export interface StaticContext { - statusCode?: number | undefined; -} - -export interface RouteComponentProps< - Params extends { [K in keyof Params]?: string } = {}, - C extends StaticContext = StaticContext, - S = H.LocationState, -> { - history: H.History; - location: H.Location; - match: match; - staticContext?: C | undefined; -} - -export interface RouteChildrenProps { - history: H.History; - location: H.Location; - match: match | null; -} - -export interface RouteProps< - Path extends string = string, - Params extends { [K: string]: string | undefined } = ExtractRouteParams, -> { - location?: H.Location | undefined; - component?: React.ComponentType> | React.ComponentType | undefined; - render?: ((props: RouteComponentProps) => React.ReactNode) | undefined; - children?: ((props: RouteChildrenProps) => React.ReactNode) | React.ReactNode | undefined; - path?: Path | readonly Path[] | undefined; - exact?: boolean | undefined; - sensitive?: boolean | undefined; - strict?: boolean | undefined; -} -export class Route extends React.Component< - RouteProps & OmitNative, - any -> {} - -export interface RouterProps { - children?: React.ReactNode; - history: H.History; -} -export class Router extends React.Component {} - -export interface StaticRouterContext extends StaticContext { - url?: string | undefined; - action?: 'PUSH' | 'REPLACE' | undefined; - location?: object | undefined; -} -export interface StaticRouterProps { - basename?: string | undefined; - children?: React.ReactNode; - location?: string | object | undefined; - context?: StaticRouterContext | undefined; -} - -export class StaticRouter extends React.Component {} -export interface SwitchProps { - children?: React.ReactNode | undefined; - location?: H.Location | undefined; -} -export class Switch extends React.Component {} - -export interface match { - params: Params; - isExact: boolean; - path: string; - url: string; -} - -// Omit taken from https://github.com/Microsoft/TypeScript/issues/28339#issuecomment-467220238 -export type Omit = T extends any ? Pick> : never; - -// Newer Omit type: as the previous one is being exported, removing it would be a breaking change -export type OmitNative = { [P in Exclude]: T[P] }; - -export function matchPath( - pathname: string, - props: string | string[] | RouteProps, - parent?: match | null, -): match | null; - -export type ExtractRouteOptionalParam = T extends `${infer Param}?` - ? { [k in Param]?: U } - : T extends `${infer Param}*` - ? { [k in Param]?: U } - : T extends `${infer Param}+` - ? { [k in Param]: U } - : { [k in T]: U }; - -export type ExtractRouteParams = string extends T - ? { [k in string]?: U } - : T extends `${infer _Start}:${infer ParamWithOptionalRegExp}/${infer Rest}` - ? ParamWithOptionalRegExp extends `${infer Param}(${infer _RegExp})` - ? ExtractRouteOptionalParam & ExtractRouteParams - : ExtractRouteOptionalParam & ExtractRouteParams - : T extends `${infer _Start}:${infer ParamWithOptionalRegExp}` - ? ParamWithOptionalRegExp extends `${infer Param}(${infer _RegExp})` - ? ExtractRouteOptionalParam - : ExtractRouteOptionalParam - : {}; - -export function generatePath(path: S, params?: ExtractRouteParams): string; - -export type WithRouterProps> = C extends React.ComponentClass - ? { wrappedComponentRef?: React.Ref> | undefined } - : {}; - -export interface WithRouterStatics> { - WrappedComponent: C; -} - -// There is a known issue in TypeScript, which doesn't allow decorators to change the signature of the classes -// they are decorating. Due to this, if you are using @withRouter decorator in your code, -// you will see a bunch of errors from TypeScript. The current workaround is to use withRouter() as a function call -// on a separate line instead of as a decorator. -export function withRouter

, C extends React.ComponentType

>( - component: C & React.ComponentType

, -): React.ComponentClass> & WithRouterProps> & WithRouterStatics; - -export const __RouterContext: React.Context; - -export function useHistory(): H.History; - -export function useLocation(): H.Location; - -export function useParams(): Params; - -export function useRouteMatch(): match; -export function useRouteMatch( - path: string | string[] | RouteProps, -): match | null; diff --git a/ui/@mf-types/shell/node_modules/@types/react/jsx-dev-runtime.d.ts b/ui/@mf-types/shell/node_modules/@types/react/jsx-dev-runtime.d.ts index c7bb3e9050..d28644c6ce 100644 --- a/ui/@mf-types/shell/node_modules/@types/react/jsx-dev-runtime.d.ts +++ b/ui/@mf-types/shell/node_modules/@types/react/jsx-dev-runtime.d.ts @@ -1,2 +1,45 @@ -// Expose `JSX` namespace in `global` namespace -import './'; +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + type ElementType = React.JSX.ElementType; + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +export interface JSXSource { + /** + * The source file where the element originates from. + */ + fileName?: string | undefined; + + /** + * The line number where the element was created. + */ + lineNumber?: number | undefined; + + /** + * The column number where the element was created. + */ + columnNumber?: number | undefined; +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxDEV( + type: React.ElementType, + props: unknown, + key: React.Key | undefined, + isStatic: boolean, + source?: JSXSource, + self?: unknown, +): React.ReactElement; diff --git a/ui/@mf-types/shell/node_modules/@types/react/jsx-runtime.d.ts b/ui/@mf-types/shell/node_modules/@types/react/jsx-runtime.d.ts index c7bb3e9050..e9fea27d74 100644 --- a/ui/@mf-types/shell/node_modules/@types/react/jsx-runtime.d.ts +++ b/ui/@mf-types/shell/node_modules/@types/react/jsx-runtime.d.ts @@ -1,2 +1,36 @@ -// Expose `JSX` namespace in `global` namespace -import './'; +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + type ElementType = React.JSX.ElementType; + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsx( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxs( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; diff --git a/ui/@mf-types/shell/node_modules/@types/react/package.json b/ui/@mf-types/shell/node_modules/@types/react/package.json index 0c96325bb0..b7b8c61dac 100644 --- a/ui/@mf-types/shell/node_modules/@types/react/package.json +++ b/ui/@mf-types/shell/node_modules/@types/react/package.json @@ -1,7 +1,8 @@ { "name": "@types/react", - "version": "17.0.2", - "description": "TypeScript definitions for React", + "version": "18.3.12", + "description": "TypeScript definitions for react", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react", "license": "MIT", "contributors": [ { @@ -18,122 +19,177 @@ }, { "name": "John Reilly", - "url": "https://github.com/johnnyreilly", - "githubUsername": "johnnyreilly" + "githubUsername": "johnnyreilly", + "url": "https://github.com/johnnyreilly" }, { "name": "Benoit Benezech", - "url": "https://github.com/bbenezech", - "githubUsername": "bbenezech" + "githubUsername": "bbenezech", + "url": "https://github.com/bbenezech" }, { "name": "Patricio Zavolinsky", - "url": "https://github.com/pzavolinsky", - "githubUsername": "pzavolinsky" - }, - { - "name": "Digiguru", - "url": "https://github.com/digiguru", - "githubUsername": "digiguru" + "githubUsername": "pzavolinsky", + "url": "https://github.com/pzavolinsky" }, { "name": "Eric Anderson", - "url": "https://github.com/ericanderson", - "githubUsername": "ericanderson" + "githubUsername": "ericanderson", + "url": "https://github.com/ericanderson" }, { "name": "Dovydas Navickas", - "url": "https://github.com/DovydasNavickas", - "githubUsername": "DovydasNavickas" + "githubUsername": "DovydasNavickas", + "url": "https://github.com/DovydasNavickas" }, { "name": "Josh Rutherford", - "url": "https://github.com/theruther4d", - "githubUsername": "theruther4d" + "githubUsername": "theruther4d", + "url": "https://github.com/theruther4d" }, { "name": "Guilherme Hübner", - "url": "https://github.com/guilhermehubner", - "githubUsername": "guilhermehubner" + "githubUsername": "guilhermehubner", + "url": "https://github.com/guilhermehubner" }, { "name": "Ferdy Budhidharma", - "url": "https://github.com/ferdaber", - "githubUsername": "ferdaber" + "githubUsername": "ferdaber", + "url": "https://github.com/ferdaber" }, { "name": "Johann Rakotoharisoa", - "url": "https://github.com/jrakotoharisoa", - "githubUsername": "jrakotoharisoa" + "githubUsername": "jrakotoharisoa", + "url": "https://github.com/jrakotoharisoa" }, { "name": "Olivier Pascal", - "url": "https://github.com/pascaloliv", - "githubUsername": "pascaloliv" + "githubUsername": "pascaloliv", + "url": "https://github.com/pascaloliv" }, { "name": "Martin Hochel", - "url": "https://github.com/hotell", - "githubUsername": "hotell" + "githubUsername": "hotell", + "url": "https://github.com/hotell" }, { "name": "Frank Li", - "url": "https://github.com/franklixuefei", - "githubUsername": "franklixuefei" + "githubUsername": "franklixuefei", + "url": "https://github.com/franklixuefei" }, { "name": "Jessica Franco", - "url": "https://github.com/Jessidhia", - "githubUsername": "Jessidhia" + "githubUsername": "Jessidhia", + "url": "https://github.com/Jessidhia" }, { "name": "Saransh Kataria", - "url": "https://github.com/saranshkataria", - "githubUsername": "saranshkataria" + "githubUsername": "saranshkataria", + "url": "https://github.com/saranshkataria" }, { "name": "Kanitkorn Sujautra", - "url": "https://github.com/lukyth", - "githubUsername": "lukyth" + "githubUsername": "lukyth", + "url": "https://github.com/lukyth" }, { "name": "Sebastian Silbermann", - "url": "https://github.com/eps1lon", - "githubUsername": "eps1lon" + "githubUsername": "eps1lon", + "url": "https://github.com/eps1lon" }, { "name": "Kyle Scully", - "url": "https://github.com/zieka", - "githubUsername": "zieka" + "githubUsername": "zieka", + "url": "https://github.com/zieka" }, { "name": "Cong Zhang", - "url": "https://github.com/dancerphil", - "githubUsername": "dancerphil" + "githubUsername": "dancerphil", + "url": "https://github.com/dancerphil" }, { "name": "Dimitri Mitropoulos", - "url": "https://github.com/dimitropoulos", - "githubUsername": "dimitropoulos" + "githubUsername": "dimitropoulos", + "url": "https://github.com/dimitropoulos" }, { "name": "JongChan Choi", - "url": "https://github.com/disjukr", - "githubUsername": "disjukr" + "githubUsername": "disjukr", + "url": "https://github.com/disjukr" }, { "name": "Victor Magalhães", - "url": "https://github.com/vhfmag", - "githubUsername": "vhfmag" + "githubUsername": "vhfmag", + "url": "https://github.com/vhfmag" }, { - "name": "Dale Tan", - "url": "https://github.com/hellatan", - "githubUsername": "hellatan" + "name": "Priyanshu Rav", + "githubUsername": "priyanshurav", + "url": "https://github.com/priyanshurav" + }, + { + "name": "Dmitry Semigradsky", + "githubUsername": "Semigradsky", + "url": "https://github.com/Semigradsky" + }, + { + "name": "Matt Pocock", + "githubUsername": "mattpocock", + "url": "https://github.com/mattpocock" } ], "main": "", "types": "index.d.ts", + "typesVersions": { + "<=5.0": { + "*": [ + "ts5.0/*" + ] + } + }, + "exports": { + ".": { + "types@<=5.0": { + "default": "./ts5.0/index.d.ts" + }, + "types": { + "default": "./index.d.ts" + } + }, + "./canary": { + "types@<=5.0": { + "default": "./ts5.0/canary.d.ts" + }, + "types": { + "default": "./canary.d.ts" + } + }, + "./experimental": { + "types@<=5.0": { + "default": "./ts5.0/experimental.d.ts" + }, + "types": { + "default": "./experimental.d.ts" + } + }, + "./jsx-runtime": { + "types@<=5.0": { + "default": "./ts5.0/jsx-runtime.d.ts" + }, + "types": { + "default": "./jsx-runtime.d.ts" + } + }, + "./jsx-dev-runtime": { + "types@<=5.0": { + "default": "./ts5.0/jsx-dev-runtime.d.ts" + }, + "types": { + "default": "./jsx-dev-runtime.d.ts" + } + }, + "./package.json": "./package.json" + }, "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", @@ -144,6 +200,7 @@ "@types/prop-types": "*", "csstype": "^3.0.2" }, - "typesPublisherContentHash": "b4bc71e5ae8e6467bc315f57f8e7b98e248d5994ecaaf51bd4e674de77bfb6fc", - "typeScriptVersion": "3.4" + "peerDependencies": {}, + "typesPublisherContentHash": "d59942da5433cf6c9d66442070074fa48ef9c823a4175da6e4d183d0a70ccc72", + "typeScriptVersion": "4.8" } \ No newline at end of file diff --git a/ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts b/ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts new file mode 100644 index 0000000000..87d1dfe383 --- /dev/null +++ b/ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts @@ -0,0 +1,44 @@ +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +export interface JSXSource { + /** + * The source file where the element originates from. + */ + fileName?: string | undefined; + + /** + * The line number where the element was created. + */ + lineNumber?: number | undefined; + + /** + * The column number where the element was created. + */ + columnNumber?: number | undefined; +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxDEV( + type: React.ElementType, + props: unknown, + key: React.Key | undefined, + isStatic: boolean, + source?: JSXSource, + self?: unknown, +): React.ReactElement; diff --git a/ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-runtime.d.ts b/ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-runtime.d.ts new file mode 100644 index 0000000000..8cc3b97452 --- /dev/null +++ b/ui/@mf-types/shell/node_modules/@types/react/ts5.0/jsx-runtime.d.ts @@ -0,0 +1,35 @@ +import * as React from "./"; +export { Fragment } from "./"; + +export namespace JSX { + interface Element extends React.JSX.Element {} + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsx( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; + +/** + * Create a React element. + * + * You should not use this function directly. Use JSX and a transpiler instead. + */ +export function jsxs( + type: React.ElementType, + props: unknown, + key?: React.Key, +): React.ReactElement; diff --git a/ui/@mf-types/shell/node_modules/oidc-client-ts/dist/esm/package.json b/ui/@mf-types/shell/node_modules/oidc-client-ts/dist/esm/package.json index 162dccbcf9..b61a65f636 100644 --- a/ui/@mf-types/shell/node_modules/oidc-client-ts/dist/esm/package.json +++ b/ui/@mf-types/shell/node_modules/oidc-client-ts/dist/esm/package.json @@ -1,4 +1,4 @@ { "type": "module", - "version": "3.0.1" + "version": "3.1.0" } diff --git a/ui/@mf-types/shell/node_modules/oidc-client-ts/package.json b/ui/@mf-types/shell/node_modules/oidc-client-ts/package.json index 529c19c59d..992f20fd26 100644 --- a/ui/@mf-types/shell/node_modules/oidc-client-ts/package.json +++ b/ui/@mf-types/shell/node_modules/oidc-client-ts/package.json @@ -1,6 +1,6 @@ { "name": "oidc-client-ts", - "version": "3.0.1", + "version": "3.1.0", "description": "OpenID Connect (OIDC) & OAuth2 client library", "repository": { "type": "git", @@ -36,30 +36,32 @@ "test": "tsc && jest", "typedoc": "typedoc", "lint": "eslint --max-warnings=0 --cache .", - "prepare": "husky install" + "prepare": "husky" }, "dependencies": { "jwt-decode": "^4.0.0" }, "devDependencies": { - "@microsoft/api-extractor": "^7.35.0", - "@testing-library/jest-dom": "^6.0.0", - "@types/jest": "^29.2.3", - "@types/node": "^20.8.2", - "@typescript-eslint/eslint-plugin": "^6.4.1", - "@typescript-eslint/parser": "^6.4.1", - "esbuild": "^0.20.0", - "eslint": "^8.5.0", - "eslint-plugin-testing-library": "^6.0.0", - "http-proxy-middleware": "^2.0.1", - "husky": "^9.0.6", - "jest": "^29.3.1", - "jest-environment-jsdom": "^29.3.1", - "jest-mock": "^29.3.1", - "lint-staged": "^15.0.1", - "ts-jest": "^29.0.3", - "typedoc": "^0.25.0", - "typescript": "~5.3.3", + "@microsoft/api-extractor": "^7.47.2", + "@testing-library/jest-dom": "^6.4.6", + "@types/jest": "^29.5.12", + "@types/node": "^22.4.1", + "@typescript-eslint/eslint-plugin": "^7.16.1", + "@typescript-eslint/parser": "^7.16.1", + "esbuild": "^0.24.0", + "eslint": "^8.57.0", + "eslint-plugin-testing-library": "^6.2.2", + "http-proxy-middleware": "^3.0.0", + "fake-indexeddb": "^6.0.0", + "husky": "^9.0.11", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "jest-mock": "^29.7.0", + "jose": "^5.6.3", + "lint-staged": "^15.2.7", + "ts-jest": "^29.2.2", + "typedoc": "^0.26.4", + "typescript": "~5.4.2", "yn": "^5.0.0" }, "engines": { diff --git a/ui/@mf-types/shell/node_modules/react-query/package.json b/ui/@mf-types/shell/node_modules/react-query/package.json index 203edf3351..5d6e6d2358 100644 --- a/ui/@mf-types/shell/node_modules/react-query/package.json +++ b/ui/@mf-types/shell/node_modules/react-query/package.json @@ -1,6 +1,6 @@ { "name": "react-query", - "version": "3.34.0", + "version": "3.39.3", "description": "Hooks for managing, caching and syncing asynchronous and remote data in React", "author": "tannerlinsley", "license": "MIT", @@ -70,7 +70,7 @@ "match-sorter": "^6.0.2" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0" + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "peerDependenciesMeta": { "react-dom": { @@ -81,11 +81,7 @@ } }, "typesVersions": { - "<4.1": { - "types/*": [ - "types/ts3.8/*" - ] - } + "<4.1": { "types/*": ["types/ts3.8/*"] } }, "devDependencies": { "@babel/cli": "^7.11.6", @@ -148,6 +144,9 @@ "@types/react": "^16.9.41", "@types/react-dom": "^16.9.8" }, + "release": { + "branches": ["main"] + }, "bundlewatch": { "files": [ { diff --git a/ui/@mf-types/shell/node_modules/react-router/package.json b/ui/@mf-types/shell/node_modules/react-router/package.json new file mode 100644 index 0000000000..1fbd582bc3 --- /dev/null +++ b/ui/@mf-types/shell/node_modules/react-router/package.json @@ -0,0 +1,127 @@ +{ + "name": "react-router", + "version": "7.0.1", + "description": "Declarative routing for React", + "keywords": [ + "react", + "router", + "route", + "routing", + "history", + "link" + ], + "repository": { + "type": "git", + "url": "https://github.com/remix-run/react-router", + "directory": "packages/react-router" + }, + "license": "MIT", + "author": "Remix Software ", + "sideEffects": false, + "types": "./dist/production/index.d.ts", + "main": "./dist/production/index.js", + "module": "./dist/production/index.mjs", + "exports": { + ".": { + "node": { + "types": "./dist/production/index.d.ts", + "development": { + "module-sync": "./dist/development/index.mjs", + "default": "./dist/development/index.js" + }, + "module-sync": "./dist/production/index.mjs", + "default": "./dist/production/index.js" + }, + "import": { + "types": "./dist/production/index.d.mts", + "development": "./dist/development/index.mjs", + "default": "./dist/production/index.mjs" + }, + "default": { + "types": "./dist/production/index.d.ts", + "development": "./dist/development/index.js", + "default": "./dist/production/index.js" + } + }, + "./route-module": { + "import": { + "types": "./dist/production/lib/types/route-module.d.mts" + }, + "default": { + "types": "./dist/production/lib/types/route-module.d.ts" + } + }, + "./dom": { + "node": { + "types": "./dist/production/dom-export.d.ts", + "development": { + "module-sync": "./dist/development/dom-export.mjs", + "default": "./dist/development/dom-export.js" + }, + "module-sync": "./dist/production/dom-export.mjs", + "default": "./dist/production/dom-export.js" + }, + "import": { + "types": "./dist/production/dom-export.d.mts", + "development": "./dist/development/dom-export.mjs", + "default": "./dist/production/dom-export.mjs" + }, + "default": { + "types": "./dist/production/dom-export.d.ts", + "development": "./dist/development/dom-export.js", + "default": "./dist/production/dom-export.js" + } + }, + "./package.json": "./package.json" + }, + "wireit": { + "build": { + "command": "rimraf dist && tsup", + "files": [ + "lib/**", + "*.ts", + "tsconfig.json", + "package.json" + ], + "output": [ + "dist/**" + ] + } + }, + "dependencies": { + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" + }, + "devDependencies": { + "@types/set-cookie-parser": "^2.4.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "rimraf": "^6.0.1", + "tsup": "^8.3.0", + "typescript": "^5.1.6", + "wireit": "0.14.9" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + }, + "files": [ + "dist/", + "CHANGELOG.md", + "LICENSE.md", + "README.md" + ], + "engines": { + "node": ">=20.0.0" + }, + "scripts": { + "build": "wireit" + } +} \ No newline at end of file diff --git a/ui/package-lock.json b/ui/package-lock.json index c9e540f2c3..2874c5896a 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -12,7 +12,7 @@ "@hookform/resolvers": "^3.1.0", "@js-temporal/polyfill": "^0.4.4", "@kubernetes/client-node": "github:scality/kubernetes-client-javascript.git#browser-0.10.4-64-ge7c6721", - "@scality/core-ui": "git+https://github.com/scality/core-ui#33e22729ee7317f5afecb79f06b4f873dc3e376d", + "@scality/core-ui": "git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", "@scality/module-federation": "git+https://github.com/scality/module-federation#c571388783a2a51ae3bf5d36ae66753c8b014bb5", "axios": "^0.21.1", "formik": "2.2.5", @@ -29,8 +29,8 @@ "react-json-view": "^1.21.3", "react-query": "^3.34.0", "react-redux": "^7.1.0", - "react-router": "^6.28.0", - "react-router-dom": "^6.28.0", + "react-router": "^7.0.1", + "react-router-dom": "^7.0.1", "redux": "^4.0.1", "redux-saga": "^1.0.2", "reselect": "^2.5.4", @@ -5545,8 +5545,8 @@ }, "node_modules/@scality/core-ui": { "version": "0.151.0", - "resolved": "git+ssh://git@github.com/scality/core-ui.git#33e22729ee7317f5afecb79f06b4f873dc3e376d", - "integrity": "sha512-OFdbDWjVWBxnSuWYlWcyX2w8KtvTNNfb1tWABUe2wxGQwcLetbvZCaLCnpGg2+HPysrB+Uzd1ol6t4yLLdpzrg==", + "resolved": "git+ssh://git@github.com/scality/core-ui.git#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", + "integrity": "sha512-J1k8BtcEPGbzyFexYXkDdS/6sk1jBY+gN/QeljvuloMRr29OlVqTaoUtOgr6C8i0OvcanNx2OiWcWfw8za2Q7Q==", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@floating-ui/dom": "^1.6.3", @@ -5600,6 +5600,36 @@ "@floating-ui/utils": "^0.2.0" } }, + "node_modules/@scality/core-ui/node_modules/react-router": { + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", + "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "dependencies": { + "@remix-run/router": "1.21.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/@scality/core-ui/node_modules/react-router-dom": { + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", + "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "dependencies": { + "@remix-run/router": "1.21.0", + "react-router": "6.28.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/@scality/module-federation": { "version": "1.3.4", "resolved": "git+ssh://git@github.com/scality/module-federation.git#c571388783a2a51ae3bf5d36ae66753c8b014bb5", @@ -23167,33 +23197,54 @@ } }, "node_modules/react-router": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", - "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.1.tgz", + "integrity": "sha512-WVAhv9oWCNsja5AkK6KLpXJDSJCQizOIyOd4vvB/+eHGbYx5vkhcmcmwWjQ9yqkRClogi+xjEg9fNEOd5EX/tw==", "dependencies": { - "@remix-run/router": "1.21.0" + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } } }, "node_modules/react-router-dom": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", - "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.1.tgz", + "integrity": "sha512-duBzwAAiIabhFPZfDjcYpJ+f08TMbPMETgq254GWne2NW1ZwRHhZLj7tpSp8KGb7JvZzlLcjGUnqLxpZQVEPng==", "dependencies": { - "@remix-run/router": "1.21.0", - "react-router": "6.28.0" + "react-router": "7.0.1" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/react-router/node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, + "node_modules/react-router/node_modules/cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", + "engines": { + "node": ">=18" } }, "node_modules/react-select": { @@ -24305,9 +24356,9 @@ } }, "node_modules/set-cookie-parser": { - "version": "2.4.8", - "dev": true, - "license": "MIT" + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==" }, "node_modules/set-value": { "version": "2.0.1", @@ -25869,6 +25920,11 @@ "node": "*" } }, + "node_modules/turbo-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==" + }, "node_modules/tweetnacl": { "version": "0.14.5", "license": "Unlicense" @@ -32170,9 +32226,9 @@ } }, "@scality/core-ui": { - "version": "git+ssh://git@github.com/scality/core-ui.git#33e22729ee7317f5afecb79f06b4f873dc3e376d", - "integrity": "sha512-OFdbDWjVWBxnSuWYlWcyX2w8KtvTNNfb1tWABUe2wxGQwcLetbvZCaLCnpGg2+HPysrB+Uzd1ol6t4yLLdpzrg==", - "from": "@scality/core-ui@git+https://github.com/scality/core-ui#33e22729ee7317f5afecb79f06b4f873dc3e376d", + "version": "git+ssh://git@github.com/scality/core-ui.git#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", + "integrity": "sha512-J1k8BtcEPGbzyFexYXkDdS/6sk1jBY+gN/QeljvuloMRr29OlVqTaoUtOgr6C8i0OvcanNx2OiWcWfw8za2Q7Q==", + "from": "@scality/core-ui@git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", "requires": { "@floating-ui/dom": "^1.6.3", "@fortawesome/fontawesome-free": "^5.10.2", @@ -32224,6 +32280,23 @@ "@floating-ui/core": "^1.0.0", "@floating-ui/utils": "^0.2.0" } + }, + "react-router": { + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", + "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "requires": { + "@remix-run/router": "1.21.0" + } + }, + "react-router-dom": { + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", + "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "requires": { + "@remix-run/router": "1.21.0", + "react-router": "6.28.0" + } } } }, @@ -44995,20 +45068,34 @@ } }, "react-router": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.28.0.tgz", - "integrity": "sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.1.tgz", + "integrity": "sha512-WVAhv9oWCNsja5AkK6KLpXJDSJCQizOIyOd4vvB/+eHGbYx5vkhcmcmwWjQ9yqkRClogi+xjEg9fNEOd5EX/tw==", "requires": { - "@remix-run/router": "1.21.0" + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" + }, + "dependencies": { + "@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, + "cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==" + } } }, "react-router-dom": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.28.0.tgz", - "integrity": "sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.1.tgz", + "integrity": "sha512-duBzwAAiIabhFPZfDjcYpJ+f08TMbPMETgq254GWne2NW1ZwRHhZLj7tpSp8KGb7JvZzlLcjGUnqLxpZQVEPng==", "requires": { - "@remix-run/router": "1.21.0", - "react-router": "6.28.0" + "react-router": "7.0.1" } }, "react-select": { @@ -45832,8 +45919,9 @@ } }, "set-cookie-parser": { - "version": "2.4.8", - "dev": true + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==" }, "set-value": { "version": "2.0.1", @@ -47009,6 +47097,11 @@ "safe-buffer": "^5.0.1" } }, + "turbo-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==" + }, "tweetnacl": { "version": "0.14.5" }, diff --git a/ui/package.json b/ui/package.json index adbcd0dcd3..556d13e533 100644 --- a/ui/package.json +++ b/ui/package.json @@ -7,7 +7,7 @@ "@hookform/resolvers": "^3.1.0", "@js-temporal/polyfill": "^0.4.4", "@kubernetes/client-node": "github:scality/kubernetes-client-javascript.git#browser-0.10.4-64-ge7c6721", - "@scality/core-ui": "git+https://github.com/scality/core-ui#33e22729ee7317f5afecb79f06b4f873dc3e376d", + "@scality/core-ui": "git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f", "@scality/module-federation": "git+https://github.com/scality/module-federation#c571388783a2a51ae3bf5d36ae66753c8b014bb5", "axios": "^0.21.1", "formik": "2.2.5", @@ -24,8 +24,8 @@ "react-json-view": "^1.21.3", "react-query": "^3.34.0", "react-redux": "^7.1.0", - "react-router": "^6.28.0", - "react-router-dom": "^6.28.0", + "react-router": "^7.0.1", + "react-router-dom": "^7.0.1", "redux": "^4.0.1", "redux-saga": "^1.0.2", "reselect": "^2.5.4", diff --git a/ui/src/FederableApp.tsx b/ui/src/FederableApp.tsx index dda7b7a147..c766c79596 100644 --- a/ui/src/FederableApp.tsx +++ b/ui/src/FederableApp.tsx @@ -1,18 +1,6 @@ -import { - ErrorPage404, - ErrorPage500, - Loader, - ToastProvider, -} from '@scality/core-ui'; +import { ErrorPage500, Loader, ToastProvider } from '@scality/core-ui'; import { useCurrentApp } from '@scality/module-federation'; -import { - lazy, - PropsWithChildren, - ReactNode, - Suspense, - useEffect, - useMemo, -} from 'react'; +import { PropsWithChildren, ReactNode, useEffect, useMemo } from 'react'; import { Provider, useDispatch } from 'react-redux'; import { applyMiddleware, compose, createStore, Store } from 'redux'; import createSagaMiddleware from 'redux-saga'; @@ -26,22 +14,6 @@ import sagas from './ducks/sagas'; import { useTypedSelector } from './hooks'; import { AuthError } from './services/errorhandler'; import { ShellHooksProvider, useShellHooks } from './ShellHooksContext'; -import { Route, Routes } from 'react-router-dom'; - -import CreateVolume from './containers/CreateVolume'; -import { PrivateRouteWrapper } from './containers/PrivateRoute'; -import { useIntl } from 'react-intl'; - -const ConfigureAlerting = lazy( - () => import('./alert-configuration/ConfigureAlerting'), -); -const NodeCreateForm = lazy(() => import('./containers/NodeCreateForm')); -const NodePage = lazy(() => import('./containers/NodePage')); -const About = lazy(() => import('./containers/About')); -const PrivateRoute = lazy(() => import('./containers/PrivateRoute')); -const VolumePage = lazy(() => import('./containers/VolumePage')); -const DashboardPage = lazy(() => import('./containers/DashboardPage')); -const AlertPage = lazy(() => import('./containers/AlertPage')); const composeEnhancers = // @ts-expect-error - FIXME when you are working on it @@ -86,6 +58,7 @@ const RouterWithBaseName = ({ children }: { children: ReactNode }) => { if (configStatus === 'idle' || configStatus === 'loading') { return <>{children}; } + return <>{children}; }; type Config = { diff --git a/ui/src/components/NodeListTable.tsx b/ui/src/components/NodeListTable.tsx index 4937f12f56..2862f3939c 100644 --- a/ui/src/components/NodeListTable.tsx +++ b/ui/src/components/NodeListTable.tsx @@ -12,6 +12,7 @@ import { useIntl } from 'react-intl'; import { useNavigate, useResolvedPath } from 'react-router'; import { useLocation } from 'react-router-dom'; import styled from 'styled-components'; +import { useTypedSelector } from '../hooks'; import { useURLQuery } from '../services/utils'; import CircleStatus from './CircleStatus'; const StatusText = styled.div` @@ -26,7 +27,11 @@ const NodeListTable = ({ nodeTableData }) => { const query = useURLQuery(); const intl = useIntl(); const path = useResolvedPath(''); - const selectedNodeName = location?.pathname?.split('/')?.slice(2)[0] || ''; + + const basename = useTypedSelector((state) => state.config.api?.ui_base_path); + + const selectedNodeName = location?.pathname.split('/')?.slice(2)[1] || ''; + const columns = React.useMemo( () => [ { @@ -127,14 +132,14 @@ const NodeListTable = ({ nodeTableData }) => { location.pathname.endsWith('partitions') || location.pathname.endsWith('details'); + const newPath = location.pathname.replace( + /\/nodes\/[^/]*\//, + `/nodes/${nodeName}/`, + ); if (isTabSelected) { - const newPath = location.pathname.replace( - /\/nodes\/[^/]*\//, - `/nodes/${nodeName}/`, - ); - navigate(`${newPath}?${query.toString()}`); + navigate(newPath); } else { - navigate(`${path}/${nodeName}/overview?${query.toString()}`); + navigate(`${newPath}/overview?${query.toString()}`); } }, [navigate, location.pathname, path, query], @@ -162,7 +167,7 @@ const NodeListTable = ({ nodeTableData }) => { })} icon={} onClick={() => { - navigate('/nodes/create'); + navigate(basename + '/nodes/create'); }} data-cy="create_node_button" /> diff --git a/ui/src/components/VolumeListTable.tsx b/ui/src/components/VolumeListTable.tsx index bbf72e0ddb..90eb1f21d2 100644 --- a/ui/src/components/VolumeListTable.tsx +++ b/ui/src/components/VolumeListTable.tsx @@ -8,6 +8,7 @@ import { useTheme } from 'styled-components'; import CircleStatus from './CircleStatus'; import { Latency } from './Latency'; import { TooltipContent, UnknownIcon } from './TableRow'; +import { useTypedSelector } from '../hooks'; const VolumeListTable = (props) => { const { volumeListData, volumeName } = props; @@ -15,6 +16,8 @@ const VolumeListTable = (props) => { const location = useLocation(); const intl = useIntl(); const theme = useTheme(); + const basename = useTypedSelector((state) => state.config.api?.ui_base_path); + const columns = React.useMemo(() => { return [ { @@ -173,7 +176,7 @@ const VolumeListTable = (props) => { }); } else { navigate({ - pathname: `/volumes/${row.values.name}/overview`, + pathname: basename + `/volumes/${row.values.name}/overview`, search: query.toString(), }); } @@ -202,7 +205,7 @@ const VolumeListTable = (props) => { })} icon={} onClick={() => { - navigate('/volumes/createVolume'); + navigate(basename + '/volumes/createVolume'); }} data-cy="create_volume_button" /> diff --git a/ui/src/containers/Layout.tsx b/ui/src/containers/Layout.tsx index f8388b75d5..7ae8bf7205 100644 --- a/ui/src/containers/Layout.tsx +++ b/ui/src/containers/Layout.tsx @@ -2,26 +2,19 @@ import { AppContainer, ErrorPage404, Icon, - Loader, Notifications, Sidebar, } from '@scality/core-ui'; -import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react'; +import { lazy, useCallback, useEffect, useState } from 'react'; import { useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; -import { matchPath, MemoryRouter, Navigate, Outlet, Route } from 'react-router'; -import { - BrowserRouter, - Routes, - useLocation, - useNavigate, -} from 'react-router-dom'; +import { matchPath, Navigate, Route } from 'react-router'; +import { Routes, useLocation, useNavigate } from 'react-router-dom'; import { removeNotificationAction } from '../ducks/app/notifications'; import { setIntlAction } from '../ducks/config'; import { useTypedSelector } from '../hooks'; import CreateVolume from './CreateVolume'; -import { PrivateRouteWrapper } from './PrivateRoute'; const ConfigureAlerting = lazy( () => import('../alert-configuration/ConfigureAlerting'), @@ -72,17 +65,19 @@ const Layout = () => { }; const navigate = useNavigate(); + const location = useLocation(); + const basename = useTypedSelector((state) => state.config.api?.ui_base_path); const doesRouteMatch = useCallback( (paths: string | string[]) => { if (Array.isArray(paths)) { const foundMatchingRoute = paths.find( - (path) => !!matchPath({ path, end: false }, location.pathname), + (path) => !!matchPath(basename + path + '*', location.pathname), ); return !!foundMatchingRoute; } else { - return !!matchPath({ path: paths, end: false }, location.pathname); + return !!matchPath(basename + paths + '*', location.pathname); } }, [location.pathname], @@ -109,7 +104,7 @@ const Layout = () => { }), icon: , onClick: () => { - navigate('dashboard'); + navigate(basename + '/dashboard'); }, active: doesRouteMatch('/dashboard'), 'data-cy': 'sidebar_item_dashboard', @@ -120,7 +115,7 @@ const Layout = () => { }), icon: , onClick: () => { - navigate('nodes'); + navigate(basename + '/nodes'); }, active: doesRouteMatch('/nodes'), 'data-cy': 'sidebar_item_nodes', @@ -131,7 +126,7 @@ const Layout = () => { }), icon: , onClick: () => { - navigate('volumes'); + navigate(basename + '/volumes'); }, active: doesRouteMatch('/volumes'), 'data-cy': 'sidebar_item_volumes', @@ -149,103 +144,91 @@ const Layout = () => { > - - <> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + { - return userAccessRight.canConfigureEmailNotification; - }} - > - - - } - /> - - - - } - /> - - } - /> - - + canAccess={(_, userAccessRight) => { + return userAccessRight.canConfigureEmailNotification; + }} + > + + + } + /> + } /> + + } + /> - ); }; diff --git a/ui/src/containers/NodePage.tsx b/ui/src/containers/NodePage.tsx index da7df13dab..b67961d02b 100644 --- a/ui/src/containers/NodePage.tsx +++ b/ui/src/containers/NodePage.tsx @@ -1,12 +1,11 @@ -import React from 'react'; import { useSelector } from 'react-redux'; +import { useTheme } from 'styled-components'; import { refreshNodesAction, stopRefreshNodesAction } from '../ducks/app/nodes'; -import { useRefreshEffect } from '../services/utils'; -import NodePageContent from './NodePageContent'; +import { useTypedSelector } from '../hooks'; import { getNodeListData } from '../services/NodeUtils'; +import { useRefreshEffect } from '../services/utils'; import { useAlerts } from './AlertProvider'; -import { useTheme } from 'styled-components'; -import { useTypedSelector } from '../hooks'; +import NodePageContent from './NodePageContent'; const NodePage = (props) => { useRefreshEffect(refreshNodesAction, stopRefreshNodesAction); diff --git a/ui/src/containers/NodePageContent.tsx b/ui/src/containers/NodePageContent.tsx index de5f27afd9..814f4d56e7 100644 --- a/ui/src/containers/NodePageContent.tsx +++ b/ui/src/containers/NodePageContent.tsx @@ -1,7 +1,7 @@ /* eslint no-unused-vars: 0 */ import { AppContainer, EmptyState, TwoPanelLayout } from '@scality/core-ui'; import { useEffect, useState } from 'react'; -import { Navigate, Route, Routes, useResolvedPath } from 'react-router-dom'; +import { Route, Routes, useNavigate, useResolvedPath } from 'react-router-dom'; import NodeListTable from '../components/NodeListTable'; import { LeftSideInstanceList } from '../components/style/CommonLayoutStyle'; import { usePrevious } from '../services/utils'; @@ -11,10 +11,9 @@ import NodePageRSP from './NodePageRSP'; const NodePageContent = (props) => { const { nodeTableData, loading } = props; const path = useResolvedPath('').pathname; - console.log('NodePageContent: Rendering', path); - const [defaultSelectNodeName, setDefaultSelectNodeName] = useState(null); const [isFirstLoadingDone, setIsFirstLoadingDone] = useState(false); const previousLoading = usePrevious(loading); + const navigate = useNavigate(); /* ** Used to determine if a first loading has happened @@ -25,10 +24,13 @@ const NodePageContent = (props) => { setIsFirstLoadingDone(true); }, [previousLoading, loading, isFirstLoadingDone]); useEffect(() => { - if (!defaultSelectNodeName && nodeTableData[0]?.name?.name) { - setDefaultSelectNodeName(nodeTableData[0]?.name?.name); + if (nodeTableData.length > 0) { + const firstNodeName = nodeTableData[0]?.name?.name; + if (firstNodeName && !path.includes(firstNodeName)) { + navigate(`${firstNodeName}/overview`, { replace: true }); + } } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [JSON.stringify(nodeTableData), defaultSelectNodeName]); + }, [JSON.stringify(nodeTableData)]); if (!nodeTableData.length && isFirstLoadingDone) { return ( @@ -57,19 +59,8 @@ const NodePageContent = (props) => { rightPanel={{ children: ( - {/* Auto select the first node in the list */} - ) : null - } - /> - } /> diff --git a/ui/src/containers/NodePageRSP.tsx b/ui/src/containers/NodePageRSP.tsx index 3867e64546..ad47e4998b 100644 --- a/ui/src/containers/NodePageRSP.tsx +++ b/ui/src/containers/NodePageRSP.tsx @@ -105,6 +105,7 @@ const NodePageRSP = (props) => { const workloadPlaneInterface = nodesIPsInfo[name]?.workloadPlane?.interface ?? ''; const currentNode = nodeTableData?.find((node) => node.name.name === name); + useEffect(() => { dispatch( updateNodeStatsFetchArgumentAction({ @@ -164,7 +165,7 @@ const NodePageRSP = (props) => { { /> { { { { @@ -247,7 +248,7 @@ const NodePageRSP = (props) => { label={intl.formatMessage({ id: 'details', })} - path={`${url}/details`} + path={url.includes('/details') ? url : `${url}/details`} > diff --git a/ui/src/containers/PrivateRoute.tsx b/ui/src/containers/PrivateRoute.tsx index 0c22deaf53..d887245906 100644 --- a/ui/src/containers/PrivateRoute.tsx +++ b/ui/src/containers/PrivateRoute.tsx @@ -1,13 +1,7 @@ import { ErrorPage401, ErrorPageAuth } from '@scality/core-ui'; import { ReactNode, useMemo } from 'react'; import { useDispatch } from 'react-redux'; -import { - Navigate, - Route, - Routes, - useLocation, - useNavigate, -} from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import { updateAPIConfigAction } from '../ducks/config'; import { UserAccessRight, @@ -42,12 +36,16 @@ const AccessRouteGuard = ({ if (!canAccess) { return ; } - console.log('AccessRouteGuard: Rendering children'); return <>{children}; }; +type PrivateRouteProps = { + children: ReactNode; + path?: string; + canAccess?: (roles: UserRoles, userAccessRight: UserAccessRight) => boolean; +}; + const PrivateRoute = ({ children, ...rest }: PrivateRouteProps) => { - const location = useLocation(); const canAccess = rest.canAccess ? rest.canAccess : () => true; const { language, api } = useTypedSelector((state) => state.config); const { isAuthError } = useTypedSelector( @@ -76,11 +74,6 @@ const PrivateRoute = ({ children, ...rest }: PrivateRouteProps) => { /> ); } else if (userData.token && userData.username) { - if (location.pathname === '/') { - console.log('Redirecting to /dashboard'); - return ; - } - console.log('Rendering children'); return ( {children} ); @@ -95,21 +88,4 @@ const PrivateRoute = ({ children, ...rest }: PrivateRouteProps) => { } }; -type PrivateRouteProps = { - children: ReactNode; - path?: string; - canAccess?: (roles: UserRoles, userAccessRight: UserAccessRight) => boolean; -}; - -export const PrivateRouteWrapper = ({ - path, - ...props -}: PrivateRouteProps & { path: string }) => { - return ( - - } /> - - ); -}; - export default PrivateRoute; diff --git a/ui/src/containers/VolumePageContent.tsx b/ui/src/containers/VolumePageContent.tsx index 35d9b6485a..423662a4bb 100644 --- a/ui/src/containers/VolumePageContent.tsx +++ b/ui/src/containers/VolumePageContent.tsx @@ -1,109 +1,33 @@ /* eslint-disable react-hooks/exhaustive-deps */ -import { - AppContainer, - EmptyState, - TextBadge, - TwoPanelLayout, - spacing, -} from '@scality/core-ui'; -import { Tabs } from '@scality/core-ui/dist/next'; +import { AppContainer, EmptyState, TwoPanelLayout } from '@scality/core-ui'; import { useEffect, useState } from 'react'; -import { useIntl } from 'react-intl'; -import { useLocation, useNavigate, useParams } from 'react-router'; -import AlertsTab from '../components/AlertsTab'; -import VolumeDetailsTab from '../components/VolumeDetailsTab'; +import { Route, Routes, useLocation, useNavigate } from 'react-router'; import VolumeListTable from '../components/VolumeListTable'; -import VolumeMetricsTab from '../components/VolumeMetricsTab'; -import VolumeOverviewTab from '../components/VolumeOverviewTab'; -import { - LeftSideInstanceList, - NoInstanceSelected, - NoInstanceSelectedContainer, - NotBoundContainer, - RightSidePanel, -} from '../components/style/CommonLayoutStyle'; -import { - LVM_LOGICAL_VOLUME, - RAW_BLOCK_DEVICE, - SPARSE_LOOP_DEVICE, -} from '../constants'; -import { computeVolumeGlobalStatus } from '../services/NodeVolumesUtils'; +import { LeftSideInstanceList } from '../components/style/CommonLayoutStyle'; import { usePrevious } from '../services/utils'; -import { useAlerts } from './AlertProvider'; +import { VolumePageRSP } from './VolumePageRSP'; // component extracts volume name from URL and holds the volume-specific data. // The three components in RightSidePanel ( / / ) are dumb components, // so that with the implementation of Tabs no re-render should happen during the switch. const VolumePageContent = (props) => { - const { - volumes, - nodes, - volumeListData, - pVList, - pVCList, - pods, - currentVolumeObject, - loading, - } = props; + const { volumeListData, loading } = props; const navigate = useNavigate(); const location = useLocation(); - const params = useParams(); - const query = new URLSearchParams(location.search); const [isFirstLoadingDone, setIsFirstLoadingDone] = useState(false); const previousLoading = usePrevious(loading); - const intl = useIntl(); - const currentVolumeName = params.name; + const currentVolumeName = location?.pathname.split('/')?.slice(2)[1] || ''; + // If data has been retrieved and no volume is selected yet we select the first one useEffect(() => { - if (volumeListData[0]?.name && pVCList.length && !currentVolumeName) { - navigate( - `/volumes/${volumeListData[0]?.name}/overview?${query.toString()}`, - { replace: true }, - ); + if (volumeListData.length > 0) { + const firstVolumeName = volumeListData[0]?.name; + if (firstVolumeName && !location.pathname.includes(firstVolumeName)) { + navigate(`${firstVolumeName}/overview`, { replace: true }); + } } - }, [ - JSON.stringify(volumeListData), - currentVolumeName, - query.toString(), - navigate, - JSON.stringify(pVCList), - ]); - const volume = volumes?.find( - (volume) => volume.metadata.name === currentVolumeName, - ); - const currentVolume = volumeListData?.find( - (vol) => vol.name === currentVolumeName, - ); - const pV = pVList?.find((pv) => pv.metadata.name === currentVolumeName); - const volumeStatus = computeVolumeGlobalStatus( - volume?.metadata?.name, - volume?.status, - ); - // get the used pod(s) - const PVCName = pV?.spec?.claimRef?.name; - const PVCNamespace = pV?.spec?.claimRef?.namespace; - // we need to make sure that `PVCName` is exist otherwise may return undefined `persistentVolumeClaim` pod - const UsedPod = - PVCName && - pods?.find((pod) => - pod.volumes.find((volume) => volume.persistentVolumeClaim === PVCName), - ); - const alertsVolume = useAlerts({ - persistentvolumeclaim: PVCName, - }); - const alertlist = alertsVolume && alertsVolume.alerts; - const criticalAlerts = alertlist.filter( - (alert) => alert.severity === 'critical', - ); - // prepare the data for - const deviceName = volume?.status?.deviceName; - const instanceIp = nodes.find( - (node) => node.name === volume?.spec?.nodeName, - )?.internalIP; - /* - ** Used to determine if a first loading has happened - ** This allow us to check if we need to display EmptyState or not - */ + }, [JSON.stringify(volumeListData)]); + useEffect(() => { if (previousLoading && !loading && !isFirstLoadingDone) setIsFirstLoadingDone(true); @@ -122,148 +46,6 @@ const VolumePageContent = (props) => { ); } - const rightSidePanel = - currentVolumeName && volume ? ( - - - - vol.name === currentVolumeName) - ?.storageCapacity - } - health={ - volumeListData?.find((vol) => vol.name === currentVolumeName) - ?.health - } - condition={currentVolume?.status} // the delete button inside the volume detail card should know that which volume is the first one - volumeListData={volumeListData} - pVList={pVList} - alertlist={alertlist} - /> - - 0 - ? 'statusCritical' - : 'statusWarning' - } - text={`${alertlist.length}`} - /> - ) : null - } - data-cy="alerts_tab_volume_page" - withoutPadding - > - {PVCName ? ( - - ) : ( - - {intl.formatMessage({ - id: 'volume_is_not_bound', - })} - - )} - - - - - - - - - - ) : ( - - - {currentVolumeName - ? `Volume ${currentVolumeName} ${intl.formatMessage({ - id: 'not_found', - })}` - : intl.formatMessage({ - id: 'no_volume_selected', - })} - - - ); return ( { ), }} rightPanel={{ - children: rightSidePanel, + children: ( + + } /> + + ), }} /> diff --git a/ui/src/containers/VolumePageRSP.tsx b/ui/src/containers/VolumePageRSP.tsx new file mode 100644 index 0000000000..51e76a0c55 --- /dev/null +++ b/ui/src/containers/VolumePageRSP.tsx @@ -0,0 +1,205 @@ +import { useIntl } from 'react-intl'; +import { useLocation, useParams } from 'react-router'; +import { computeVolumeGlobalStatus } from '../services/NodeVolumesUtils'; +import { + LVM_LOGICAL_VOLUME, + RAW_BLOCK_DEVICE, + SPARSE_LOOP_DEVICE, +} from '../constants'; +import { useAlerts } from './AlertProvider'; +import { TextBadge, spacing } from '@scality/core-ui'; +import AlertsTab from '../components/AlertsTab'; +import { + RightSidePanel, + NotBoundContainer, + NoInstanceSelectedContainer, + NoInstanceSelected, +} from '../components/style/CommonLayoutStyle'; +import VolumeDetailsTab from '../components/VolumeDetailsTab'; +import VolumeMetricsTab from '../components/VolumeMetricsTab'; +import VolumeOverviewTab from '../components/VolumeOverviewTab'; +import { Tabs } from '@scality/core-ui/dist/next'; + +export const VolumePageRSP = (props) => { + const { volumes, nodes, volumeListData, pVList, pods, currentVolumeObject } = + props; + + const { name } = useParams(); + const location = useLocation(); + const intl = useIntl(); + + const currentVolumeName = name; + const volume = volumes?.find( + (volume) => volume.metadata.name === currentVolumeName, + ); + const currentVolume = volumeListData?.find( + (vol) => vol.name === currentVolumeName, + ); + const volumeStatus = computeVolumeGlobalStatus( + volume?.metadata?.name, + volume?.status, + ); + + const pV = pVList?.find((pv) => pv.metadata.name === currentVolumeName); + + const PVCName = pV?.spec?.claimRef?.name; + const PVCNamespace = pV?.spec?.claimRef?.namespace; + const UsedPod = + PVCName && + pods?.find((pod) => + pod.volumes.find((volume) => volume.persistentVolumeClaim === PVCName), + ); + + const alertsVolume = useAlerts({ + persistentvolumeclaim: PVCName, + }); + const alertlist = alertsVolume && alertsVolume.alerts; + const criticalAlerts = alertlist.filter( + (alert) => alert.severity === 'critical', + ); + + const deviceName = volume?.status?.deviceName; + const instanceIp = nodes.find( + (node) => node.name === volume?.spec?.nodeName, + )?.internalIP; + + return currentVolumeName && volume ? ( + + + + vol.name === currentVolumeName) + ?.storageCapacity + } + health={ + volumeListData?.find((vol) => vol.name === currentVolumeName) + ?.health + } + condition={currentVolume?.status} // the delete button inside the volume detail card should know that which volume is the first one + volumeListData={volumeListData} + pVList={pVList} + alertlist={alertlist} + /> + + 0 ? 'statusCritical' : 'statusWarning' + } + text={`${alertlist.length}`} + /> + ) : null + } + data-cy="alerts_tab_volume_page" + withoutPadding + > + {PVCName ? ( + + ) : ( + + {intl.formatMessage({ + id: 'volume_is_not_bound', + })} + + )} + + + + + + + + + + ) : ( + + + {currentVolumeName + ? `Volume ${currentVolumeName} ${intl.formatMessage({ + id: 'not_found', + })}` + : intl.formatMessage({ + id: 'no_volume_selected', + })} + + + ); +};