Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency react-router-dom to v6 #5575

Merged
merged 86 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
07e361a
Update dependency react-router-dom to v6
renovate[bot] Jan 20, 2024
d7e26b3
[frontend] fix report knowledge
jpkha Jan 25, 2024
afaf14c
[frontend] small fix
jpkha Feb 12, 2024
5760cad
[frontend] rework analyses part done
jpkha Feb 12, 2024
d8af4a9
[frontend] case incident
jpkha Feb 13, 2024
d4b8b83
[frontend] case incident RTFS and RTIS
jpkha Feb 13, 2024
5582c39
[frontend] Rework events incidents path
jpkha Mar 12, 2024
cdbf5ec
[frontend] upgrade router-dom observations (#5575)
CelineSebe Mar 13, 2024
0a7ef85
[frontend] event sighting & observed data (#5575)
frapuks Mar 14, 2024
460dc61
[frontend] Fix rootObservations (#5575)
CelineSebe Mar 14, 2024
02b6b9f
[frontend] Fix rootObservations (#5575)
CelineSebe Mar 14, 2024
436469c
[frontend] fix observation artifacts
jpkha Mar 14, 2024
e9df48d
[frontend] threat / actor group (#5575)
frapuks Mar 15, 2024
4b9b3ae
[frontend] Infrastructure/Indicator (#5575)
CelineSebe Mar 15, 2024
5710a04
[frontend] fix knowledge bar in Event / incident (#5575)
frapuks Mar 15, 2024
3e87b83
[frontend] threat / actor individual (#5575)
frapuks Mar 15, 2024
8f158f3
[frontend] Malware/Channels/Tools root (#5575)
CelineSebe Mar 15, 2024
c620fb2
[frontend] Vulnerabilities root (#5575)
CelineSebe Mar 15, 2024
1a84dc7
[frontend] fix flashing tools/vulnerabilities(#5575)
CelineSebe Mar 15, 2024
f7f98a1
[frontend] Entities root(#5575)
CelineSebe Mar 15, 2024
d68045d
[frontend] first fix basics lint issues (#5575)
frapuks Mar 15, 2024
039c20b
[frontend] second fix lint issues (#5575)
frapuks Mar 18, 2024
416209c
[frontend] Sector root(#5575)
CelineSebe Mar 18, 2024
b3f7464
[frontend] threats / intrusion set (#5575)
frapuks Mar 18, 2024
c0b5d68
[frontend] Entities event root(#5575)
CelineSebe Mar 18, 2024
7abd325
[frontend] Threats / campaigns (#5575)
frapuks Mar 18, 2024
a3cd7be
[frontend] Techniques / attack pattern (#5575)
frapuks Mar 18, 2024
98a42d7
[frontend] Techniques / narratives (#5575)
frapuks Mar 18, 2024
e346a7a
[frontend] WIP Entities organizations root(#5575)
CelineSebe Mar 18, 2024
5f5a083
[frontend] Techniques / courses of actions (#5575)
frapuks Mar 19, 2024
58ddcf6
[frontend] Techniques / data components (#5575)
frapuks Mar 19, 2024
ac82d6a
[frontend] fix lint
jpkha Mar 19, 2024
de28aeb
[frontend] Techniques / data sources (#5575)
frapuks Mar 19, 2024
866a02a
[frontend] Fix knowledges (#5575)
CelineSebe Mar 19, 2024
8c0b62c
[frontend] Rollback shipContainer (#5575)
CelineSebe Mar 19, 2024
e0238bc
[frontend] fix boundaryWrapper
jpkha Mar 19, 2024
57355a9
[frontend] Entities/Organizations Systems Individuals(#5575)
CelineSebe Mar 19, 2024
3668dd2
[frontend] Entities/Organizations fix(#5575)
CelineSebe Mar 19, 2024
9abfeb2
[frontend] Workspace/Dashboard(#5575)
CelineSebe Mar 19, 2024
2713ac6
[frontend] Locations / Regions (#5575)
frapuks Mar 20, 2024
b63a236
[frontend] Locations / Countries (#5575)
frapuks Mar 20, 2024
513f331
[frontend] Locations / Administrative Areas (#5575)
frapuks Mar 20, 2024
7355ac0
[frontend] Locations / Cities (#5575)
frapuks Mar 20, 2024
ef9b77d
[frontend] Locations / Positions (#5575)
frapuks Mar 20, 2024
df8a09a
[frontend] Workspace/Dashboard Investigation (#5575)
CelineSebe Mar 20, 2024
e44a27f
[frontend] Fix Workspace/Dashboard Investigation (#5575)
CelineSebe Mar 20, 2024
d08f80a
[frontend] Data / * (#5575)
frapuks Mar 20, 2024
42b7c2a
[frontend] Profile / * (#5575)
frapuks Mar 20, 2024
63aeff0
[frontend] Settings (#5575)
CelineSebe Mar 20, 2024
760d497
[frontend] Fix decayRule settings(#5575)
CelineSebe Mar 20, 2024
dbe4d43
[frontend] Refacto Decay/Activity & fix exact(#5575)
CelineSebe Mar 21, 2024
a264d12
[frontend] Fix activity (#5575)
CelineSebe Mar 21, 2024
7fac0e7
[frontend] Settings/Vocabularies(#5597)
CelineSebe Mar 21, 2024
1699c14
[frontend] Case/Feedbacks Analyses/Opinions (#5575)
CelineSebe Mar 21, 2024
c38cd77
[frontend] Fix placeholder Vocabularies (#5575)
CelineSebe Mar 21, 2024
7e43f0b
[frontend] Cases / Tasks (#5575)
frapuks Mar 25, 2024
dfd31ae
[frontend] fix lint Observations / infrastructure (#5575)
frapuks Mar 25, 2024
58411af
[frontend] fix data / import / pending / * (#5575)
frapuks Mar 25, 2024
9d8f904
[frontend] fix check-ts
jpkha Mar 26, 2024
f36629f
[frontend] fix error.jsx
jpkha Mar 26, 2024
9ddef3b
[frontend] Cases - Change tab value knowledge
jpkha Mar 27, 2024
c2500f0
[frontend] Events and Observations - Change tab value knowledge
jpkha Mar 27, 2024
b7464c2
[frontend] Threats - Change tab value knowledge
jpkha Mar 27, 2024
e45548d
[frontend] Arsenal - Change tab value knowledge
jpkha Mar 27, 2024
b9a56d4
[frontend] Techniques - Change tab value knowledge
jpkha Mar 27, 2024
eea7cbe
[frontend] Entities - Change tab value knowledge
jpkha Mar 27, 2024
0c15999
[frontend] Locations - Change tab value knowledge
jpkha Mar 27, 2024
3cb6f3d
[frontend] Fixed accesses roles detail
jpkha Mar 27, 2024
a383ce1
[frontend] fix error lint empty line (#5575)
frapuks Mar 28, 2024
c706438
[frontend] create and fix last relationships routes (#5575)
frapuks Mar 28, 2024
edf754d
[frontend] fix lint (#5575)
frapuks Mar 28, 2024
264994c
[frontend] update yarn.lock
jpkha Mar 29, 2024
a9b778c
[frontend] fix Thread path / (#5575)
frapuks Apr 3, 2024
6a1460c
[frontend] fix Export Button to investigation (#5575)
frapuks Apr 3, 2024
777cd82
[frontend] Update react-router-dom to 6.22.3
jpkha Apr 3, 2024
438aa9d
[frontend] fix grouping and reports
jpkha Apr 3, 2024
c2fa15f
[frontend] flashing analyse and cases (#5575)
frapuks Apr 3, 2024
1d3bad0
[frontend] fix yarn.lock
jpkha Apr 3, 2024
29550e4
[frontend] fix lint
jpkha Apr 4, 2024
ffe8106
[frontend] update yarn.lock
jpkha Apr 4, 2024
088b9e7
[frontend] fix grouping knowledge
jpkha Apr 4, 2024
35091f0
[frontend] delete opinions table list
jpkha Apr 4, 2024
dbbe724
[frontend] /relations/:relationId (#5575)
frapuks Apr 5, 2024
ccf0857
[frontend] /relations/:relationid linter (#5575)
frapuks Apr 5, 2024
014cd81
[frontend] fix refresh on restricted line
jpkha Apr 5, 2024
01c83f2
[frontend] update yarn.lock
jpkha Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions opencti-platform/opencti-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
"react-rectangle-selection": "1.0.4",
"react-relay": "16.2.0",
"react-relay-network-modern": "6.2.2",
"react-router-dom": "5.3.4",
"react-router-dom-v5-compat": "6.22.3",
"react-router-dom": "6.22.3",
"react-syntax-highlighter": "15.5.0",
"react-timeline-range-slider": "1.4.1",
"react-virtualized": "9.22.5",
Expand All @@ -91,9 +90,9 @@
"devDependencies": {
"@playwright/test": "1.42.1",
"@rollup/plugin-graphql": "2.0.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.2",
"@testing-library/user-event": "^14.5.2",
"@testing-library/user-event": "14.5.2",
"@types/node": "20.12.3",
"@types/qrcode": "1.5.5",
"@types/ramda": "0.29.11",
Expand Down
17 changes: 7 additions & 10 deletions opencti-platform/opencti-front/src/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { OperationDescriptor, RelayEnvironmentProvider } from 'react-relay/hooks
import { createMockEnvironment, MockPayloadGenerator as MockGen } from 'relay-test-utils';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import { BrowserRouter } from 'react-router-dom';
import { CompatRouter } from 'react-router-dom-v5-compat';
import { describe, afterEach, it, expect } from 'vitest';
import AppIntlProvider from './components/AppIntlProvider';
import Profile, { profileQuery } from './private/components/profile/Profile';
Expand Down Expand Up @@ -53,15 +52,13 @@ describe('App', () => {
const { getByDisplayValue } = render(
<RelayEnvironmentProvider environment={environment}>
<BrowserRouter basename={APP_BASE_PATH}>
<CompatRouter>
<AppIntlProvider settings={{ platform_language: 'auto' }}>
<ThemeProvider theme={createTheme()}>
<UserContext.Provider value={UserContextValue}>
<Profile/>
</UserContext.Provider>
</ThemeProvider>
</AppIntlProvider>
</CompatRouter>
<AppIntlProvider settings={{ platform_language: 'auto' }}>
<ThemeProvider theme={createTheme()}>
<UserContext.Provider value={UserContextValue}>
<Profile/>
</UserContext.Provider>
</ThemeProvider>
</AppIntlProvider>
</BrowserRouter>
</RelayEnvironmentProvider>,
);
Expand Down
37 changes: 17 additions & 20 deletions opencti-platform/opencti-front/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { BrowserRouter } from 'react-router-dom';
import { CompatRouter, Route, Routes, Navigate } from 'react-router-dom-v5-compat';
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';
import React, { Suspense, lazy } from 'react';
import { APP_BASE_PATH } from './relay/environment';
import RedirectManager from './components/RedirectManager';
import { RedirectManager } from './components/RedirectManager';
import AuthBoundaryComponent from './private/components/AuthBoundary';
import Loader from './components/Loader';

Expand All @@ -11,23 +10,21 @@ const PrivateRoot = lazy(() => import('./private/Root'));

const App = () => (
<BrowserRouter basename={APP_BASE_PATH}>
<CompatRouter>
<AuthBoundaryComponent>
<RedirectManager>
<Suspense fallback={<Loader />}>
<Routes>
<Route path="/dashboard/*" Component={PrivateRoot} />
<Route path="/public/*" Component={PublicRoot} />
{/* By default, redirect to dashboard */}
<Route
path="/*"
element={<Navigate to="/dashboard" replace={true} />}
/>
</Routes>
</Suspense>
</RedirectManager>
</AuthBoundaryComponent>
</CompatRouter>
<AuthBoundaryComponent>
<RedirectManager>
<Suspense fallback={<Loader />}>
<Routes>
<Route path="/dashboard/*" Component={PrivateRoot} />
<Route path="/public/*" Component={PublicRoot} />
{/* By default, redirect to dashboard */}
<Route
path="/*"
element={<Navigate to="/dashboard" replace={true} />}
/>
</Routes>
</Suspense>
</RedirectManager>
</AuthBoundaryComponent>
</BrowserRouter>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import Dialog from '@mui/material/Dialog';
import Tooltip from '@mui/material/Tooltip';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import ToggleButton from '@mui/material/ToggleButton';
import { withRouter } from 'react-router-dom';
import IconButton from '@mui/material/IconButton';
import themeLight from './ThemeLight';
import themeDark from './ThemeDark';
import { commitLocalUpdate } from '../relay/environment';
import { exportImage, exportPdf } from '../utils/Image';
import inject18n from './i18n';
import Loader from './Loader';
import withRouter from '../utils/compat-router/withRouter';

const styles = () => ({
exportButtons: {
Expand Down Expand Up @@ -169,7 +169,7 @@ class ExportButtons extends Component {
handleDownloadAsStixReport,
handleExportDashboard,
investigationAddFromContainer,
history,
navigate,
handleDashboardDuplication,
variant,
} = this.props;
Expand Down Expand Up @@ -220,7 +220,7 @@ class ExportButtons extends Component {
onClick={investigationAddFromContainer.bind(
this,
containerId,
history,
navigate,
)}
>
<ExploreOutlined fontSize="small" color="primary" />
Expand Down
27 changes: 0 additions & 27 deletions opencti-platform/opencti-front/src/components/RedirectManager.js

This file was deleted.

14 changes: 14 additions & 0 deletions opencti-platform/opencti-front/src/components/RedirectManager.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { MESSAGING$ } from '../relay/environment';

export const RedirectManager = (props) => {
const navigate = useNavigate();
MESSAGING$.redirect.subscribe({
next: (url) => navigate(url),
});

return <>{props.children}</>;
};

export default RedirectManager;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TextField from '@mui/material/TextField';
import InputAdornment from '@mui/material/InputAdornment';
import { BiotechOutlined, ContentPasteSearchOutlined, Search } from '@mui/icons-material';
import IconButton from '@mui/material/IconButton';
import { Link, useLocation } from 'react-router-dom-v5-compat';
import { Link, useLocation } from 'react-router-dom';
import makeStyles from '@mui/styles/makeStyles';
import Tooltip from '@mui/material/Tooltip';
import { useFormatter } from './i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import MuiSwitch from '@mui/material/Switch';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormGroup from '@mui/material/FormGroup';
import FormHelperText from '@mui/material/FormHelperText';
import { fieldToSwitch } from 'formik-mui';
import Tooltip from '@mui/material/Tooltip';
import { InformationOutline } from 'mdi-material-ui';
import { fieldToSwitch } from 'formik-mui';
import { useFormatter } from './i18n';

const SwitchField = (props) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Chart from '@components/common/charts/Chart';
import React from 'react';
import { useTheme } from '@mui/styles';
import { useNavigate } from 'react-router-dom-v5-compat';
import { useNavigate } from 'react-router-dom';
import { ApexOptions } from 'apexcharts';
import { horizontalBarsChartOptions } from '../../utils/Charts';
import { simpleNumberFormat } from '../../utils/Number';
Expand Down
100 changes: 42 additions & 58 deletions opencti-platform/opencti-front/src/private/Index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Suspense, lazy, useEffect } from 'react';
import { Route, Switch } from 'react-router-dom';
import { Route, Routes } from 'react-router-dom';
import Box from '@mui/material/Box';
import CssBaseline from '@mui/material/CssBaseline';
import { useTheme, makeStyles } from '@mui/styles';
import { BoundaryRoute, NoMatch } from '@components/Error';
import { boundaryWrapper, NoMatch } from '@components/Error';
import PlatformCriticalAlertDialog from '@components/settings/platform_alerts/PlatformCriticalAlertDialog';
import TopBar from './components/nav/TopBar';
import LeftBar from './components/nav/LeftBar';
Expand All @@ -24,6 +24,7 @@ const RootAnalyses = lazy(() => import('./components/analyses/Root'));
const RootCases = lazy(() => import('./components/cases/Root'));
const RootEvents = lazy(() => import('./components/events/Root'));
const RootObservations = lazy(() => import('./components/observations/Root'));
const RootProfile = lazy(() => import('./components/profile/Root'));
const RootThreats = lazy(() => import('./components/threats/Root'));
const RootArsenal = lazy(() => import('./components/arsenal/Root'));
const RootTechnique = lazy(() => import('./components/techniques/Root'));
Expand All @@ -32,8 +33,7 @@ const RootLocation = lazy(() => import('./components/locations/Root'));
const RootData = lazy(() => import('./components/data/Root'));
const RootWorkspaces = lazy(() => import('./components/workspaces/Root'));
const RootSettings = lazy(() => import('./components/settings/Root'));
const RootActivity = lazy(() => import('./components/settings/activity/Root'));
const RootProfile = lazy(() => import('./components/profile/Root'));
const RootAudit = lazy(() => import('./components/settings/activity/audit/Root'));

const useStyles = makeStyles((theme: Theme) => ({
toolbar: theme.mixins.toolbar,
Expand Down Expand Up @@ -96,71 +96,55 @@ const Index = ({ settings }: IndexProps) => {
style={{ marginTop: settingsMessagesBannerHeight }}
/>
<Suspense fallback={<Loader />}>
<Switch>
<BoundaryRoute exact path="/dashboard" component={Dashboard} />
<BoundaryRoute exact path="/dashboard/search" component={SearchRoot} />
<BoundaryRoute exact path="/dashboard/search/:scope" component={SearchRoot} />
<BoundaryRoute exact path="/dashboard/search/:scope/:keyword" component={SearchRoot} />
<BoundaryRoute
exact
path="/dashboard/id/:id"
component={StixObjectOrStixRelationship}
/>
<BoundaryRoute
exact
path="/dashboard/search_bulk"
component={SearchBulk}
/>
<BoundaryRoute
path="/dashboard/analyses"
component={RootAnalyses}
<Routes>
<Route path="/" Component={boundaryWrapper(Dashboard)}/>

{/* Search need to be rework */}
<Route path="/search/*" Component={boundaryWrapper(SearchRoot)} />
<Route path="/id/:id" Component={boundaryWrapper(StixObjectOrStixRelationship)} />
<Route path="/search_bulk" Component={boundaryWrapper(SearchBulk)} />
<Route path="/analyses/*" Component={boundaryWrapper(RootAnalyses)} />
<Route path="/cases/*" Component={boundaryWrapper(RootCases)} />
<Route path="/events/*" Component={boundaryWrapper(RootEvents)} />
<Route path="/threats/*" Component={boundaryWrapper(RootThreats)} />
<Route path="/arsenal/*" Component={boundaryWrapper(RootArsenal)} />
<Route path="/techniques/*" Component={boundaryWrapper(RootTechnique)} />
{/* Need to refactor below */}
<Route
path="/entities/*"
Component={boundaryWrapper(RootEntities)}
/>
<BoundaryRoute path="/dashboard/cases" component={RootCases} />
<BoundaryRoute path="/dashboard/events" component={RootEvents} />
<Route
path="/dashboard/observations"
// Because mismatch of types between react-router v5 and v6.
// It uses types of v6, but we are using v5 here and compiler is lost.
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
/* @ts-ignore */
component={RootObservations}
path="/locations/*"
Component={boundaryWrapper(RootLocation)}
/>
<BoundaryRoute path="/dashboard/threats" component={RootThreats} />
<BoundaryRoute path="/dashboard/arsenal" component={RootArsenal} />
<BoundaryRoute
path="/dashboard/techniques"
component={RootTechnique}
<Route path="/data/*"
Component={boundaryWrapper(RootData)}
/>
<BoundaryRoute
path="/dashboard/entities"
component={RootEntities}
<Route
path="/workspaces/*"
Component={boundaryWrapper(RootWorkspaces)}
/>
<BoundaryRoute
path="/dashboard/locations"
component={RootLocation}
<Route
path="/settings/*"
Component={boundaryWrapper(RootSettings)}
/>
<BoundaryRoute path="/dashboard/data" component={RootData} />
<BoundaryRoute
path="/dashboard/workspaces"
component={RootWorkspaces}
<Route
path="/audits/*"
Component={boundaryWrapper(RootAudit)}
/>
<BoundaryRoute
path="/dashboard/settings"
component={RootSettings}
<Route
path="/profile/*"
Component={boundaryWrapper(RootProfile)}
/>
<BoundaryRoute path="/dashboard/audits" component={RootActivity} />
<BoundaryRoute
path="/dashboard/profile"
component={RootProfile}
<Route
path="/observations/*"
Component={boundaryWrapper(RootObservations)}
/>
<Route
// Because mismatch of types between react-router v5 and v6.
// It uses types of v6, but we are using v5 here and compiler is lost.
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
/* @ts-ignore */
component={NoMatch}
element={<NoMatch/>}
/>
</Switch>
</Routes>
</Suspense>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { compose, includes, map } from 'ramda';
import * as PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';
import LoginRoot from '../../public/LoginRoot';
import withRouter from '../../utils/compat-router/withRouter';

class AuthBoundaryComponent extends React.Component {
constructor(props) {
Expand Down