diff --git a/openbas-front/src/admin/components/common/injects/InjectAddTeams.tsx b/openbas-front/src/admin/components/common/injects/InjectAddTeams.tsx index 8d86342fa1..5cba04ff81 100644 --- a/openbas-front/src/admin/components/common/injects/InjectAddTeams.tsx +++ b/openbas-front/src/admin/components/common/injects/InjectAddTeams.tsx @@ -13,7 +13,8 @@ import { import { makeStyles } from '@mui/styles'; import { FunctionComponent, useContext, useEffect, useMemo, useState } from 'react'; -import { findTeams } from '../../../../actions/teams/team-actions'; +import { fetchTeams, findTeams } from '../../../../actions/teams/team-actions'; +import { TeamsHelper } from '../../../../actions/teams/team-helper'; import PaginationComponentV2 from '../../../../components/common/queryable/pagination/PaginationComponentV2'; import { buildSearchPagination } from '../../../../components/common/queryable/QueryableUtils'; import { useQueryable } from '../../../../components/common/queryable/useQueryableWithLocalStorage'; @@ -22,14 +23,12 @@ import Transition from '../../../../components/common/Transition'; import { useFormatter } from '../../../../components/i18n'; import ItemTags from '../../../../components/ItemTags'; import type { Theme } from '../../../../components/Theme'; +import { useHelper } from '../../../../store'; import type { TeamOutput } from '../../../../utils/api-types'; +import { useAppDispatch } from '../../../../utils/hooks'; +import useDataLoader from '../../../../utils/hooks/useDataLoader'; import CreateTeam from '../../components/teams/CreateTeam'; import { PermissionsContext, TeamContext } from '../Context'; -import { useAppDispatch } from '../../../../utils/hooks'; -import { fetchTeams } from '../../../../actions/teams/team-actions'; -import {useHelper} from "../../../../store"; -import {TeamsHelper} from "../../../../actions/teams/team-helper"; -import useDataLoader from "../../../../utils/hooks/useDataLoader"; const useStyles = makeStyles((theme: Theme) => ({ item: { @@ -55,7 +54,7 @@ const InjectAddTeams: FunctionComponent = ({ availableTeamIds, }) => { // Standard hooks - const dispatch = useAppDispatch() + const dispatch = useAppDispatch(); const { t } = useFormatter(); const classes = useStyles(); const { permissions } = useContext(PermissionsContext); @@ -64,7 +63,6 @@ const InjectAddTeams: FunctionComponent = ({ const [teamValues, setTeamValues] = useState([]); const [selectedTeamValues, setSelectedTeamValues] = useState([]); - console.log("availableTeamIds = {}", availableTeamIds) const allTeams = useHelper((helper: TeamsHelper) => helper.getTeams().filter(t => availableTeamIds.length > 0 ? availableTeamIds.includes(t.team_id) : true)); useDataLoader(() => { dispatch(fetchTeams()).finally(() => { diff --git a/openbas-front/src/admin/components/common/injects/UpdateInject.tsx b/openbas-front/src/admin/components/common/injects/UpdateInject.tsx index bb2294286e..9fd3f83a3c 100644 --- a/openbas-front/src/admin/components/common/injects/UpdateInject.tsx +++ b/openbas-front/src/admin/components/common/injects/UpdateInject.tsx @@ -2,6 +2,8 @@ import { Tab, Tabs } from '@mui/material'; import * as React from 'react'; import { useEffect, useRef, useState } from 'react'; +import { fetchExercise } from '../../../../actions/Exercise'; +import { ExercisesHelper } from '../../../../actions/exercises/exercise-helper'; import { fetchInject } from '../../../../actions/Inject'; import type { InjectOutputType } from '../../../../actions/injects/Inject'; import type { InjectHelper } from '../../../../actions/injects/inject-helper'; @@ -13,8 +15,6 @@ import { useAppDispatch } from '../../../../utils/hooks'; import useDataLoader from '../../../../utils/hooks/useDataLoader'; import UpdateInjectDetails from './UpdateInjectDetails'; import UpdateInjectLogicalChains from './UpdateInjectLogicalChains'; -import {ExercisesHelper} from "../../../../actions/exercises/exercise-helper"; -import {fetchExercise} from "../../../../actions/Exercise"; interface Props { open: boolean; @@ -60,9 +60,9 @@ const UpdateInject: React.FC = ({ open, handleClose, onUpdateInject, mass inject: helper.getInject(injectId), })); const { simulation } = useHelper((helper: ExercisesHelper) => ({ - simulation: helper.getExercise(inject.inject_exercise) + simulation: helper.getExercise(inject.inject_exercise), })); - const availableTeamIds = simulation?.exercise_teams || [] + const availableTeamIds = simulation?.exercise_teams || []; useDataLoader(() => { setIsInjectLoading(true);