diff --git a/web/package-lock.json b/web/package-lock.json index 12ed08ccd..2c8010fc7 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -59,7 +59,7 @@ "react-linkify": "^0.2.2", "react-modal": "^3.12.1", "react-redux": "7.2.9", - "react-router-dom-v5-compat": "^6.30.0", + "react-router-dom": "^6.30.0", "redux": "4.0.1", "use-query-params": "^2.2.1", "victory": "^37.3.6" @@ -5187,6 +5187,67 @@ "redux-thunk": "2.4.0" } }, + "node_modules/@openshift-console/dynamic-plugin-sdk-internal/node_modules/react-router-dom": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.4.tgz", + "integrity": "sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.13", + "history": "^4.9.0", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.2", + "react-router": "5.3.4", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "peerDependencies": { + "react": ">=15" + } + }, + "node_modules/@openshift-console/dynamic-plugin-sdk-internal/node_modules/react-router-dom-v5-compat": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router-dom-v5-compat/-/react-router-dom-v5-compat-6.30.3.tgz", + "integrity": "sha512-WWZtwGYyoaeUDNrhzzDkh4JvN5nU0MIz80Dxim6pznQrfS+dv0mvtVoHTA6HlUl/OiJl7WWjbsQwjTnYXejEHg==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2", + "history": "^5.3.0", + "react-router": "6.30.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8", + "react-router-dom": "4 || 5" + } + }, + "node_modules/@openshift-console/dynamic-plugin-sdk-internal/node_modules/react-router-dom-v5-compat/node_modules/history": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", + "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.6" + } + }, + "node_modules/@openshift-console/dynamic-plugin-sdk-internal/node_modules/react-router-dom-v5-compat/node_modules/react-router": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz", + "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, "node_modules/@openshift-console/dynamic-plugin-sdk-webpack": { "version": "4.20.0", "resolved": "https://registry.npmjs.org/@openshift-console/dynamic-plugin-sdk-webpack/-/dynamic-plugin-sdk-webpack-4.20.0.tgz", @@ -5230,6 +5291,67 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "license": "MIT" }, + "node_modules/@openshift-console/dynamic-plugin-sdk/node_modules/react-router-dom": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.4.tgz", + "integrity": "sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.13", + "history": "^4.9.0", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.2", + "react-router": "5.3.4", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "peerDependencies": { + "react": ">=15" + } + }, + "node_modules/@openshift-console/dynamic-plugin-sdk/node_modules/react-router-dom-v5-compat": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router-dom-v5-compat/-/react-router-dom-v5-compat-6.30.3.tgz", + "integrity": "sha512-WWZtwGYyoaeUDNrhzzDkh4JvN5nU0MIz80Dxim6pznQrfS+dv0mvtVoHTA6HlUl/OiJl7WWjbsQwjTnYXejEHg==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2", + "history": "^5.3.0", + "react-router": "6.30.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8", + "react-router-dom": "4 || 5" + } + }, + "node_modules/@openshift-console/dynamic-plugin-sdk/node_modules/react-router-dom-v5-compat/node_modules/history": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", + "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.6" + } + }, + "node_modules/@openshift-console/dynamic-plugin-sdk/node_modules/react-router-dom-v5-compat/node_modules/react-router": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz", + "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, "node_modules/@openshift/dynamic-plugin-sdk-webpack": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk-webpack/-/dynamic-plugin-sdk-webpack-4.1.0.tgz", @@ -21042,31 +21164,12 @@ } }, "node_modules/react-router-dom": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.4.tgz", - "integrity": "sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "loose-envify": "^1.3.1", - "prop-types": "^15.6.2", - "react-router": "5.3.4", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" - }, - "peerDependencies": { - "react": ">=15" - } - }, - "node_modules/react-router-dom-v5-compat": { "version": "6.30.3", - "resolved": "https://registry.npmjs.org/react-router-dom-v5-compat/-/react-router-dom-v5-compat-6.30.3.tgz", - "integrity": "sha512-WWZtwGYyoaeUDNrhzzDkh4JvN5nU0MIz80Dxim6pznQrfS+dv0mvtVoHTA6HlUl/OiJl7WWjbsQwjTnYXejEHg==", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.3.tgz", + "integrity": "sha512-pxPcv1AczD4vso7G4Z3TKcvlxK7g7TNt3/FNGMhfqyntocvYKj+GCatfigGDjbLozC4baguJ0ReCigoDJXb0ag==", "license": "MIT", "dependencies": { "@remix-run/router": "1.23.2", - "history": "^5.3.0", "react-router": "6.30.3" }, "engines": { @@ -21074,20 +21177,10 @@ }, "peerDependencies": { "react": ">=16.8", - "react-dom": ">=16.8", - "react-router-dom": "4 || 5" - } - }, - "node_modules/react-router-dom-v5-compat/node_modules/history": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", - "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.6" + "react-dom": ">=16.8" } }, - "node_modules/react-router-dom-v5-compat/node_modules/react-router": { + "node_modules/react-router-dom/node_modules/react-router": { "version": "6.30.3", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz", "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==", diff --git a/web/package.json b/web/package.json index 2deb9c0a7..5527b4bc3 100644 --- a/web/package.json +++ b/web/package.json @@ -98,7 +98,7 @@ "react-linkify": "^0.2.2", "react-modal": "^3.12.1", "react-redux": "7.2.9", - "react-router-dom-v5-compat": "^6.30.0", + "react-router-dom": "^6.30.0", "redux": "4.0.1", "use-query-params": "^2.2.1", "victory": "^37.3.6" diff --git a/web/src/components/dashboards/perses/dashboard-list-page.tsx b/web/src/components/dashboards/perses/dashboard-list-page.tsx index 92c3391e9..d406bf978 100644 --- a/web/src/components/dashboards/perses/dashboard-list-page.tsx +++ b/web/src/components/dashboards/perses/dashboard-list-page.tsx @@ -1,7 +1,8 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { type FC } from 'react'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import React, { type FC } from 'react'; import { QueryParamProvider } from 'use-query-params'; -import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; +import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6'; import { DashboardList } from './dashboard-list'; import { ToastProvider } from './ToastProvider'; @@ -16,7 +17,7 @@ const queryClient = new QueryClient({ const DashboardListPage: FC = () => { return ( - + diff --git a/web/src/components/dashboards/perses/dashboard-page.tsx b/web/src/components/dashboards/perses/dashboard-page.tsx index 979482475..09375ace9 100644 --- a/web/src/components/dashboards/perses/dashboard-page.tsx +++ b/web/src/components/dashboards/perses/dashboard-page.tsx @@ -1,9 +1,9 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { useEffect, type FC } from 'react'; +import React, { useEffect, type FC } from 'react'; import { useTranslation } from 'react-i18next'; -import { useSearchParams } from 'react-router-dom-v5-compat'; +import { useLocation } from 'react-router-dom'; import { QueryParamProvider } from 'use-query-params'; -import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; +import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6'; import { LoadingInline } from '../../console/console-shared/src/components/loading/LoadingInline'; import { OCPDashboardApp } from './dashboard-app'; import { DashboardFrame } from './dashboard-frame'; @@ -22,7 +22,8 @@ const queryClient = new QueryClient({ const DashboardPage_: FC = () => { const { t } = useTranslation(process.env.I18N_NAMESPACE); - const [searchParams] = useSearchParams(); + const location = useLocation(); + const searchParams = new URLSearchParams(location.search); const { activeProjectDashboardsMetadata, @@ -100,7 +101,7 @@ const DashboardPage_: FC = () => { const DashboardPage: React.FC = () => { return ( - + diff --git a/web/src/contexts/MonitoringContext.tsx b/web/src/contexts/MonitoringContext.tsx index fb48a4316..18b80230c 100644 --- a/web/src/contexts/MonitoringContext.tsx +++ b/web/src/contexts/MonitoringContext.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react'; import { MonitoringPlugins, Prometheus } from '../components/utils'; import { QueryParamProvider } from 'use-query-params'; -import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; +import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6'; import { useAccessReview } from '@openshift-console/dynamic-plugin-sdk'; type MonitoringContextType = { @@ -67,7 +67,7 @@ export const MonitoringProvider: React.FC<{ return ( - {children} + {children} ); };