From eb0d6aa5e94364dc6e180226ab21c1aafebc2121 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 28 Nov 2024 10:01:55 +0100 Subject: [PATCH] [frontend] Change app routing /exercises to /simulations (#1940) --- openbas-front/src/admin/Index.tsx | 6 +-- .../common/injects/InjectPopover.tsx | 2 +- .../components/challenges/Challenges.js | 2 +- .../components/documents/Documents.js | 2 +- .../src/admin/components/nav/LeftBar.tsx | 4 +- .../scenarios/scenario/ScenarioHeader.tsx | 2 +- .../admin/components/search/useEntityLink.tsx | 2 +- .../components/simulations/ExerciseList.tsx | 2 +- .../simulations/simulation/AnimationMenu.tsx | 16 +++---- .../simulations/simulation/ExerciseContext.ts | 2 +- .../simulation/ExerciseCreation.tsx | 2 +- .../simulations/simulation/ExerciseHeader.tsx | 2 +- .../simulation/ExercisePopover.tsx | 2 +- .../simulations/simulation/Index.tsx | 42 +++++++++---------- .../challenges/ExerciseChallenges.tsx | 2 +- .../simulation/controls/CreateControl.tsx | 4 +- .../definition/ExerciseControlComChecks.tsx | 2 +- .../definition/ExerciseControlDryRuns.tsx | 2 +- .../definition/ExerciseSettings.tsx | 2 +- .../simulation/injects/ExerciseInjects.tsx | 2 +- .../simulation/injects/InjectIndex.tsx | 12 +++--- .../simulation/injects/QuickInject.js | 2 +- .../simulations/simulation/mails/Mails.js | 2 +- .../simulation/overview/Exercise.tsx | 6 +-- .../simulation/reports/ExerciseReportPage.tsx | 2 +- .../simulation/timeline/TimelineOverview.tsx | 2 +- 26 files changed, 64 insertions(+), 64 deletions(-) diff --git a/openbas-front/src/admin/Index.tsx b/openbas-front/src/admin/Index.tsx index ad8730f965..d07f40f3cd 100644 --- a/openbas-front/src/admin/Index.tsx +++ b/openbas-front/src/admin/Index.tsx @@ -94,9 +94,9 @@ const Index = () => { - - - + + + diff --git a/openbas-front/src/admin/components/common/injects/InjectPopover.tsx b/openbas-front/src/admin/components/common/injects/InjectPopover.tsx index 34c35d0d18..881a5c04bc 100644 --- a/openbas-front/src/admin/components/common/injects/InjectPopover.tsx +++ b/openbas-front/src/admin/components/common/injects/InjectPopover.tsx @@ -134,7 +134,7 @@ const InjectPopover: FunctionComponent = ({ testInject(inject.inject_id).then((result: { data: InjectTestStatus }) => { if (isExercise) { MESSAGING$.notifySuccess(t('Inject test has been sent, you can view test logs details on {itsDedicatedPage}.', { - itsDedicatedPage: {t('its dedicated page')}, + itsDedicatedPage: {t('its dedicated page')}, })); } else { MESSAGING$.notifySuccess(t('Inject test has been sent, you can view test logs details on {itsDedicatedPage}.', { diff --git a/openbas-front/src/admin/components/components/challenges/Challenges.js b/openbas-front/src/admin/components/components/challenges/Challenges.js index 6868385b05..7404f03da3 100644 --- a/openbas-front/src/admin/components/components/challenges/Challenges.js +++ b/openbas-front/src/admin/components/components/challenges/Challenges.js @@ -277,7 +277,7 @@ const Challenges = () => { label={exercise.exercise_name} component={Link} clickable={true} - to={`/admin/exercises/${exercise.exercise_id}`} + to={`/admin/simulations/${exercise.exercise_id}`} /> ); diff --git a/openbas-front/src/admin/components/components/documents/Documents.js b/openbas-front/src/admin/components/components/documents/Documents.js index 6717b4dd64..cc15a5e49d 100644 --- a/openbas-front/src/admin/components/components/documents/Documents.js +++ b/openbas-front/src/admin/components/components/documents/Documents.js @@ -224,7 +224,7 @@ const Documents = () => { // prevent parent link from triggering event.stopPropagation(); event.preventDefault(); - navigate(`/admin/exercises/${exercise.exercise_id}`); + navigate(`/admin/simulations/${exercise.exercise_id}`); } } /> diff --git a/openbas-front/src/admin/components/nav/LeftBar.tsx b/openbas-front/src/admin/components/nav/LeftBar.tsx index 020f91db22..7defc6fd74 100644 --- a/openbas-front/src/admin/components/nav/LeftBar.tsx +++ b/openbas-front/src/admin/components/nav/LeftBar.tsx @@ -380,8 +380,8 @@ const LeftBar = () => { diff --git a/openbas-front/src/admin/components/scenarios/scenario/ScenarioHeader.tsx b/openbas-front/src/admin/components/scenarios/scenario/ScenarioHeader.tsx index 37b46c01d5..ed6bbfd17d 100644 --- a/openbas-front/src/admin/components/scenarios/scenario/ScenarioHeader.tsx +++ b/openbas-front/src/admin/components/scenarios/scenario/ScenarioHeader.tsx @@ -183,7 +183,7 @@ const ScenarioHeader = ({ setOpenInstantiateSimulationAndStart(false); const exercise: Exercise = (await createRunningExerciseFromScenario(scenarioId)).data; MESSAGING$.notifySuccess(t('New simulation successfully created and started. Click {here} to view the simulation.', { - here: {t('here')}, + here: {t('here')}, })); }} > diff --git a/openbas-front/src/admin/components/search/useEntityLink.tsx b/openbas-front/src/admin/components/search/useEntityLink.tsx index be70115898..fa6a98e9e5 100644 --- a/openbas-front/src/admin/components/search/useEntityLink.tsx +++ b/openbas-front/src/admin/components/search/useEntityLink.tsx @@ -13,7 +13,7 @@ const useEntityLink = (entity: string, id: string, searchTerm: string) => { case 'Scenario': return `/admin/scenarios/${id}}`; case 'Exercise': - return `/admin/exercises/${id}`; + return `/admin/simulations/${id}`; default: return (''); } diff --git a/openbas-front/src/admin/components/simulations/ExerciseList.tsx b/openbas-front/src/admin/components/simulations/ExerciseList.tsx index cd1f14bcd1..84994782d7 100644 --- a/openbas-front/src/admin/components/simulations/ExerciseList.tsx +++ b/openbas-front/src/admin/components/simulations/ExerciseList.tsx @@ -177,7 +177,7 @@ const ExerciseList: FunctionComponent = ({ diff --git a/openbas-front/src/admin/components/simulations/simulation/AnimationMenu.tsx b/openbas-front/src/admin/components/simulations/simulation/AnimationMenu.tsx index a13aa0d55a..f4f3cebb6b 100644 --- a/openbas-front/src/admin/components/simulations/simulation/AnimationMenu.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/AnimationMenu.tsx @@ -42,10 +42,10 @@ const AnimationMenu: React.FC = ({ exerciseId }) => { @@ -56,9 +56,9 @@ const AnimationMenu: React.FC = ({ exerciseId }) => { @@ -69,10 +69,10 @@ const AnimationMenu: React.FC = ({ exerciseId }) => { @@ -83,10 +83,10 @@ const AnimationMenu: React.FC = ({ exerciseId }) => { diff --git a/openbas-front/src/admin/components/simulations/simulation/ExerciseContext.ts b/openbas-front/src/admin/components/simulations/simulation/ExerciseContext.ts index 939dfb08db..1de9ffa484 100644 --- a/openbas-front/src/admin/components/simulations/simulation/ExerciseContext.ts +++ b/openbas-front/src/admin/components/simulations/simulation/ExerciseContext.ts @@ -65,7 +65,7 @@ const injectContextForExercise = (exercise: ExerciseStore) => { }, bulkTestInjects(injectIds: string[]): Promise<{ uri: string; data: InjectTestStatus[] }> { return bulkTestInjects(injectIds).then(result => ({ - uri: `/admin/exercises/${exercise.exercise_id}/tests`, + uri: `/admin/simulations/${exercise.exercise_id}/tests`, data: result.data, })); }, diff --git a/openbas-front/src/admin/components/simulations/simulation/ExerciseCreation.tsx b/openbas-front/src/admin/components/simulations/simulation/ExerciseCreation.tsx index 4c031545dc..381de6ea71 100644 --- a/openbas-front/src/admin/components/simulations/simulation/ExerciseCreation.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/ExerciseCreation.tsx @@ -21,7 +21,7 @@ const ExerciseCreation = () => { const onSubmit = (data: ExerciseInput) => { dispatch(addExercise(data)).then((result: { result: string; entities: { scenarios: Record } }) => { setOpen(false); - navigate(`/admin/exercises/${result.result}`); + navigate(`/admin/simulations/${result.result}`); }); }; diff --git a/openbas-front/src/admin/components/simulations/simulation/ExerciseHeader.tsx b/openbas-front/src/admin/components/simulations/simulation/ExerciseHeader.tsx index 42f27673de..708f7503b2 100644 --- a/openbas-front/src/admin/components/simulations/simulation/ExerciseHeader.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/ExerciseHeader.tsx @@ -216,7 +216,7 @@ const ExerciseHeader = () => { navigate('/admin/exercises')} + onDelete={() => navigate('/admin/simulations')} />
diff --git a/openbas-front/src/admin/components/simulations/simulation/ExercisePopover.tsx b/openbas-front/src/admin/components/simulations/simulation/ExercisePopover.tsx index 60c24c265e..5c254a7e0f 100644 --- a/openbas-front/src/admin/components/simulations/simulation/ExercisePopover.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/ExercisePopover.tsx @@ -94,7 +94,7 @@ const ExercisePopover: FunctionComponent = ({ const submitDuplicate = () => { dispatch(duplicateExercise(exercise.exercise_id)).then((result: { result: string; entities: { exercises: ExerciseStore } }) => { handleCloseDuplicate(); - navigate(`/admin/exercises/${result.result}`); + navigate(`/admin/simulations/${result.result}`); }); }; diff --git a/openbas-front/src/admin/components/simulations/simulation/Index.tsx b/openbas-front/src/admin/components/simulations/simulation/Index.tsx index 70497002ab..94ebfbe505 100644 --- a/openbas-front/src/admin/components/simulations/simulation/Index.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/Index.tsx @@ -60,14 +60,14 @@ const IndexComponent: FunctionComponent<{ exercise: ExerciseType }> = ({ }), }; let tabValue = location.pathname; - if (location.pathname.includes(`/admin/exercises/${exercise.exercise_id}/definition`)) { - tabValue = `/admin/exercises/${exercise.exercise_id}/definition`; - } else if (location.pathname.includes(`/admin/exercises/${exercise.exercise_id}/animation`)) { - tabValue = `/admin/exercises/${exercise.exercise_id}/animation`; - } else if (location.pathname.includes(`/admin/exercises/${exercise.exercise_id}/results`)) { - tabValue = `/admin/exercises/${exercise.exercise_id}/results`; - } else if (location.pathname.includes(`/admin/exercises/${exercise.exercise_id}/tests`)) { - tabValue = `/admin/exercises/${exercise.exercise_id}/tests`; + if (location.pathname.includes(`/admin/simulations/${exercise.exercise_id}/definition`)) { + tabValue = `/admin/simulations/${exercise.exercise_id}/definition`; + } else if (location.pathname.includes(`/admin/simulations/${exercise.exercise_id}/animation`)) { + tabValue = `/admin/simulations/${exercise.exercise_id}/animation`; + } else if (location.pathname.includes(`/admin/simulations/${exercise.exercise_id}/results`)) { + tabValue = `/admin/simulations/${exercise.exercise_id}/results`; + } else if (location.pathname.includes(`/admin/simulations/${exercise.exercise_id}/tests`)) { + tabValue = `/admin/simulations/${exercise.exercise_id}/tests`; } return ( @@ -76,7 +76,7 @@ const IndexComponent: FunctionComponent<{ exercise: ExerciseType }> = ({ @@ -91,38 +91,38 @@ const IndexComponent: FunctionComponent<{ exercise: ExerciseType }> = ({ diff --git a/openbas-front/src/admin/components/simulations/simulation/challenges/ExerciseChallenges.tsx b/openbas-front/src/admin/components/simulations/simulation/challenges/ExerciseChallenges.tsx index 2bbd944d29..86acf6903b 100644 --- a/openbas-front/src/admin/components/simulations/simulation/challenges/ExerciseChallenges.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/challenges/ExerciseChallenges.tsx @@ -23,7 +23,7 @@ const ExerciseChallenges = () => { }; return ( - + ); }; diff --git a/openbas-front/src/admin/components/simulations/simulation/controls/CreateControl.tsx b/openbas-front/src/admin/components/simulations/simulation/controls/CreateControl.tsx index aba0900c02..a5d2ea3242 100644 --- a/openbas-front/src/admin/components/simulations/simulation/controls/CreateControl.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/controls/CreateControl.tsx @@ -61,7 +61,7 @@ const CreateControl: React.FC = ({ exerciseId, variant }) => { const onSubmitComcheck = async (data: ComcheckInput) => { const result = await dispatch(addComcheck(exerciseId, data)); navigate( - `/admin/exercises/${exerciseId}/controls/comchecks/${result.result}`, + `/admin/simulations/${exerciseId}/controls/comchecks/${result.result}`, ); }; @@ -73,7 +73,7 @@ const CreateControl: React.FC = ({ exerciseId, variant }) => { const result = await dispatch(addDryrun(exerciseId, inputValues)); navigate( - `/admin/exercises/${exerciseId}/controls/dryruns/${result.result}`, + `/admin/simulations/${exerciseId}/controls/dryruns/${result.result}`, ); }; diff --git a/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlComChecks.tsx b/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlComChecks.tsx index cfda536e59..958b942dd5 100644 --- a/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlComChecks.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlComChecks.tsx @@ -72,7 +72,7 @@ const ExerciseControlComChecks: FunctionComponent = ({ classes={{ root: classes.item }} divider component={Link} - to={`/admin/exercises/${exercise.exercise_id}/controls/comchecks/${comcheck.comcheck_id}`} + to={`/admin/simulations/${exercise.exercise_id}/controls/comchecks/${comcheck.comcheck_id}`} > diff --git a/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlDryRuns.tsx b/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlDryRuns.tsx index 934f1d752c..8cbcab2118 100644 --- a/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlDryRuns.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseControlDryRuns.tsx @@ -72,7 +72,7 @@ const ExerciseControlDryRuns: FunctionComponent = ({ classes={{ root: classes.item }} divider component={Link} - to={`/admin/exercises/${exercise.exercise_id}/controls/dryruns/${dryrun.dryrun_id}`} + to={`/admin/simulations/${exercise.exercise_id}/controls/dryruns/${dryrun.dryrun_id}`} > diff --git a/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseSettings.tsx b/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseSettings.tsx index 1982f78797..b582aa8175 100644 --- a/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseSettings.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/definition/ExerciseSettings.tsx @@ -61,7 +61,7 @@ const ExerciseSettings = () => { return ( <> - + } number={exercise.exercise_users_number ?? '-'} /> diff --git a/openbas-front/src/admin/components/simulations/simulation/injects/ExerciseInjects.tsx b/openbas-front/src/admin/components/simulations/simulation/injects/ExerciseInjects.tsx index 74af0a9e7b..d88c915632 100644 --- a/openbas-front/src/admin/components/simulations/simulation/injects/ExerciseInjects.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/injects/ExerciseInjects.tsx @@ -91,7 +91,7 @@ const ExerciseInjects: FunctionComponent = () => { teams={teams} articles={articles} variables={variables} - uriVariable={`/admin/exercises/${exerciseId}/definition`} + uriVariable={`/admin/simulations/${exerciseId}/definition`} allUsersNumber={exercise.exercise_all_users_number} usersNumber={exercise.exercise_users_number} // @ts-expect-error typing diff --git a/openbas-front/src/admin/components/simulations/simulation/injects/InjectIndex.tsx b/openbas-front/src/admin/components/simulations/simulation/injects/InjectIndex.tsx index 288b43e1bb..0a97e21571 100644 --- a/openbas-front/src/admin/components/simulations/simulation/injects/InjectIndex.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/injects/InjectIndex.tsx @@ -60,8 +60,8 @@ const InjectIndexComponent: FunctionComponent<{ exercise: ExerciseType; injectRe }; const breadcrumbs: BreadcrumbsElement[] = [ - { label: t('Simulations'), link: '/admin/exercises' }, - { label: t(exercise.exercise_name), link: `/admin/exercises/${exercise.exercise_id}` }, + { label: t('Simulations'), link: '/admin/simulations' }, + { label: t(exercise.exercise_name), link: `/admin/simulations/${exercise.exercise_id}` }, ]; if (backlabel && backuri) { breadcrumbs.push({ label: backlabel, link: backuri }); @@ -84,15 +84,15 @@ const InjectIndexComponent: FunctionComponent<{ exercise: ExerciseType; injectRe diff --git a/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js b/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js index 417c570558..93a9721753 100644 --- a/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js +++ b/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js @@ -1426,7 +1426,7 @@ class QuickInject extends Component {
{ diff --git a/openbas-front/src/admin/components/simulations/simulation/overview/Exercise.tsx b/openbas-front/src/admin/components/simulations/simulation/overview/Exercise.tsx index 6d48b4eab7..a4d8385421 100644 --- a/openbas-front/src/admin/components/simulations/simulation/overview/Exercise.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/overview/Exercise.tsx @@ -51,7 +51,7 @@ const Exercise = () => { fetchExerciseExpectationResult(exerciseId).then((result: { data: ExpectationResultsByType[] }) => setResults(result.data)); fetchExerciseInjectExpectationResults(exerciseId).then((result: { data: InjectExpectationResultsByAttackPatternStore[] }) => setInjectResults(result.data)); }, [exerciseId]); - const goToLink = `/admin/exercises/${exerciseId}/injects`; + const goToLink = `/admin/simulations/${exerciseId}/injects`; let resultAttackPatternIds = []; if (injectResults) { resultAttackPatternIds = R.uniq( @@ -93,7 +93,7 @@ const Exercise = () => { {!results ? - : } + : } {injectResults && resultAttackPatternIds.length > 0 && ( @@ -114,7 +114,7 @@ const Exercise = () => { searchExerciseInjects(exerciseId, input)} - goTo={injectId => `/admin/exercises/${exerciseId}/injects/${injectId}`} + goTo={injectId => `/admin/simulations/${exerciseId}/injects/${injectId}`} queryableHelpers={queryableHelpers} searchPaginationInput={searchPaginationInput} /> diff --git a/openbas-front/src/admin/components/simulations/simulation/reports/ExerciseReportPage.tsx b/openbas-front/src/admin/components/simulations/simulation/reports/ExerciseReportPage.tsx index 8c22a7ac7e..45f4f2aef2 100644 --- a/openbas-front/src/admin/components/simulations/simulation/reports/ExerciseReportPage.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/reports/ExerciseReportPage.tsx @@ -81,7 +81,7 @@ const ExerciseReportPage: React.FC = () => { color="primary" variant="outlined" component={Link} - to={`/admin/exercises/${exerciseId}`} + to={`/admin/simulations/${exerciseId}`} > {t('Back to administration')} diff --git a/openbas-front/src/admin/components/simulations/simulation/timeline/TimelineOverview.tsx b/openbas-front/src/admin/components/simulations/simulation/timeline/TimelineOverview.tsx index a3e1c21669..58fa02f4a3 100644 --- a/openbas-front/src/admin/components/simulations/simulation/timeline/TimelineOverview.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/timeline/TimelineOverview.tsx @@ -240,7 +240,7 @@ const TimelineOverview = () => { classes={{ root: classes.item }} divider component={Link} - to={`/admin/exercises/${exerciseId}/injects/${inject.inject_id}?backlabel=Animation&backuri=/admin/exercises/${exerciseId}/animation/timeline`} + to={`/admin/simulations/${exerciseId}/injects/${inject.inject_id}?backlabel=Animation&backuri=/admin/simulations/${exerciseId}/animation/timeline`} >