From 29266ced9b5cb4f1791a5a9ac33d0b3eb0504d4a Mon Sep 17 00:00:00 2001 From: Marine LM Date: Tue, 17 Dec 2024 10:02:22 +0100 Subject: [PATCH] [frontend] replace deprecated ListItemSecondaryAction component Signed-off-by: Marine LM --- .../lessons/exercises/LessonsObjectives.js | 84 ++++---- .../lessons/scenarios/LessonsObjectives.js | 85 ++++---- .../simulation/timeline/TimelineOverview.tsx | 195 +++++++++--------- 3 files changed, 184 insertions(+), 180 deletions(-) diff --git a/openbas-front/src/admin/components/lessons/exercises/LessonsObjectives.js b/openbas-front/src/admin/components/lessons/exercises/LessonsObjectives.js index be2c2cb0f2..3ef226067c 100644 --- a/openbas-front/src/admin/components/lessons/exercises/LessonsObjectives.js +++ b/openbas-front/src/admin/components/lessons/exercises/LessonsObjectives.js @@ -4,9 +4,9 @@ import { Grid, LinearProgress, List, + ListItem, ListItemButton, ListItemIcon, - ListItemSecondaryAction, ListItemText, Paper, Typography, @@ -84,50 +84,52 @@ const LessonsObjectives = ({ {sortedObjectives.length > 0 ? ( {sortedObjectives.map(objective => ( - setSelectedObjective - && setSelectedObjective(objective.objective_id)} + secondaryAction={!isReport && ( + + )} > - - - - - setSelectedObjective + && setSelectedObjective(objective.objective_id)} > - - - - - - {objective.objective_score} - % - + + + + + + + + + + + {objective.objective_score} + % + + - - {!isReport && ( - - - - )} - + + + ))} ) : ( diff --git a/openbas-front/src/admin/components/lessons/scenarios/LessonsObjectives.js b/openbas-front/src/admin/components/lessons/scenarios/LessonsObjectives.js index 3fa790b3da..101dd28c0c 100644 --- a/openbas-front/src/admin/components/lessons/scenarios/LessonsObjectives.js +++ b/openbas-front/src/admin/components/lessons/scenarios/LessonsObjectives.js @@ -3,10 +3,9 @@ import { Box, Grid, LinearProgress, - List, + List, ListItem, ListItemButton, ListItemIcon, - ListItemSecondaryAction, ListItemText, Paper, Typography, @@ -53,50 +52,52 @@ const LessonsObjectives = ({ {sortedObjectives.length > 0 ? ( {sortedObjectives.map(objective => ( - setSelectedObjective - && setSelectedObjective(objective.objective_id)} + secondaryAction={!isReport && ( + + )} > - - - - - setSelectedObjective + && setSelectedObjective(objective.objective_id)} > - - - - - - {objective.objective_score} - % - + + + + + + + + + + + {objective.objective_score} + % + + - - {!isReport && ( - - - - )} - + + + ))} ) : ( 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 e120590f15..d4b153e582 100644 --- a/openbas-front/src/admin/components/simulations/simulation/timeline/TimelineOverview.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/timeline/TimelineOverview.tsx @@ -2,9 +2,9 @@ import { PreviewOutlined } from '@mui/icons-material'; import { Grid, List, + ListItem, ListItemButton, ListItemIcon, - ListItemSecondaryAction, ListItemText, Paper, Typography, @@ -157,13 +157,93 @@ const TimelineOverview = () => { {pendingInjects.map((inject: InjectStore) => { const isDisabled = !inject.inject_injector_contract.injector_contract_content_parsed?.config.expose; return ( - + )} + > + setSelectedInjectId(inject.inject_id)} + > + + + + +
+ {inject.inject_title} +
+
+ +
+
+ {fndt(inject.inject_date)} +
+ + )} + /> +
+ + ); + })} + + ) : ( + + )} + + + + {t('Processed injects')} + + {processedInjects.length > 0 ? ( + + {processedInjects.map((inject: InjectStore) => ( + }> + setSelectedInjectId(inject.inject_id)} + component={Link} + to={`/admin/simulations/${exerciseId}/injects/${inject.inject_id}?backlabel=Animation&backuri=/admin/simulations/${exerciseId}/animation/timeline`} > {
{inject.inject_title}
@@ -190,12 +270,11 @@ const TimelineOverview = () => { className={classes.bodyItem} style={{ width: '20%' }} > -
{ fontSize: 12, }} > - {fndt(inject.inject_date)} + {fndt(inject.inject_status?.tracking_sent_date)} + {' '} + { + inject.inject_status && inject.inject_status.tracking_total_execution_time + && (inject.inject_status.tracking_total_execution_time / 1000).toFixed(2) + } + {t('s')}
)} /> - - -
- ); - })} -
- ) : ( - - )} -
-
- - {t('Processed injects')} - - {processedInjects.length > 0 ? ( - - {processedInjects.map((inject: InjectStore) => ( - - - - - -
- {inject.inject_title} -
-
- -
-
- {fndt(inject.inject_status?.tracking_sent_date)} - {' '} - { - inject.inject_status && inject.inject_status.tracking_total_execution_time - && (inject.inject_status.tracking_total_execution_time / 1000).toFixed(2) - } - {t('s')} -
- - )} - /> - - - -
+ ))}
) : (