Skip to content

Commit 4eac8c0

Browse files
committed
[frontend] activity menu (#15339)
1 parent 23635a2 commit 4eac8c0

5 files changed

Lines changed: 59 additions & 35 deletions

File tree

opencti-platform/opencti-front/src/private/components/settings/Root.tsx

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ import useSettingsFallbackUrl from '../../../utils/hooks/useSettingsFallbackUrl'
2424
const Security = lazy(() => import('../../../utils/Security'));
2525
const Settings = lazy(() => import('./Settings'));
2626
const FileIndexing = lazy(() => import('./file_indexing/FileIndexing'));
27-
const Audit = lazy(() => import('./activity/audit/Root'));
28-
const Configuration = lazy(() => import('./activity/configuration/Configuration'));
29-
const Alerting = lazy(() => import('./activity/alerting/Alerting'));
3027
const Experience = lazy(() => import('./Experience'));
3128
const RootAccesses = lazy(() => import('./accesses/Root'));
29+
const RootActivity = lazy(() => import('./activity/Root'));
3230
const RootCustomization = lazy(() => import('./customization/Root'));
3331
const RootVocabularies = lazy(() => import('./vocabularies/Root'));
3432

@@ -62,34 +60,10 @@ const Root = () => {
6260
)}
6361
/>
6462
<Route
65-
path="/activity"
63+
path="/activity/*"
6664
element={(
6765
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
68-
<Navigate to="/dashboard/settings/activity/audit" replace={true} />
69-
</Security>
70-
)}
71-
/>
72-
<Route
73-
path="/activity/audit"
74-
element={(
75-
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
76-
<Audit />
77-
</Security>
78-
)}
79-
/>
80-
<Route
81-
path="/activity/configuration"
82-
element={(
83-
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
84-
<Configuration />
85-
</Security>
86-
)}
87-
/>
88-
<Route
89-
path="/activity/alerting"
90-
element={(
91-
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
92-
<Alerting />
66+
<RootActivity />
9367
</Security>
9468
)}
9569
/>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React, { Suspense, lazy } from 'react';
2+
import { Navigate, Route, Routes } from 'react-router-dom';
3+
import Loader from '../../../../components/Loader';
4+
import ActivityMenu from '../ActivityMenu';
5+
import { SETTINGS_SECURITYACTIVITY } from '../../../../utils/hooks/useGranted';
6+
import useSettingsFallbackUrl from '../../../../utils/hooks/useSettingsFallbackUrl';
7+
8+
const Security = lazy(() => import('../../../../utils/Security'));
9+
const Audit = lazy(() => import('./audit/Root'));
10+
const Configuration = lazy(() => import('./configuration/Configuration'));
11+
const Alerting = lazy(() => import('./alerting/Alerting'));
12+
13+
const RootActivity = () => {
14+
const fallbackUrl = useSettingsFallbackUrl();
15+
16+
return (
17+
<>
18+
<ActivityMenu />
19+
<Suspense fallback={<Loader />}>
20+
<Routes>
21+
<Route
22+
path="/"
23+
element={<Navigate to="/dashboard/settings/activity/audit" replace={true} />}
24+
/>
25+
<Route
26+
path="/audit"
27+
element={(
28+
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
29+
<Audit />
30+
</Security>
31+
)}
32+
/>
33+
<Route
34+
path="/configuration"
35+
element={(
36+
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
37+
<Configuration />
38+
</Security>
39+
)}
40+
/>
41+
<Route
42+
path="/alerting"
43+
element={(
44+
<Security needs={[SETTINGS_SECURITYACTIVITY]} placeholder={<Navigate to={fallbackUrl} />}>
45+
<Alerting />
46+
</Security>
47+
)}
48+
/>
49+
</Routes>
50+
</Suspense>
51+
</>
52+
);
53+
};
54+
55+
export default RootActivity;
56+

opencti-platform/opencti-front/src/private/components/settings/activity/alerting/Alerting.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import usePreloadedPaginationFragment from '../../../../../utils/hooks/usePreloa
99
import ListLinesContent from '../../../../../components/list_lines/ListLinesContent';
1010
import { AlertingPaginationQuery, AlertingPaginationQuery$variables } from './__generated__/AlertingPaginationQuery.graphql';
1111
import AlertCreation from './AlertCreation';
12-
import ActivityMenu from '../../ActivityMenu';
1312
import { AlertingLines_data$key } from './__generated__/AlertingLines_data.graphql';
1413
import { AlertingLineComponent, AlertingLineDummy } from './AlertingLine';
1514
import type { Theme } from '../../../../../components/Theme';
@@ -221,7 +220,6 @@ const Alerting: FunctionComponent = () => {
221220

222221
return (
223222
<div className={classes.container} data-testid="alerting-page">
224-
<ActivityMenu />
225223
<Breadcrumbs elements={[{ label: t_i18n('Settings') }, { label: t_i18n('Activity') }, { label: t_i18n('Alerting'), current: true }]} />
226224
{renderLines()}
227225
</div>

opencti-platform/opencti-front/src/private/components/settings/activity/audit/Audit.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import FormControlLabel from '@mui/material/FormControlLabel';
2020
import Alert from '@mui/material/Alert';
2121
import { CSVLink } from 'react-csv';
2222
import { graphql } from 'react-relay';
23-
import ActivityMenu from '../../ActivityMenu';
2423
import type { Theme } from '../../../../../components/Theme';
2524
import ListLines from '../../../../../components/list_lines/ListLines';
2625
import { usePaginationLocalStorage } from '../../../../../utils/hooks/useLocalStorage';
@@ -220,7 +219,6 @@ const Audit = () => {
220219
) : <></>;
221220
return (
222221
<div className={classes.container} data-testid="audit-page">
223-
<ActivityMenu />
224222
<Breadcrumbs elements={[{ label: t_i18n('Settings') }, { label: t_i18n('Activity') }, {
225223
label: t_i18n('Events'),
226224
current: true,

opencti-platform/opencti-front/src/private/components/settings/activity/configuration/Configuration.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import Alert from '@mui/material/Alert';
2828
import { useTheme } from '@mui/styles';
2929
import { ListItemButton } from '@mui/material';
3030
import ListItem from '@mui/material/ListItem';
31-
import ActivityMenu from '../../ActivityMenu';
3231
import type { Theme } from '../../../../../components/Theme';
3332
import { useFormatter } from '../../../../../components/i18n';
3433
import CreatorField from '../../../common/form/CreatorField';
@@ -139,7 +138,6 @@ const ConfigurationComponent: FunctionComponent<
139138
)}
140139
>
141140
<div className={classes.container}>
142-
<ActivityMenu />
143141
<Breadcrumbs elements={[{ label: t_i18n('Settings') }, { label: t_i18n('Activity') }, { label: t_i18n('Configuration'), current: true }]} />
144142
<Grid container={true} spacing={3}>
145143
<Grid item xs={12}>

0 commit comments

Comments
 (0)