diff --git a/openbas-api/src/main/java/io/openbas/injectors/channel/ChannelExecutor.java b/openbas-api/src/main/java/io/openbas/injectors/channel/ChannelExecutor.java index aa700c10d3..f396e7ad55 100644 --- a/openbas-api/src/main/java/io/openbas/injectors/channel/ChannelExecutor.java +++ b/openbas-api/src/main/java/io/openbas/injectors/channel/ChannelExecutor.java @@ -95,7 +95,7 @@ public ExecutionProcess process(@NotNull final Execution execution, @NotNull fin boolean encrypted = content.isEncrypted(); users.forEach(userInjectContext -> { try { - // Put the challenges variables in the injection context + // Put the articles variables in the injection context List articleVariables = articles.stream() .map(article -> new ArticleVariable(article.getId(), article.getName(), buildArticleUri(userInjectContext, article))) diff --git a/openbas-front/src/admin/components/common/injects/UpdateInjectDetails.js b/openbas-front/src/admin/components/common/injects/UpdateInjectDetails.js index 8d6656ad9e..ecf2905511 100644 --- a/openbas-front/src/admin/components/common/injects/UpdateInjectDetails.js +++ b/openbas-front/src/admin/components/common/injects/UpdateInjectDetails.js @@ -162,15 +162,9 @@ const UpdateInjectDetails = ({ && data[field.key] && data[field.key].length > 0 ) { + const regex = /<#list\s+(\w+)\s+as\s+(\w+)>/g; finalData[field.key] = data[field.key] - .replaceAll( - '<#list challenges as challenge>', - '<#list challenges as challenge>', - ) - .replaceAll( - '<#list articles as article>', - '<#list articles as article>', - ) + .replace(regex, (_, listName, identifier) => `<#list ${listName} as ${identifier}>`) .replaceAll('</#list>', ''); } else if (data[field.key] && field.type === 'tuple') { if (field.cardinality && field.cardinality === '1') { diff --git a/openbas-front/src/admin/components/scenarios/scenario/injects/ScenarioInjects.tsx b/openbas-front/src/admin/components/scenarios/scenario/injects/ScenarioInjects.tsx index 9eae25a81d..9719b55d95 100644 --- a/openbas-front/src/admin/components/scenarios/scenario/injects/ScenarioInjects.tsx +++ b/openbas-front/src/admin/components/scenarios/scenario/injects/ScenarioInjects.tsx @@ -68,7 +68,7 @@ const ScenarioInjects: FunctionComponent = () => { teams={teams} articles={articles} variables={variables} - uriVariable={`/admin/scenarios/${scenarioId}/definition/variables`} + uriVariable={`/admin/scenarios/${scenarioId}/definition`} allUsersNumber={scenario.scenario_all_users_number} usersNumber={scenario.scenario_users_number} // @ts-expect-error typing 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 34c225dcc5..4ba4819b64 100644 --- a/openbas-front/src/admin/components/simulations/simulation/injects/ExerciseInjects.tsx +++ b/openbas-front/src/admin/components/simulations/simulation/injects/ExerciseInjects.tsx @@ -94,7 +94,7 @@ const ExerciseInjects: FunctionComponent = () => { teams={teams} articles={articles} variables={variables} - uriVariable={`/admin/exercises/${exerciseId}/definition/variables`} + uriVariable={`/admin/exercises/${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/QuickInject.js b/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js index f6dde338b9..2abb7db439 100644 --- a/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js +++ b/openbas-front/src/admin/components/simulations/simulation/injects/QuickInject.js @@ -1417,7 +1417,7 @@ class QuickInject extends Component { - + />} - + > {t('Please follow this link to')} {/* TODO: validate when migrate to new react router version */} @@ -193,7 +193,7 @@ AvailableVariablesDialogProps ))} - + }