diff --git a/installer b/installer index eda9075b77..118c9c5d85 160000 --- a/installer +++ b/installer @@ -1 +1 @@ -Subproject commit eda9075b7798827a5679f4aeca6fc27f8e520159 +Subproject commit 118c9c5d85a0b7b0d47e6b899c7c4ed15caaa7bd diff --git a/webapp/.eslintrc.cjs b/webapp/.eslintrc.cjs index 41f556763a..6d533115a2 100644 --- a/webapp/.eslintrc.cjs +++ b/webapp/.eslintrc.cjs @@ -105,6 +105,5 @@ module.exports = { ], }, ], - "simple-import-sort/exports": "error", }, }; diff --git a/webapp/package.json b/webapp/package.json index ba123ba575..557734a601 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -9,6 +9,7 @@ "coverage": "vitest run --coverage", "dev": "vite", "lint": "tsc --noEmit && eslint . --ext ts,tsx --report-unused-disable-directives", + "lint:fix": "eslint . --fix", "preview": "vite preview", "test": "vitest", "test:ui": "vitest --ui" diff --git a/webapp/src/components/App/Api.tsx b/webapp/src/components/App/Api.tsx index 8cc4c8ca7c..e642c3c65f 100644 --- a/webapp/src/components/App/Api.tsx +++ b/webapp/src/components/App/Api.tsx @@ -12,11 +12,14 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; import SwaggerUI from "swagger-ui-react"; -import "swagger-ui-react/swagger-ui.css"; + +import { Box } from "@mui/material"; + import { getConfig } from "@/services/config"; +import "swagger-ui-react/swagger-ui.css"; + function Api() { return ( void; diff --git a/webapp/src/components/App/Settings/Groups/dialog/CreateGroupDialog.tsx b/webapp/src/components/App/Settings/Groups/dialog/CreateGroupDialog.tsx index ca68f3a900..1d45634202 100644 --- a/webapp/src/components/App/Settings/Groups/dialog/CreateGroupDialog.tsx +++ b/webapp/src/components/App/Settings/Groups/dialog/CreateGroupDialog.tsx @@ -12,20 +12,23 @@ * This file is part of the Antares project. */ -import GroupAddIcon from "@mui/icons-material/GroupAdd"; import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; import { usePromise as usePromiseWrapper } from "react-use"; + +import GroupAddIcon from "@mui/icons-material/GroupAdd"; + import { GroupDetailsDTO, GroupDTO, RoleDetailsDTO, UserDTO, } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createGroup, createRole } from "@/services/api/user"; + import GroupFormDialog, { GroupFormDialogProps } from "./GroupFormDialog"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; type InheritPropsToOmit = "title" | "titleIcon" | "onSubmit" | "onCancel"; diff --git a/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/GroupForm.tsx b/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/GroupForm.tsx index fe9bcbfdf4..22f67d868e 100644 --- a/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/GroupForm.tsx +++ b/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/GroupForm.tsx @@ -12,44 +12,46 @@ * This file is part of the Antares project. */ -import { useTranslation } from "react-i18next"; import { useMemo, useRef, useState } from "react"; +import { Controller, useFieldArray } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { v4 as uuidv4 } from "uuid"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import GroupIcon from "@mui/icons-material/Group"; import { - TextField, - Typography, - Paper, - Select, - MenuItem, Box, Button, - InputLabel, + CircularProgress, FormControl, - ListItem, IconButton, + InputLabel, List, + ListItem, ListItemButton, ListItemIcon, ListItemText, - CircularProgress, + MenuItem, + Paper, + Select, SelectChangeEvent, + TextField, + Typography, } from "@mui/material"; -import { Controller, useFieldArray } from "react-hook-form"; -import { v4 as uuidv4 } from "uuid"; -import DeleteIcon from "@mui/icons-material/Delete"; -import GroupIcon from "@mui/icons-material/Group"; -import { RoleType, UserDTO } from "@/common/types"; -import { roleToString, sortByName } from "@/services/utils"; -import usePromise from "@/hooks/usePromise"; -import { getGroups, getUsers } from "@/services/api/user"; -import { getAuthUser } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { validateString } from "@/utils/validation/string"; -import { UseFormReturnPlus } from "@/components/common/Form/types"; + import { RESERVED_GROUP_NAMES, RESERVED_USER_NAMES, ROLE_TYPE_KEYS, } from "@/common/contants"; +import { RoleType, UserDTO } from "@/common/types"; +import { UseFormReturnPlus } from "@/components/common/Form/types"; +import usePromise from "@/hooks/usePromise"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getAuthUser } from "@/redux/selectors"; +import { getGroups, getUsers } from "@/services/api/user"; +import { roleToString, sortByName } from "@/services/utils"; +import { validateString } from "@/utils/validation/string"; function GroupForm(props: UseFormReturnPlus) { const { diff --git a/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/index.tsx b/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/index.tsx index 32d2468144..79c1e35206 100644 --- a/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/index.tsx +++ b/webapp/src/components/App/Settings/Groups/dialog/GroupFormDialog/index.tsx @@ -12,10 +12,11 @@ * This file is part of the Antares project. */ +import { RoleType, UserDTO } from "@/common/types"; import FormDialog, { FormDialogProps, } from "@/components/common/dialogs/FormDialog"; -import { RoleType, UserDTO } from "@/common/types"; + import GroupForm from "./GroupForm"; export interface GroupFormDialogProps diff --git a/webapp/src/components/App/Settings/Groups/dialog/UpdateGroupDialog.tsx b/webapp/src/components/App/Settings/Groups/dialog/UpdateGroupDialog.tsx index a3a95a0688..870e880e2b 100644 --- a/webapp/src/components/App/Settings/Groups/dialog/UpdateGroupDialog.tsx +++ b/webapp/src/components/App/Settings/Groups/dialog/UpdateGroupDialog.tsx @@ -12,23 +12,27 @@ * This file is part of the Antares project. */ -import EditIcon from "@mui/icons-material/Edit"; import { useMemo } from "react"; -import { useTranslation } from "react-i18next"; -import { usePromise as usePromiseWrapper } from "react-use"; import { useSnackbar } from "notistack"; import * as R from "ramda"; +import { useTranslation } from "react-i18next"; +import { usePromise as usePromiseWrapper } from "react-use"; + +import EditIcon from "@mui/icons-material/Edit"; + import { GroupDetailsDTO } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createRole, deleteUserRole, getRolesForGroup, updateGroup, } from "@/services/api/user"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import GroupFormDialog, { GroupFormDialogProps } from "./GroupFormDialog"; + import { GroupEdit } from ".."; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; + +import GroupFormDialog, { GroupFormDialogProps } from "./GroupFormDialog"; type InheritPropsToOmit = | "title" diff --git a/webapp/src/components/App/Settings/Groups/index.tsx b/webapp/src/components/App/Settings/Groups/index.tsx index 063286e1d1..14378bba47 100644 --- a/webapp/src/components/App/Settings/Groups/index.tsx +++ b/webapp/src/components/App/Settings/Groups/index.tsx @@ -12,6 +12,17 @@ * This file is part of the Antares project. */ +import { ReactNode, useMemo, useReducer, useState } from "react"; +import { produce } from "immer"; +import { useSnackbar } from "notistack"; +import * as R from "ramda"; +import { useTranslation } from "react-i18next"; +import { usePromise as usePromiseWrapper, useUpdateEffect } from "react-use"; +import { Action } from "redux"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import EditIcon from "@mui/icons-material/Edit"; +import GroupIcon from "@mui/icons-material/Group"; import { Box, CircularProgress, @@ -24,28 +35,20 @@ import { Skeleton, Typography, } from "@mui/material"; -import { produce } from "immer"; -import { ReactNode, useMemo, useReducer, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { usePromise as usePromiseWrapper, useUpdateEffect } from "react-use"; -import { Action } from "redux"; -import DeleteIcon from "@mui/icons-material/Delete"; -import EditIcon from "@mui/icons-material/Edit"; -import * as R from "ramda"; -import GroupIcon from "@mui/icons-material/Group"; -import { useSnackbar } from "notistack"; + +import { RESERVED_GROUP_NAMES } from "@/common/contants"; import { GroupDetailsDTO } from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getAuthUser } from "@/redux/selectors"; import { deleteGroup, getGroups } from "@/services/api/user"; import { sortByName } from "@/services/utils"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import Header from "./Header"; -import UpdateGroupDialog from "./dialog/UpdateGroupDialog"; -import { getAuthUser } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; import { isSearchMatching } from "@/utils/stringUtils"; -import { RESERVED_GROUP_NAMES } from "@/common/contants"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; + +import UpdateGroupDialog from "./dialog/UpdateGroupDialog"; +import Header from "./Header"; enum GroupActionKind { ADD = "ADD", diff --git a/webapp/src/components/App/Settings/Maintenance/index.tsx b/webapp/src/components/App/Settings/Maintenance/index.tsx index 877df2228c..dfdbf35fb3 100644 --- a/webapp/src/components/App/Settings/Maintenance/index.tsx +++ b/webapp/src/components/App/Settings/Maintenance/index.tsx @@ -12,6 +12,12 @@ * This file is part of the Antares project. */ +import { useState } from "react"; +import { useSnackbar } from "notistack"; +import { Controller, FieldValues, useForm } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { useUpdateEffect } from "react-use"; + import { Backdrop, Box, @@ -22,11 +28,8 @@ import { TextField, Typography, } from "@mui/material"; -import { useSnackbar } from "notistack"; -import { useState } from "react"; -import { Controller, FieldValues, useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { useUpdateEffect } from "react-use"; + +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { @@ -35,7 +38,6 @@ import { updateMaintenanceMode, updateMessageInfo, } from "@/services/api/maintenance"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; function Maintenance() { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Settings/Tokens/Header.tsx b/webapp/src/components/App/Settings/Tokens/Header.tsx index f73721b2d3..e728c4b77b 100644 --- a/webapp/src/components/App/Settings/Tokens/Header.tsx +++ b/webapp/src/components/App/Settings/Tokens/Header.tsx @@ -12,14 +12,17 @@ * This file is part of the Antares project. */ -import { Box, Button } from "@mui/material"; -import TokenIcon from "@mui/icons-material/Token"; -import { useTranslation } from "react-i18next"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; + +import TokenIcon from "@mui/icons-material/Token"; +import { Box, Button } from "@mui/material"; + import { BotDTO } from "@/common/types"; -import CreateTokenDialog from "./dialog/CreateTokenDialog"; import SearchFE from "@/components/common/fieldEditors/SearchFE"; +import CreateTokenDialog from "./dialog/CreateTokenDialog"; + interface Props { setSearchValue: (v: string) => void; addToken: (user: BotDTO) => void; diff --git a/webapp/src/components/App/Settings/Tokens/dialog/CreateTokenDialog.tsx b/webapp/src/components/App/Settings/Tokens/dialog/CreateTokenDialog.tsx index 80de770739..313dd6b167 100644 --- a/webapp/src/components/App/Settings/Tokens/dialog/CreateTokenDialog.tsx +++ b/webapp/src/components/App/Settings/Tokens/dialog/CreateTokenDialog.tsx @@ -12,19 +12,22 @@ * This file is part of the Antares project. */ -import TokenIcon from "@mui/icons-material/Token"; -import { IconButton, Paper, Tooltip } from "@mui/material"; -import { useSnackbar } from "notistack"; import { useState } from "react"; +import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; import { usePromise as usePromiseWrapper } from "react-use"; + import ContentCopyIcon from "@mui/icons-material/ContentCopy"; +import TokenIcon from "@mui/icons-material/Token"; +import { IconButton, Paper, Tooltip } from "@mui/material"; + import { BotCreateDTO, BotDTO, GroupDTO, RoleType } from "@/common/types"; +import OkDialog from "@/components/common/dialogs/OkDialog"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createBot } from "@/services/api/user"; + import TokenFormDialog, { TokenFormDialogProps } from "./TokenFormDialog"; -import OkDialog from "@/components/common/dialogs/OkDialog"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; type InheritPropsToOmit = "title" | "titleIcon" | "onSubmit" | "onCancel"; diff --git a/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/TokenForm.tsx b/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/TokenForm.tsx index e8fe80c4fe..234bef1aba 100644 --- a/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/TokenForm.tsx +++ b/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/TokenForm.tsx @@ -12,6 +12,13 @@ * This file is part of the Antares project. */ +import { useMemo, useRef, useState } from "react"; +import { Controller, useFieldArray, UseFormReturn } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { v4 as uuidv4 } from "uuid"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import GroupIcon from "@mui/icons-material/Group"; import { Box, Button, @@ -31,20 +38,16 @@ import { TextField, Typography, } from "@mui/material"; -import { useMemo, useRef, useState } from "react"; -import { Controller, useFieldArray, UseFormReturn } from "react-hook-form"; -import { useTranslation } from "react-i18next"; -import { v4 as uuidv4 } from "uuid"; -import DeleteIcon from "@mui/icons-material/Delete"; -import GroupIcon from "@mui/icons-material/Group"; -import { TokenFormDialogProps } from "."; + +import { RESERVED_GROUP_NAMES, ROLE_TYPE_KEYS } from "@/common/contants"; import { GroupDTO, RoleType } from "@/common/types"; import usePromise from "@/hooks/usePromise"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getAuthUser, isAuthUserAdmin } from "@/redux/selectors"; import { getGroups } from "@/services/api/user"; import { roleToString, sortByName } from "@/services/utils"; -import { getAuthUser, isAuthUserAdmin } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { RESERVED_GROUP_NAMES, ROLE_TYPE_KEYS } from "@/common/contants"; + +import { TokenFormDialogProps } from "."; interface Props extends UseFormReturn { onlyPermissions?: TokenFormDialogProps["onlyPermissions"]; diff --git a/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/index.tsx b/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/index.tsx index d800d98544..11b920b991 100644 --- a/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/index.tsx +++ b/webapp/src/components/App/Settings/Tokens/dialog/TokenFormDialog/index.tsx @@ -15,6 +15,7 @@ import FormDialog, { FormDialogProps, } from "@/components/common/dialogs/FormDialog"; + import TokenForm from "./TokenForm"; export interface TokenFormDialogProps diff --git a/webapp/src/components/App/Settings/Tokens/dialog/TokenInfoDialog.tsx b/webapp/src/components/App/Settings/Tokens/dialog/TokenInfoDialog.tsx index 987553669e..6ae2149390 100644 --- a/webapp/src/components/App/Settings/Tokens/dialog/TokenInfoDialog.tsx +++ b/webapp/src/components/App/Settings/Tokens/dialog/TokenInfoDialog.tsx @@ -12,15 +12,18 @@ * This file is part of the Antares project. */ -import { BotDetailsDTO } from "@/common/types"; -import OkDialog, { OkDialogProps } from "@/components/common/dialogs/OkDialog"; -import { DialogContentText } from "@mui/material"; import { useMemo } from "react"; import { FieldValues } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import TokenForm from "./TokenFormDialog/TokenForm"; -import Form from "@/components/common/Form"; + import { Info } from "@mui/icons-material"; +import { DialogContentText } from "@mui/material"; + +import { BotDetailsDTO } from "@/common/types"; +import OkDialog, { OkDialogProps } from "@/components/common/dialogs/OkDialog"; +import Form from "@/components/common/Form"; + +import TokenForm from "./TokenFormDialog/TokenForm"; interface Props extends Omit { token: BotDetailsDTO; diff --git a/webapp/src/components/App/Settings/Tokens/index.tsx b/webapp/src/components/App/Settings/Tokens/index.tsx index 17fcdbcea1..fca8d421ed 100644 --- a/webapp/src/components/App/Settings/Tokens/index.tsx +++ b/webapp/src/components/App/Settings/Tokens/index.tsx @@ -12,6 +12,17 @@ * This file is part of the Antares project. */ +import { ReactNode, useMemo, useReducer, useState } from "react"; +import { produce } from "immer"; +import { useSnackbar } from "notistack"; +import * as R from "ramda"; +import { useTranslation } from "react-i18next"; +import { usePromise as usePromiseWrapper, useUpdateEffect } from "react-use"; +import { Action } from "redux"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import InfoIcon from "@mui/icons-material/Info"; +import TokenIcon from "@mui/icons-material/Token"; import { Box, CircularProgress, @@ -24,27 +35,19 @@ import { Skeleton, Typography, } from "@mui/material"; -import { produce } from "immer"; -import { ReactNode, useMemo, useReducer, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { usePromise as usePromiseWrapper, useUpdateEffect } from "react-use"; -import { Action } from "redux"; -import DeleteIcon from "@mui/icons-material/Delete"; -import InfoIcon from "@mui/icons-material/Info"; -import TokenIcon from "@mui/icons-material/Token"; -import * as R from "ramda"; -import { useSnackbar } from "notistack"; -import { BotDTO, BotDetailsDTO, UserDTO } from "@/common/types"; + +import { BotDetailsDTO, BotDTO, UserDTO } from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getAuthUser } from "@/redux/selectors"; import { deleteBot, getBots, getUser, getUsers } from "@/services/api/user"; import { isUserAdmin, sortByProp } from "@/services/utils"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import Header from "./Header"; -import { getAuthUser } from "@/redux/selectors"; -import TokenInfoDialog from "./dialog/TokenInfoDialog"; -import useAppSelector from "@/redux/hooks/useAppSelector"; import { isSearchMatching } from "@/utils/stringUtils"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; + +import TokenInfoDialog from "./dialog/TokenInfoDialog"; +import Header from "./Header"; interface BotDetailsDtoWithUser extends BotDetailsDTO { user: UserDTO; diff --git a/webapp/src/components/App/Settings/Users/Header.tsx b/webapp/src/components/App/Settings/Users/Header.tsx index 39cbd76354..ba2f012628 100644 --- a/webapp/src/components/App/Settings/Users/Header.tsx +++ b/webapp/src/components/App/Settings/Users/Header.tsx @@ -12,14 +12,17 @@ * This file is part of the Antares project. */ -import { Box, Button } from "@mui/material"; -import PersonAddAltIcon from "@mui/icons-material/PersonAddAlt"; -import { useTranslation } from "react-i18next"; import { useState } from "react"; -import CreateUserDialog from "./dialog/CreateUserDialog"; +import { useTranslation } from "react-i18next"; + +import PersonAddAltIcon from "@mui/icons-material/PersonAddAlt"; +import { Box, Button } from "@mui/material"; + import { UserDetailsDTO } from "@/common/types"; import SearchFE from "@/components/common/fieldEditors/SearchFE"; +import CreateUserDialog from "./dialog/CreateUserDialog"; + interface Props { setSearchValue: (v: string) => void; addUser: (user: UserDetailsDTO) => void; diff --git a/webapp/src/components/App/Settings/Users/dialog/CreateUserDialog.tsx b/webapp/src/components/App/Settings/Users/dialog/CreateUserDialog.tsx index d3c6c546ca..2f093b4498 100644 --- a/webapp/src/components/App/Settings/Users/dialog/CreateUserDialog.tsx +++ b/webapp/src/components/App/Settings/Users/dialog/CreateUserDialog.tsx @@ -12,10 +12,12 @@ * This file is part of the Antares project. */ -import PersonAddIcon from "@mui/icons-material/PersonAdd"; import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; import { usePromise as usePromiseWrapper } from "react-use"; + +import PersonAddIcon from "@mui/icons-material/PersonAdd"; + import { GroupDTO, RoleDetailsDTO, @@ -23,10 +25,11 @@ import { UserDetailsDTO, UserDTO, } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createRole, createUser } from "@/services/api/user"; + import UserFormDialog, { UserFormDialogProps } from "./UserFormDialog"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; type InheritPropsToOmit = "title" | "titleIcon" | "onSubmit" | "onCancel"; diff --git a/webapp/src/components/App/Settings/Users/dialog/UpdateUserDialog.tsx b/webapp/src/components/App/Settings/Users/dialog/UpdateUserDialog.tsx index bbce6568a3..3962ac595f 100644 --- a/webapp/src/components/App/Settings/Users/dialog/UpdateUserDialog.tsx +++ b/webapp/src/components/App/Settings/Users/dialog/UpdateUserDialog.tsx @@ -12,17 +12,21 @@ * This file is part of the Antares project. */ -import EditIcon from "@mui/icons-material/Edit"; import { useMemo } from "react"; +import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; import { usePromise as usePromiseWrapper } from "react-use"; -import { useSnackbar } from "notistack"; + +import EditIcon from "@mui/icons-material/Edit"; + import { GroupDTO, RoleType, UserDetailsDTO } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createRole, deleteUserRoles } from "@/services/api/user"; -import UserFormDialog, { UserFormDialogProps } from "./UserFormDialog"; + import { UserEdit } from ".."; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; + +import UserFormDialog, { UserFormDialogProps } from "./UserFormDialog"; type InheritPropsToOmit = | "title" diff --git a/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/UserForm.tsx b/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/UserForm.tsx index d32b49cd22..53dfc9f3ef 100644 --- a/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/UserForm.tsx +++ b/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/UserForm.tsx @@ -12,44 +12,46 @@ * This file is part of the Antares project. */ -import { useTranslation } from "react-i18next"; import { useMemo, useRef, useState } from "react"; +import { Controller, useFieldArray } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { v4 as uuidv4 } from "uuid"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import GroupIcon from "@mui/icons-material/Group"; import { - TextField, - Typography, - Paper, - Select, - MenuItem, Box, Button, - InputLabel, + CircularProgress, FormControl, - ListItem, IconButton, + InputLabel, List, + ListItem, ListItemButton, ListItemIcon, ListItemText, - CircularProgress, + MenuItem, + Paper, + Select, SelectChangeEvent, + TextField, + Typography, } from "@mui/material"; -import { Controller, useFieldArray } from "react-hook-form"; -import { v4 as uuidv4 } from "uuid"; -import DeleteIcon from "@mui/icons-material/Delete"; -import GroupIcon from "@mui/icons-material/Group"; -import { GroupDTO, RoleType } from "@/common/types"; -import { roleToString, sortByName } from "@/services/utils"; -import usePromise from "@/hooks/usePromise"; -import { getGroups, getUsers } from "@/services/api/user"; -import { UserFormDialogProps } from "."; -import { validatePassword, validateString } from "@/utils/validation/string"; -import { UseFormReturnPlus } from "@/components/common/Form/types"; import { RESERVED_GROUP_NAMES, RESERVED_USER_NAMES, ROLE_TYPE_KEYS, } from "@/common/contants"; +import { GroupDTO, RoleType } from "@/common/types"; +import { UseFormReturnPlus } from "@/components/common/Form/types"; +import usePromise from "@/hooks/usePromise"; +import { getGroups, getUsers } from "@/services/api/user"; +import { roleToString, sortByName } from "@/services/utils"; +import { validatePassword, validateString } from "@/utils/validation/string"; + +import { UserFormDialogProps } from "."; interface Props extends UseFormReturnPlus { onlyPermissions?: UserFormDialogProps["onlyPermissions"]; diff --git a/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/index.tsx b/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/index.tsx index ee2bc07ba2..3ff4cf221c 100644 --- a/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/index.tsx +++ b/webapp/src/components/App/Settings/Users/dialog/UserFormDialog/index.tsx @@ -13,12 +13,14 @@ */ import { DialogContentText } from "@mui/material"; + import { GroupDTO, RoleType } from "@/common/types"; -import UserForm from "./UserForm"; import FormDialog, { FormDialogProps, } from "@/components/common/dialogs/FormDialog"; +import UserForm from "./UserForm"; + export interface UserFormDialogProps extends Omit { defaultValues?: { username?: string; diff --git a/webapp/src/components/App/Settings/Users/index.tsx b/webapp/src/components/App/Settings/Users/index.tsx index 4eab4049c8..705677165d 100644 --- a/webapp/src/components/App/Settings/Users/index.tsx +++ b/webapp/src/components/App/Settings/Users/index.tsx @@ -12,6 +12,17 @@ * This file is part of the Antares project. */ +import { ReactNode, useMemo, useReducer, useState } from "react"; +import { produce } from "immer"; +import { useSnackbar } from "notistack"; +import * as R from "ramda"; +import { useTranslation } from "react-i18next"; +import { usePromise as usePromiseWrapper, useUpdateEffect } from "react-use"; +import { Action } from "redux"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import EditIcon from "@mui/icons-material/Edit"; +import PersonIcon from "@mui/icons-material/Person"; import { Box, CircularProgress, @@ -24,26 +35,18 @@ import { Skeleton, Typography, } from "@mui/material"; -import DeleteIcon from "@mui/icons-material/Delete"; -import EditIcon from "@mui/icons-material/Edit"; -import { useMemo, useReducer, useState, ReactNode } from "react"; -import { useTranslation } from "react-i18next"; -import PersonIcon from "@mui/icons-material/Person"; -import { produce } from "immer"; -import { usePromise as usePromiseWrapper, useUpdateEffect } from "react-use"; -import { Action } from "redux"; -import { useSnackbar } from "notistack"; -import * as R from "ramda"; -import { deleteUser, getUsers } from "@/services/api/user"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import Header from "./Header"; + +import { RESERVED_USER_NAMES } from "@/common/contants"; import { UserDetailsDTO } from "@/common/types"; -import UpdateUserDialog from "./dialog/UpdateUserDialog"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import { deleteUser, getUsers } from "@/services/api/user"; import { sortByName } from "@/services/utils"; import { isSearchMatching } from "@/utils/stringUtils"; -import { RESERVED_USER_NAMES } from "@/common/contants"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; + +import UpdateUserDialog from "./dialog/UpdateUserDialog"; +import Header from "./Header"; enum UserActionKind { ADD = "ADD", diff --git a/webapp/src/components/App/Settings/index.tsx b/webapp/src/components/App/Settings/index.tsx index b027eb0fd6..4964db4ce3 100644 --- a/webapp/src/components/App/Settings/index.tsx +++ b/webapp/src/components/App/Settings/index.tsx @@ -12,19 +12,22 @@ * This file is part of the Antares project. */ +import { SyntheticEvent, useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; + import SettingsIcon from "@mui/icons-material/Settings"; import { TabContext, TabList, TabPanel } from "@mui/lab"; import { Box, Tab } from "@mui/material"; -import { SyntheticEvent, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; + +import RootPage from "@/components/common/page/RootPage"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { isAuthUserAdmin, isAuthUserInGroupAdmin } from "@/redux/selectors"; +import { tuple } from "@/utils/tsUtils"; + import Groups from "./Groups"; import Maintenance from "./Maintenance"; import Tokens from "./Tokens"; import Users from "./Users"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { isAuthUserAdmin, isAuthUserInGroupAdmin } from "@/redux/selectors"; -import { tuple } from "@/utils/tsUtils"; -import RootPage from "@/components/common/page/RootPage"; function Settings() { const [tabValue, setTabValue] = useState("1"); diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandImportButton.tsx b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandImportButton.tsx index 3c0912d1f4..8cb0e58e2d 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandImportButton.tsx +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandImportButton.tsx @@ -13,10 +13,11 @@ */ import { useRef } from "react"; -import { useTranslation } from "react-i18next"; import { useSnackbar } from "notistack"; -import { Box, ButtonBase } from "@mui/material"; +import { useTranslation } from "react-i18next"; + import CloudUploadOutlinedIcon from "@mui/icons-material/CloudUploadOutlined"; +import { Box, ButtonBase } from "@mui/material"; interface PropTypes { onImport: (json: object) => void; diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/CommandMatrixViewer.tsx b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/CommandMatrixViewer.tsx index 7d3a7232ed..a091cb8529 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/CommandMatrixViewer.tsx +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/CommandMatrixViewer.tsx @@ -12,11 +12,14 @@ * This file is part of the Antares project. */ -import MatrixDialog from "@/components/App/Data/MatrixDialog"; -import { Box, Button } from "@mui/material"; -import { isString } from "ramda-adjunct"; import { useState } from "react"; +import { isString } from "ramda-adjunct"; import { useTranslation } from "react-i18next"; + +import { Box, Button } from "@mui/material"; + +import MatrixDialog from "@/components/App/Data/MatrixDialog"; + import { CommandEnum, CommandItem } from "../../commandTypes"; interface PropTypes { diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/index.tsx b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/index.tsx index 6ac46c7e47..0cd9c5deb6 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/index.tsx +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/index.tsx @@ -16,10 +16,11 @@ import { CSSProperties, useState } from "react"; import { DraggableProvided } from "react-beautiful-dnd"; import ReactJson, { InteractionProps } from "react-json-view"; -import ExpandMore from "@mui/icons-material/ExpandMore"; -import SaveOutlinedIcon from "@mui/icons-material/SaveOutlined"; + import CloudDownloadOutlinedIcon from "@mui/icons-material/CloudDownloadOutlined"; +import ExpandMore from "@mui/icons-material/ExpandMore"; import InfoIcon from "@mui/icons-material/Info"; +import SaveOutlinedIcon from "@mui/icons-material/SaveOutlined"; import { AccordionDetails, AccordionSummary, @@ -28,6 +29,14 @@ import { styled, Typography, } from "@mui/material"; + +import { CommandResultDTO } from "@/common/types"; +import LogModal from "@/components/common/LogModal"; + +import { CommandItem } from "../../commandTypes"; +import CommandImportButton from "../CommandImportButton"; + +import CommandMatrixViewer from "./CommandMatrixViewer"; import { detailsStyle, DraggableAccorderon, @@ -38,11 +47,6 @@ import { JsonContainer, StyledDeleteIcon, } from "./style"; -import CommandMatrixViewer from "./CommandMatrixViewer"; -import { CommandResultDTO } from "@/common/types"; -import LogModal from "@/components/common/LogModal"; -import { CommandItem } from "../../commandTypes"; -import CommandImportButton from "../CommandImportButton"; export const Item = styled(Box)(({ theme }) => ({ boxSizing: "border-box", diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/style.ts b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/style.ts index b8805743bd..bd67ba3e6d 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/style.ts +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListItem/style.ts @@ -12,8 +12,9 @@ * This file is part of the Antares project. */ -import { Accordion, Box, styled } from "@mui/material"; import DeleteIcon from "@mui/icons-material/HighlightOff"; +import { Accordion, Box, styled } from "@mui/material"; + import { PAPER_BACKGROUND_NO_TRANSPARENCY } from "@/theme"; export const ItemContainer = styled(Box, { diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListView.tsx b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListView.tsx index 0cac99c0cc..7d08708d19 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListView.tsx +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/DraggableCommands/CommandListView.tsx @@ -13,16 +13,18 @@ */ import { memo, useEffect, useRef } from "react"; -import { FixedSizeList, areEqual, ListChildComponentProps } from "react-window"; import { DragDropContext, - Droppable, Draggable, + Droppable, OnDragEndResponder, } from "react-beautiful-dnd"; -import CommandListItem from "./CommandListItem"; +import { areEqual, FixedSizeList, ListChildComponentProps } from "react-window"; + import { CommandItem } from "../commandTypes"; +import CommandListItem from "./CommandListItem"; + const Row = memo((props: ListChildComponentProps) => { const { data, index, style } = props; const { diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/index.tsx b/webapp/src/components/App/Singlestudy/Commands/Edition/index.tsx index a7878568fb..646b9e577e 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/index.tsx +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/index.tsx @@ -13,59 +13,62 @@ */ import { useCallback, useEffect, useRef, useState } from "react"; +import { AxiosError } from "axios"; +import debug from "debug"; +import _ from "lodash"; import { useSnackbar } from "notistack"; -import { useTranslation } from "react-i18next"; import { DropResult } from "react-beautiful-dnd"; -import _ from "lodash"; +import { useTranslation } from "react-i18next"; +import { useMountedState } from "react-use"; + +import BoltIcon from "@mui/icons-material/Bolt"; import CloudDownloadOutlinedIcon from "@mui/icons-material/CloudDownloadOutlined"; import DeleteForeverIcon from "@mui/icons-material/DeleteForever"; -import BoltIcon from "@mui/icons-material/Bolt"; -import debug from "debug"; -import { AxiosError } from "axios"; import HelpIcon from "@mui/icons-material/Help"; import { Box, Button, Tooltip, Typography } from "@mui/material"; -import { useMountedState } from "react-use"; -import { CommandItem, JsonCommandItem } from "./commandTypes"; -import CommandListView from "./DraggableCommands/CommandListView"; + import { - reorder, - fromCommandDTOToCommandItem, - fromCommandDTOToJsonCommand, - exportJson, - isTaskFinal, - updateCommandResults, -} from "./utils"; + CommandResultDTO, + TaskEventPayload, + TaskStatus, + WSEvent, + WSMessage, +} from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; +import SimpleLoader from "@/components/common/loaders/SimpleLoader"; +import EmptyView from "@/components/common/page/SimpleContent"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { getTask } from "@/services/api/tasks"; import { + applyCommands, deleteCommand, + exportCommandsMatrices, getCommand, getCommands, + getStudyTask, moveCommand, - updateCommand, replaceCommands, - applyCommands, - getStudyTask, - exportCommandsMatrices, + updateCommand, } from "@/services/api/variant"; -import { - WSEvent, - WSMessage, - CommandResultDTO, - TaskEventPayload, - TaskStatus, -} from "@/common/types"; -import CommandImportButton from "./DraggableCommands/CommandImportButton"; -import { getTask } from "@/services/api/tasks"; -import { Body, EditHeader, Header, headerIconStyle, Root } from "./style"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { addWsMessageListener, sendWsSubscribeMessage, WsChannel, } from "@/services/webSockets"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; -import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; -import SimpleLoader from "@/components/common/loaders/SimpleLoader"; -import EmptyView from "@/components/common/page/SimpleContent"; + +import CommandImportButton from "./DraggableCommands/CommandImportButton"; +import CommandListView from "./DraggableCommands/CommandListView"; +import { CommandItem, JsonCommandItem } from "./commandTypes"; +import { Body, EditHeader, Header, headerIconStyle, Root } from "./style"; +import { + exportJson, + fromCommandDTOToCommandItem, + fromCommandDTOToJsonCommand, + isTaskFinal, + reorder, + updateCommandResults, +} from "./utils"; const logError = debug("antares:variantedition:error"); diff --git a/webapp/src/components/App/Singlestudy/Commands/Edition/utils.ts b/webapp/src/components/App/Singlestudy/Commands/Edition/utils.ts index 0063b5a7d5..8b9ab5cb0b 100644 --- a/webapp/src/components/App/Singlestudy/Commands/Edition/utils.ts +++ b/webapp/src/components/App/Singlestudy/Commands/Edition/utils.ts @@ -18,6 +18,7 @@ import { TaskDTO, TaskStatus, } from "@/common/types"; + import { CommandEnum, CommandItem, JsonCommandItem } from "./commandTypes"; export const CommandList = [ diff --git a/webapp/src/components/App/Singlestudy/Commands/index.tsx b/webapp/src/components/App/Singlestudy/Commands/index.tsx index ef595a8eed..ba0277c5b6 100644 --- a/webapp/src/components/App/Singlestudy/Commands/index.tsx +++ b/webapp/src/components/App/Singlestudy/Commands/index.tsx @@ -13,11 +13,13 @@ */ import { useTranslation } from "react-i18next"; -import Toolbar from "@mui/material/Toolbar"; -import Divider from "@mui/material/Divider"; + import { Typography } from "@mui/material"; -import { CommandDrawer, TitleContainer } from "./style"; +import Divider from "@mui/material/Divider"; +import Toolbar from "@mui/material/Toolbar"; + import EditionView from "./Edition"; +import { CommandDrawer, TitleContainer } from "./style"; interface Props { open: boolean; diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/CreateVariantDialog.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/CreateVariantDialog.tsx index a5778bb3d5..fb727226e7 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/CreateVariantDialog.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/CreateVariantDialog.tsx @@ -13,17 +13,19 @@ */ import { useEffect, useMemo, useState } from "react"; -import { useNavigate } from "react-router"; import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router"; + import AddCircleIcon from "@mui/icons-material/AddCircle"; + import { GenericInfo, VariantTree } from "@/common/types"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { createVariant } from "@/services/api/variant"; import { createListFromTree } from "@/services/utils"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import Fieldset from "@/common/Fieldset"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; import { validateString } from "@/utils/validation/string"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/JobStepper.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/JobStepper.tsx index b1d07c0785..8e82f9e6e3 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/JobStepper.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/JobStepper.tsx @@ -12,24 +12,31 @@ * This file is part of the Antares project. */ -import Stepper from "@mui/material/Stepper"; -import Step from "@mui/material/Step"; -import StepLabel from "@mui/material/StepLabel"; -import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord"; +import { useState } from "react"; +import { AxiosError } from "axios"; +import moment from "moment"; +import { useSnackbar } from "notistack"; +import { useTranslation } from "react-i18next"; + import BlockIcon from "@mui/icons-material/Block"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; import EqualizerIcon from "@mui/icons-material/Equalizer"; +import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord"; import { StepIconProps, Tooltip, Typography } from "@mui/material"; -import moment from "moment"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useSnackbar } from "notistack"; -import { AxiosError } from "axios"; +import Step from "@mui/material/Step"; +import StepLabel from "@mui/material/StepLabel"; +import Stepper from "@mui/material/Stepper"; + import { JobStatus, LaunchJob, LaunchJobsProgress } from "@/common/types"; -import { convertUTCToLocalTime } from "@/services/utils"; -import { killStudy } from "@/services/api/study"; -import LaunchJobLogView from "@/Tasks/LaunchJobLogView"; +import LaunchJobLogView from "@/components/App/Tasks/LaunchJobLogView"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import DigestDialog from "@/components/common/dialogs/DigestDialog"; +import LinearProgressWithLabel from "@/components/common/LinearProgressWithLabel"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { killStudy } from "@/services/api/study"; +import { convertUTCToLocalTime } from "@/services/utils"; +import type { EmptyObject } from "@/utils/tsUtils"; + import { CancelContainer, JobRoot, @@ -38,17 +45,13 @@ import { StepLabelRoot, StepLabelRow, } from "./style"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; -import LinearProgressWithLabel from "@/common/LinearProgressWithLabel"; -import DigestDialog from "@/common/dialogs/DigestDialog"; -import type { EmptyObject } from "@/utils/tsUtils"; export const ColorStatus = { running: "warning.main", pending: "grey.400", success: "success.main", failed: "error.main", -}; +} as const; const iconStyle = { m: 0.5, diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/index.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/index.tsx index 9a7b887231..c03446ff93 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/index.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/index.tsx @@ -12,12 +12,14 @@ * This file is part of the Antares project. */ -import { Box, Paper, styled, Typography } from "@mui/material"; import { useCallback, useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; import { AxiosError } from "axios"; -import HistoryIcon from "@mui/icons-material/History"; import moment from "moment"; +import { useTranslation } from "react-i18next"; + +import HistoryIcon from "@mui/icons-material/History"; +import { Box, Paper, styled, Typography } from "@mui/material"; + import { LaunchJob, LaunchJobDTO, @@ -27,15 +29,16 @@ import { WSEvent, WSMessage, } from "@/common/types"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { getStudyJobs, mapLaunchJobDTO } from "@/services/api/study"; +import { getProgress } from "@/services/api/tasks"; import { addWsMessageListener, sendWsSubscribeMessage, WsChannel, } from "@/services/webSockets"; + import JobStepper from "./JobStepper"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { getProgress } from "@/services/api/tasks"; const TitleHeader = styled(Box)(({ theme }) => ({ display: "flex", diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/DetailsList.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/DetailsList.tsx index 295e521547..81fc717600 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/DetailsList.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/DetailsList.tsx @@ -12,13 +12,13 @@ * This file is part of the Antares project. */ +import { SvgIconComponent } from "@mui/icons-material"; +import { Icon } from "@mui/material"; +import Avatar from "@mui/material/Avatar"; import List from "@mui/material/List"; import ListItem from "@mui/material/ListItem"; -import ListItemText from "@mui/material/ListItemText"; import ListItemAvatar from "@mui/material/ListItemAvatar"; -import Avatar from "@mui/material/Avatar"; -import { Icon } from "@mui/material"; -import { SvgIconComponent } from "@mui/icons-material"; +import ListItemText from "@mui/material/ListItemText"; interface ListItem { content: React.ReactNode; diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/NodeEditorModal/index.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/NodeEditorModal/index.tsx index 21415202f1..4cb8a7f0f0 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/NodeEditorModal/index.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/NodeEditorModal/index.tsx @@ -14,12 +14,16 @@ import { useEffect, useState } from "react"; import { Editor, EditorState, getDefaultKeyBinding, RichUtils } from "draft-js"; -import { Button } from "@mui/material"; import { useTranslation } from "react-i18next"; + import FormatListBulletedIcon from "@mui/icons-material/FormatListBulleted"; import FormatListNumberedIcon from "@mui/icons-material/FormatListNumbered"; -import { convertDraftJSToXML, convertXMLToDraftJS } from "@/utils"; -import BasicDialog from "@/common/dialogs/BasicDialog"; +import { Button } from "@mui/material"; + +import BasicDialog from "@/components/common/dialogs/BasicDialog"; + +import { convertDraftJSToXML, convertXMLToDraftJS } from "../utils"; + import { EditorButton, EditorContainer, diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/index.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/index.tsx index 930fe14d93..aae849dad7 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/index.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/index.tsx @@ -13,33 +13,37 @@ */ import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useSnackbar } from "notistack"; import { AxiosError } from "axios"; -import { Box, Divider, Skeleton, styled, Typography } from "@mui/material"; -import StickyNote2OutlinedIcon from "@mui/icons-material/StickyNote2Outlined"; +import { Editor, EditorState } from "draft-js"; +import { useSnackbar } from "notistack"; +import { useTranslation } from "react-i18next"; + +import EditIcon from "@mui/icons-material/Edit"; +import HubIcon from "@mui/icons-material/Hub"; import LinearScaleIcon from "@mui/icons-material/LinearScale"; +import StickyNote2OutlinedIcon from "@mui/icons-material/StickyNote2Outlined"; import StorageIcon from "@mui/icons-material/Storage"; -import HubIcon from "@mui/icons-material/Hub"; -import { Editor, EditorState } from "draft-js"; -import "draft-js/dist/Draft.css"; import { LoadingButton } from "@mui/lab"; -import EditIcon from "@mui/icons-material/Edit"; +import { Box, Divider, Skeleton, styled, Typography } from "@mui/material"; + +import { StudyMetadata } from "@/common/types"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; +import { getAreas, getLinks } from "@/redux/selectors"; import { editComments, getComments, getStudyDiskUsage, } from "@/services/api/study"; -import { convertSize, convertXMLToDraftJS, getColorForSize } from "./utils"; -import { StudyMetadata } from "@/common/types"; -import NoteEditorModal from "./NodeEditorModal"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; + import DetailsList from "./DetailsList"; -import { getAreas, getLinks } from "@/redux/selectors"; -import UsePromiseCond from "@/common/utils/UsePromiseCond"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; +import NoteEditorModal from "./NodeEditorModal"; +import { convertSize, convertXMLToDraftJS, getColorForSize } from "./utils"; + +import "draft-js/dist/Draft.css"; const Root = styled(Box)(() => ({ flex: "0 0 40%", diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/utils.ts b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/utils.ts index 72002fa5a1..f9440295ff 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/utils.ts +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/Notes/utils.ts @@ -14,10 +14,11 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable no-param-reassign */ +import { convertFromHTML } from "draft-convert"; import { ContentState, convertToRaw, EditorState } from "draft-js"; import draftToHtml from "draftjs-to-html"; -import { convertFromHTML } from "draft-convert"; import { Element as XMLElement, js2xml, xml2json } from "xml-js"; + import theme from "@/theme"; interface BlockMap { diff --git a/webapp/src/components/App/Singlestudy/HomeView/InformationView/index.tsx b/webapp/src/components/App/Singlestudy/HomeView/InformationView/index.tsx index 602fa1e8cb..f07b7e0ef7 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/InformationView/index.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/InformationView/index.tsx @@ -13,20 +13,23 @@ */ import { useState } from "react"; -import { Paper, Button, Box, Divider } from "@mui/material"; -import { useNavigate } from "react-router-dom"; -import { useTranslation } from "react-i18next"; import { AxiosError } from "axios"; +import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router-dom"; + +import { Box, Button, Divider, Paper } from "@mui/material"; + import { StudyMetadata, VariantTree } from "@/common/types"; -import CreateVariantDialog from "./CreateVariantDialog"; -import LauncherHistory from "./LauncherHistory"; -import Notes from "./Notes"; -import LauncherDialog from "@/Studies/LauncherDialog"; +import LauncherDialog from "@/components/App/Studies/LauncherDialog"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { copyStudy, unarchiveStudy as callUnarchiveStudy, } from "@/services/api/study"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; + +import CreateVariantDialog from "./CreateVariantDialog"; +import LauncherHistory from "./LauncherHistory"; +import Notes from "./Notes"; interface Props { study: StudyMetadata | undefined; diff --git a/webapp/src/components/App/Singlestudy/HomeView/StudyTreeView/index.tsx b/webapp/src/components/App/Singlestudy/HomeView/StudyTreeView/index.tsx index 5d5ee7e694..d3cdcedb2f 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/StudyTreeView/index.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/StudyTreeView/index.tsx @@ -14,12 +14,15 @@ import { useEffect, useMemo, useState } from "react"; import * as React from "react"; + import { Box, styled } from "@mui/material"; + import { StudyMetadata, VariantTree } from "@/common/types"; -import { StudyTree, getTreeNodes } from "./utils"; + import { CIRCLE_RADIUS, colors, + CURVE_OFFSET, DCX, DCY, DEPTH_OFFSET, @@ -36,8 +39,8 @@ import { TILE_SIZE_Y, TILE_SIZE_Y_2, ZOOM_OUT, - CURVE_OFFSET, } from "./treeconfig"; +import { getTreeNodes, StudyTree } from "./utils"; export const SVGCircle = styled("circle")({ cursor: "pointer", diff --git a/webapp/src/components/App/Singlestudy/HomeView/index.tsx b/webapp/src/components/App/Singlestudy/HomeView/index.tsx index 226b8c79f0..b34159d37d 100644 --- a/webapp/src/components/App/Singlestudy/HomeView/index.tsx +++ b/webapp/src/components/App/Singlestudy/HomeView/index.tsx @@ -13,12 +13,16 @@ */ import { useNavigate } from "react-router-dom"; -import { Box } from "@mui/material"; import Split from "react-split"; + +import { Box } from "@mui/material"; + import { StudyMetadata, VariantTree } from "@/common/types"; -import "./Split.css"; -import StudyTreeView from "./StudyTreeView"; + import InformationView from "./InformationView"; +import StudyTreeView from "./StudyTreeView"; + +import "./Split.css"; interface Props { study: StudyMetadata | undefined; diff --git a/webapp/src/components/App/Singlestudy/NavHeader/Actions.tsx b/webapp/src/components/App/Singlestudy/NavHeader/Actions.tsx index 7468b04c25..4cec358def 100644 --- a/webapp/src/components/App/Singlestudy/NavHeader/Actions.tsx +++ b/webapp/src/components/App/Singlestudy/NavHeader/Actions.tsx @@ -12,16 +12,18 @@ * This file is part of the Antares project. */ -import { Box, Tooltip, Typography, Chip, Button, Divider } from "@mui/material"; -import HistoryOutlinedIcon from "@mui/icons-material/HistoryOutlined"; -import ContentCopyIcon from "@mui/icons-material/ContentCopy"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router"; -import MoreVertIcon from "@mui/icons-material/MoreVert"; + import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import ContentCopyIcon from "@mui/icons-material/ContentCopy"; +import HistoryOutlinedIcon from "@mui/icons-material/HistoryOutlined"; +import MoreVertIcon from "@mui/icons-material/MoreVert"; +import { Box, Button, Chip, Divider, Tooltip, Typography } from "@mui/material"; + import { StudyMetadata, StudyType } from "@/common/types"; +import StarToggle from "@/components/common/StarToggle"; import { toggleFavorite } from "@/redux/ducks/studies"; -import StarToggle from "@/common/StarToggle"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { isCurrentStudyFavorite } from "@/redux/selectors"; diff --git a/webapp/src/components/App/Singlestudy/NavHeader/ActionsMenu.tsx b/webapp/src/components/App/Singlestudy/NavHeader/ActionsMenu.tsx index 7e0c7b9135..d411f2a516 100644 --- a/webapp/src/components/App/Singlestudy/NavHeader/ActionsMenu.tsx +++ b/webapp/src/components/App/Singlestudy/NavHeader/ActionsMenu.tsx @@ -12,10 +12,11 @@ * This file is part of the Antares project. */ -import { Menu, MenuItem, ListItemIcon, ListItemText } from "@mui/material"; -import { SvgIconComponent } from "@mui/icons-material"; import { useTranslation } from "react-i18next"; +import { SvgIconComponent } from "@mui/icons-material"; +import { ListItemIcon, ListItemText, Menu, MenuItem } from "@mui/material"; + export interface ActionsMenuItem { key: string; icon: SvgIconComponent; diff --git a/webapp/src/components/App/Singlestudy/NavHeader/Details.tsx b/webapp/src/components/App/Singlestudy/NavHeader/Details.tsx index da79e18d7f..f20b859c77 100644 --- a/webapp/src/components/App/Singlestudy/NavHeader/Details.tsx +++ b/webapp/src/components/App/Singlestudy/NavHeader/Details.tsx @@ -12,23 +12,25 @@ * This file is part of the Antares project. */ -import ScheduleOutlinedIcon from "@mui/icons-material/ScheduleOutlined"; -import UpdateOutlinedIcon from "@mui/icons-material/UpdateOutlined"; -import AltRouteOutlinedIcon from "@mui/icons-material/AltRouteOutlined"; -import SecurityOutlinedIcon from "@mui/icons-material/SecurityOutlined"; -import AccountTreeOutlinedIcon from "@mui/icons-material/AccountTreeOutlined"; -import PersonOutlineOutlinedIcon from "@mui/icons-material/PersonOutlineOutlined"; -import { Box, Divider, Tooltip, Typography, styled } from "@mui/material"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; + +import AccountTreeOutlinedIcon from "@mui/icons-material/AccountTreeOutlined"; +import AltRouteOutlinedIcon from "@mui/icons-material/AltRouteOutlined"; +import PersonOutlineOutlinedIcon from "@mui/icons-material/PersonOutlineOutlined"; +import ScheduleOutlinedIcon from "@mui/icons-material/ScheduleOutlined"; +import SecurityOutlinedIcon from "@mui/icons-material/SecurityOutlined"; +import UpdateOutlinedIcon from "@mui/icons-material/UpdateOutlined"; +import { Box, Divider, styled, Tooltip, Typography } from "@mui/material"; + +import { StudyMetadata, VariantTree } from "@/common/types"; +import { PUBLIC_MODE_LIST } from "@/components/common/utils/constants"; import { buildModificationDate, convertUTCToLocalTime, countAllChildrens, displayVersionName, } from "@/services/utils"; -import { StudyMetadata, VariantTree } from "@/common/types"; -import { PUBLIC_MODE_LIST } from "@/common/utils/constants"; const MAX_STUDY_TITLE_LENGTH = 45; diff --git a/webapp/src/components/App/Singlestudy/NavHeader/index.tsx b/webapp/src/components/App/Singlestudy/NavHeader/index.tsx index d8b6e9cf93..a5d4b4e20c 100644 --- a/webapp/src/components/App/Singlestudy/NavHeader/index.tsx +++ b/webapp/src/components/App/Singlestudy/NavHeader/index.tsx @@ -12,36 +12,40 @@ * This file is part of the Antares project. */ -import { useState, MouseEvent } from "react"; +import { MouseEvent, useState } from "react"; +import { AxiosError } from "axios"; import debug from "debug"; import { useSnackbar } from "notistack"; +import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; -import { AxiosError } from "axios"; -import { Box, Typography } from "@mui/material"; -import UpgradeIcon from "@mui/icons-material/Upgrade"; -import UnarchiveOutlinedIcon from "@mui/icons-material/UnarchiveOutlined"; -import DownloadOutlinedIcon from "@mui/icons-material/DownloadOutlined"; + import ArchiveOutlinedIcon from "@mui/icons-material/ArchiveOutlined"; import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined"; +import DownloadOutlinedIcon from "@mui/icons-material/DownloadOutlined"; import EditOutlinedIcon from "@mui/icons-material/EditOutlined"; -import { useTranslation } from "react-i18next"; +import UnarchiveOutlinedIcon from "@mui/icons-material/UnarchiveOutlined"; +import UpgradeIcon from "@mui/icons-material/Upgrade"; +import { Box, Typography } from "@mui/material"; + import { StudyMetadata, VariantTree } from "@/common/types"; -import { STUDIES_HEIGHT_HEADER } from "@/theme"; -import { archiveStudy, unarchiveStudy } from "@/services/api/study"; -import { deleteStudy } from "@/redux/ducks/studies"; -import LauncherDialog from "@/Studies/LauncherDialog"; -import PropertiesDialog from "@/PropertiesDialog"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { getLatestStudyVersion } from "@/redux/selectors"; -import ExportDialog from "@/Studies/ExportModal"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; -import useAppSelector from "@/redux/hooks/useAppSelector"; +import { deleteStudy } from "@/redux/ducks/studies"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import CheckBoxFE from "@/common/fieldEditors/CheckBoxFE"; -import Details from "./Details"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getLatestStudyVersion } from "@/redux/selectors"; +import { archiveStudy, unarchiveStudy } from "@/services/api/study"; +import { STUDIES_HEIGHT_HEADER } from "@/theme"; + +import ExportModal from "../../Studies/ExportModal"; +import LauncherDialog from "../../Studies/LauncherDialog"; +import PropertiesDialog from "../PropertiesDialog"; +import UpgradeDialog from "../UpgradeDialog"; + import Actions from "./Actions"; -import UpgradeDialog from "@/UpgradeDialog"; import ActionsMenu, { ActionsMenuItem } from "./ActionsMenu"; +import Details from "./Details"; const logError = debug("antares:singlestudy:navheader:error"); @@ -289,7 +293,7 @@ function NavHeader({ /> )} {study && openExportDialog && ( - setOpenExportDialog(false)} study={study} diff --git a/webapp/src/components/App/Singlestudy/PropertiesDialog.tsx b/webapp/src/components/App/Singlestudy/PropertiesDialog.tsx index 9f788e83a6..260f9935d7 100644 --- a/webapp/src/components/App/Singlestudy/PropertiesDialog.tsx +++ b/webapp/src/components/App/Singlestudy/PropertiesDialog.tsx @@ -12,13 +12,25 @@ * This file is part of the Antares project. */ +import { useMemo } from "react"; +import { AxiosError } from "axios"; import debug from "debug"; +import { useSnackbar } from "notistack"; import * as R from "ramda"; import { useTranslation } from "react-i18next"; -import { AxiosError } from "axios"; -import { useSnackbar } from "notistack"; -import { useMemo } from "react"; + import { StudyMetadata } from "@/common/types"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import CheckboxesTagsFE from "@/components/common/fieldEditors/CheckboxesTagsFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import { PUBLIC_MODE_LIST } from "@/components/common/utils/constants"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import { updateStudy } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import { addStudyGroup, changePublicMode, @@ -26,17 +38,6 @@ import { updateStudyMetadata, } from "@/services/api/study"; import { getGroups } from "@/services/api/user"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { PUBLIC_MODE_LIST } from "@/common/utils/constants"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import CheckboxesTagsFE from "@/common/fieldEditors/CheckboxesTagsFE"; -import Fieldset from "@/common/Fieldset"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { updateStudy } from "@/redux/ducks/studies"; import { validateString } from "@/utils/validation/string"; const logErr = debug("antares:createstudyform:error"); diff --git a/webapp/src/components/App/Singlestudy/UpgradeDialog.tsx b/webapp/src/components/App/Singlestudy/UpgradeDialog.tsx index f61a6861e0..d301e6fe2c 100644 --- a/webapp/src/components/App/Singlestudy/UpgradeDialog.tsx +++ b/webapp/src/components/App/Singlestudy/UpgradeDialog.tsx @@ -12,14 +12,16 @@ * This file is part of the Antares project. */ -import UpgradeIcon from "@mui/icons-material/Upgrade"; import { useMemo } from "react"; import { useTranslation } from "react-i18next"; + +import UpgradeIcon from "@mui/icons-material/Upgrade"; + import { StudyMetadata } from "@/common/types"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import Fieldset from "@/common/Fieldset"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import FormDialog from "@/common/dialogs/FormDialog"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getStudyVersionsFormatted } from "@/redux/selectors"; import { upgradeStudy } from "@/services/api/study"; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/Fields.tsx index f029cb2c15..57e1e35162 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/Fields.tsx @@ -12,17 +12,20 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; -import { AdequacyPatchFormFields, PRICE_TAKING_ORDER_OPTIONS } from "./utils"; + +import { Box } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; -import { validateNumber } from "@/utils/validation/number"; import NumberFE from "@/components/common/fieldEditors/NumberFE"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import Fieldset from "@/components/common/Fieldset"; import { useFormContextPlus } from "@/components/common/Form"; +import { validateNumber } from "@/utils/validation/number"; + +import { AdequacyPatchFormFields, PRICE_TAKING_ORDER_OPTIONS } from "./utils"; function Fields() { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/index.tsx index 865ed9f36c..eb1f80131f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/AdequacyPatch/index.tsx @@ -12,19 +12,21 @@ * This file is part of the Antares project. */ -import { useOutletContext } from "react-router"; import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import TableMode from "@/components/common/TableMode"; +import TabsView from "@/components/common/TabsView"; + import Fields from "./Fields"; import { AdequacyPatchFormFields, getAdequacyPatchFormFields, setAdequacyPatchFormFields, } from "./utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import TableMode from "@/components/common/TableMode"; -import TabsView from "@/components/common/TabsView"; -import Form from "@/components/common/Form"; function AdequacyPatch() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/Fields.tsx index abfa1363e4..76f85c007d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/Fields.tsx @@ -12,28 +12,31 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router"; + +import { Box } from "@mui/material"; + +import { StudyMetadata } from "@/common/types"; +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import Fieldset from "@/components/common/Fieldset"; +import { useFormContextPlus } from "@/components/common/Form"; + import { AdvancedParamsFormFields, HYDRO_HEURISTIC_POLICY_OPTIONS, - INITIAL_RESERVOIR_OPTIONS, HYDRO_PRICING_MODE_OPTIONS, + INITIAL_RESERVOIR_OPTIONS, POWER_FLUCTUATIONS_OPTIONS, - SPATIAL_CORRELATIONS_OPTIONS, - SHEDDING_POLICY_OPTIONS, + RENEWABLE_GENERATION_OPTIONS, RESERVE_MANAGEMENT_OPTIONS, - UNIT_COMMITMENT_MODE_OPTIONS, + SHEDDING_POLICY_OPTIONS, SIMULATION_CORES_OPTIONS, - RENEWABLE_GENERATION_OPTIONS, + SPATIAL_CORRELATIONS_OPTIONS, + UNIT_COMMITMENT_MODE_OPTIONS, UnitCommitmentMode, } from "./utils"; -import { useOutletContext } from "react-router"; -import { StudyMetadata } from "@/common/types"; -import NumberFE from "@/components/common/fieldEditors/NumberFE"; -import SelectFE from "@/components/common/fieldEditors/SelectFE"; -import Fieldset from "@/components/common/Fieldset"; -import { useFormContextPlus } from "@/components/common/Form"; function Fields() { const [t] = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/index.tsx index 2ad31f71f8..01bfc65a61 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/index.tsx @@ -13,17 +13,19 @@ */ import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { updateStudySynthesis } from "@/redux/ducks/studySyntheses"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; + import Fields from "./Fields"; import { AdvancedParamsFormFields, getAdvancedParamsFormFields, setAdvancedParamsFormFields, } from "./utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function AdvancedParameters() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/utils.ts b/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/utils.ts index 98ab1b86ce..33d34531ae 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/AdvancedParameters/utils.ts @@ -13,6 +13,7 @@ */ import { DeepPartial } from "react-hook-form"; + import { StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/Fields.tsx index ba7f180206..c397b2867e 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/Fields.tsx @@ -12,15 +12,26 @@ * This file is part of the Antares project. */ -import { Box, Button, Divider } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import SettingsIcon from "@mui/icons-material/Settings"; import { useEffect } from "react"; import * as RA from "ramda-adjunct"; import { Validate } from "react-hook-form"; +import { useTranslation } from "react-i18next"; + +import SettingsIcon from "@mui/icons-material/Settings"; +import { Box, Button, Divider } from "@mui/material"; + +import BooleanFE from "@/components/common/fieldEditors/BooleanFE"; +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import Fieldset from "@/components/common/Fieldset"; +import { useFormContextPlus } from "@/components/common/Form"; + +import { FieldWithButton } from "./styles"; import { - BuildingMode, BUILDING_MODE_OPTIONS, + BuildingMode, FIRST_JANUARY_OPTIONS, GeneralFormFields, MODE_OPTIONS, @@ -28,14 +39,6 @@ import { WEEK_OPTIONS, YEAR_OPTIONS, } from "./utils"; -import { FieldWithButton } from "./styles"; -import { useFormContextPlus } from "@/components/common/Form"; -import BooleanFE from "@/components/common/fieldEditors/BooleanFE"; -import NumberFE from "@/components/common/fieldEditors/NumberFE"; -import SelectFE from "@/components/common/fieldEditors/SelectFE"; -import StringFE from "@/components/common/fieldEditors/StringFE"; -import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; -import Fieldset from "@/components/common/Fieldset"; interface Props { setDialog: React.Dispatch>; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/Table.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/Table.tsx index 2400ef1673..ae9afdd7ab 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/Table.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/Table.tsx @@ -13,19 +13,21 @@ */ import { useTranslation } from "react-i18next"; -import TableForm from "@/common/TableForm"; +import { useOutletContext } from "react-router"; + +import { StudyMetadata } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import EmptyView from "@/components/common/page/SimpleContent"; +import TableForm from "@/components/common/TableForm"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { toError } from "@/utils/fnUtils"; + import { + ClustersHandlerReturn, GenericScenarioConfig, ScenarioType, - ClustersHandlerReturn, updateScenarioBuilderConfig, } from "./utils"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import EmptyView from "@/common/page/SimpleContent"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { toError } from "@/utils/fnUtils"; -import { useOutletContext } from "react-router"; -import { StudyMetadata } from "@/common/types"; interface Props { config: GenericScenarioConfig | ClustersHandlerReturn; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/index.tsx index 7e2b7ff0c4..9f7fee7228 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/index.tsx @@ -12,17 +12,20 @@ * This file is part of the Antares project. */ -import { TabContext, TabList, TabListProps, TabPanel } from "@mui/lab"; -import { Box, Button, Tab, Skeleton } from "@mui/material"; import { useState } from "react"; import { useTranslation } from "react-i18next"; + +import { TabContext, TabList, TabListProps, TabPanel } from "@mui/lab"; +import { Box, Button, Skeleton, Tab } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import BasicDialog from "@/components/common/dialogs/BasicDialog"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; + import Table from "./Table"; import { getScenarioConfigByType, SCENARIOS, ScenarioType } from "./utils"; import withAreas from "./withAreas"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import BasicDialog from "@/components/common/dialogs/BasicDialog"; -import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; interface Props { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/utils.ts b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/utils.ts index d3652b3e51..271e259e3f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/utils.ts @@ -13,6 +13,7 @@ */ import { AxiosResponse } from "axios"; + import { StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/withAreas.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/withAreas.tsx index 7b85528084..6052795173 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/withAreas.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioBuilderDialog/withAreas.tsx @@ -13,17 +13,21 @@ */ import { ComponentType, useEffect, useMemo, useState } from "react"; + import { Box } from "@mui/material"; -import SplitView from "@/common/SplitView"; -import PropertiesView from "@/common/PropertiesView"; -import ListElement from "@/common/ListElement"; + +import PropertiesView from "@/components/common/PropertiesView"; +import SplitView from "@/components/common/SplitView"; + +import ListElement from "../../../../common/ListElement"; + import { - GenericScenarioConfig, - HandlerReturnTypes, - ScenarioType, ClustersHandlerReturn, + GenericScenarioConfig, getConfigByScenario, + HandlerReturnTypes, ScenarioConfig, + ScenarioType, } from "./utils"; interface ScenarioTableProps { diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx index 8c1be4198f..d38750ed6a 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ScenarioPlaylistDialog/index.tsx @@ -12,25 +12,29 @@ * This file is part of the Antares project. */ -import { Box, Button, Divider } from "@mui/material"; import { useRef } from "react"; -import { useTranslation } from "react-i18next"; +import Handsontable from "handsontable"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; -import Handsontable from "handsontable"; +import { useTranslation } from "react-i18next"; + +import { HotTableClass } from "@handsontable/react"; +import { Box, Button, Divider } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import BasicDialog from "@/components/common/dialogs/BasicDialog"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import { HandsontableProps } from "@/components/common/Handsontable"; +import TableForm from "@/components/common/TableForm"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; import usePromise from "@/hooks/usePromise"; -import BasicDialog from "@/common/dialogs/BasicDialog"; -import TableForm from "@/common/TableForm"; -import UsePromiseCond from "@/common/utils/UsePromiseCond"; + import { DEFAULT_WEIGHT, getPlaylist, PlaylistData, setPlaylist, } from "./utils"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import { HandsontableProps, HotTableClass } from "@/common/Handsontable"; interface Props { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/index.tsx index 6235ebe43c..4a28e9af22 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/index.tsx @@ -12,6 +12,12 @@ * This file is part of the Antares project. */ +import { useState } from "react"; +import * as R from "ramda"; +import * as RA from "ramda-adjunct"; +import { useTranslation } from "react-i18next"; + +import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import { Accordion, AccordionDetails, @@ -20,28 +26,28 @@ import { Divider, Grid2 as Grid, } from "@mui/material"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import * as R from "ramda"; -import * as RA from "ramda-adjunct"; -import { useState } from "react"; +import Stack from "@mui/material/Stack"; + import { StudyMetadata } from "@/common/types"; -import SwitchFE from "@/common/fieldEditors/SwitchFE"; -import { SubmitHandlerPlus, UseFormReturnPlus } from "@/common/Form/types"; -import SearchFE from "@/common/fieldEditors/SearchFE"; -import { isSearchMatching } from "@/utils/stringUtils"; -import FormDialog from "@/common/dialogs/FormDialog"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import SearchFE from "@/components/common/fieldEditors/SearchFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import { - THEMATIC_TRIMMING_GROUPS, - getFieldLabelsForGroup, - type ThematicTrimmingGroup, -} from "./utils"; -import type { ThematicTrimmingConfig } from "@/services/api/studies/config/thematicTrimming/types"; + SubmitHandlerPlus, + UseFormReturnPlus, +} from "@/components/common/Form/types"; import { getThematicTrimmingConfig, setThematicTrimmingConfig, } from "@/services/api/studies/config/thematicTrimming"; -import { useTranslation } from "react-i18next"; -import Stack from "@mui/material/Stack"; +import type { ThematicTrimmingConfig } from "@/services/api/studies/config/thematicTrimming/types"; +import { isSearchMatching } from "@/utils/stringUtils"; + +import { + getFieldLabelsForGroup, + THEMATIC_TRIMMING_GROUPS, + type ThematicTrimmingGroup, +} from "./utils"; interface Props { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/utils.ts b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/utils.ts index 7084f8afb1..72b7925429 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/dialogs/ThematicTrimmingDialog/utils.ts @@ -13,9 +13,10 @@ */ import * as R from "ramda"; -import { ThematicTrimmingConfig } from "@/services/api/studies/config/thematicTrimming/types"; import { O } from "ts-toolbelt"; +import { ThematicTrimmingConfig } from "@/services/api/studies/config/thematicTrimming/types"; + export const THEMATIC_TRIMMING_GROUPS = [ "general", "generationHydro", diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/General/index.tsx index 6e6a8e6675..8436a58c3a 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/index.tsx @@ -12,13 +12,18 @@ * This file is part of the Antares project. */ -import { useOutletContext } from "react-router"; -import * as R from "ramda"; import { useState } from "react"; +import * as R from "ramda"; +import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; -import Fields from "./Fields"; -import ThematicTrimmingDialog from "./dialogs/ThematicTrimmingDialog"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; + +import ScenarioBuilderDialog from "./dialogs/ScenarioBuilderDialog"; import ScenarioPlaylistDialog from "./dialogs/ScenarioPlaylistDialog"; +import ThematicTrimmingDialog from "./dialogs/ThematicTrimmingDialog"; +import Fields from "./Fields"; import { GeneralFormFields, getGeneralFormFields, @@ -27,9 +32,6 @@ import { SetDialogStateType, setGeneralFormFields, } from "./utils"; -import ScenarioBuilderDialog from "./dialogs/ScenarioBuilderDialog"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function General() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/General/utils.ts b/webapp/src/components/App/Singlestudy/explore/Configuration/General/utils.ts index 53659f9a17..1be37225eb 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/General/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/General/utils.ts @@ -13,6 +13,7 @@ */ import * as R from "ramda"; + import { StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/Fields.tsx index 3d624c82f6..3cb47b734e 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/Fields.tsx @@ -12,9 +12,16 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; import { useTranslation } from "react-i18next"; + +import { Box } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import Fieldset from "@/components/common/Fieldset"; +import { useFormContextPlus } from "@/components/common/Form"; + import { LEGACY_TRANSMISSION_CAPACITIES_OPTIONS, OptimizationFormFields, @@ -23,10 +30,6 @@ import { TRANSMISSION_CAPACITIES_OPTIONS, UNFEASIBLE_PROBLEM_BEHAVIOR_OPTIONS, } from "./utils"; -import SelectFE from "@/components/common/fieldEditors/SelectFE"; -import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; -import Fieldset from "@/components/common/Fieldset"; -import { useFormContextPlus } from "@/components/common/Form"; interface Props { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/index.tsx index 4301fa197b..0668d7a84e 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/index.tsx @@ -13,15 +13,17 @@ */ import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; + import Fields from "./Fields"; import { getOptimizationFormFields, OptimizationFormFields, setOptimizationFormFields, } from "./utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function Optimization() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/utils.ts b/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/utils.ts index 579efe7354..881e73fb39 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/Optimization/utils.ts @@ -17,7 +17,6 @@ import * as R from "ramda"; //////////////////////////////////////////////////////////////// // Enums //////////////////////////////////////////////////////////////// - import { StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/Fields.tsx index 1f95bc8590..ee90a479aa 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/Fields.tsx @@ -12,6 +12,9 @@ * This file is part of the Antares project. */ +import { capitalize } from "lodash"; +import * as R from "ramda"; + import { Table, TableBody, @@ -20,15 +23,15 @@ import { TableHead, TableRow, } from "@mui/material"; -import { capitalize } from "lodash"; -import * as R from "ramda"; -import { TSFormFields, SEASONAL_CORRELATION_OPTIONS, TSType } from "./utils"; + import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; import NumberFE from "@/components/common/fieldEditors/NumberFE"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import { useFormContextPlus } from "@/components/common/Form"; +import { SEASONAL_CORRELATION_OPTIONS, TSFormFields, TSType } from "./utils"; + const borderStyle = "1px solid rgba(255, 255, 255, 0.12)"; function Fields() { diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/index.tsx index 5d763b5868..405d87279f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/index.tsx @@ -13,15 +13,17 @@ */ import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; + import Fields from "./Fields"; import { getTimeSeriesFormFields, setTimeSeriesFormFields, TSFormFields, } from "./utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function TimeSeriesManagement() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/utils.ts b/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/utils.ts index 7c223c1914..cd4e88a315 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/TimeSeriesManagement/utils.ts @@ -13,6 +13,7 @@ */ import { DeepPartial } from "react-hook-form"; + import { StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; diff --git a/webapp/src/components/App/Singlestudy/explore/Configuration/index.tsx b/webapp/src/components/App/Singlestudy/explore/Configuration/index.tsx index 26bee5fb6e..143d4fa2b7 100644 --- a/webapp/src/components/App/Singlestudy/explore/Configuration/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Configuration/index.tsx @@ -12,22 +12,25 @@ * This file is part of the Antares project. */ -import * as R from "ramda"; import { useMemo, useState } from "react"; -import { useOutletContext } from "react-router"; +import * as R from "ramda"; import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; -import AdequacyPatch from "./AdequacyPatch"; -import AdvancedParameters from "./AdvancedParameters"; -import General from "./General"; -import Optimization from "./Optimization"; -import TimeSeriesManagement from "./TimeSeriesManagement"; import ViewWrapper from "@/components/common/page/ViewWrapper"; import PropertiesView from "@/components/common/PropertiesView"; import SplitView from "@/components/common/SplitView"; import TableMode from "@/components/common/TableMode"; + import ListElement from "../common/ListElement"; +import AdequacyPatch from "./AdequacyPatch"; +import AdvancedParameters from "./AdvancedParameters"; +import General from "./General"; +import Optimization from "./Optimization"; +import TimeSeriesManagement from "./TimeSeriesManagement"; + function Configuration() { const { study } = useOutletContext<{ study: StudyMetadata }>(); const [currentTabIndex, setCurrentTabIndex] = useState(0); diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Folder.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Folder.tsx index ca3b51fc2e..0f640f205d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Folder.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Folder.tsx @@ -12,6 +12,14 @@ * This file is part of the Antares project. */ +import { Fragment, useState } from "react"; +import { useSnackbar } from "notistack"; +import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import FolderIcon from "@mui/icons-material/Folder"; +import MoreVertIcon from "@mui/icons-material/MoreVert"; import { Divider, IconButton, @@ -24,31 +32,27 @@ import { Menu, MenuItem, } from "@mui/material"; -import FolderIcon from "@mui/icons-material/Folder"; -import MoreVertIcon from "@mui/icons-material/MoreVert"; -import DeleteIcon from "@mui/icons-material/Delete"; -import { Fragment, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Filename, Menubar } from "./styles"; -import useConfirm from "@/hooks/useConfirm"; -import { deleteFile } from "@/services/api/studies/raw"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { toError } from "@/utils/fnUtils"; -import { useOutletContext } from "react-router"; + import type { StudyMetadata } from "@/common/types"; -import { useSnackbar } from "notistack"; import UploadFileButton from "@/components/common/buttons/UploadFileButton"; import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; import EmptyView from "@/components/common/page/SimpleContent"; +import useConfirm from "@/hooks/useConfirm"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { deleteFile } from "@/services/api/studies/raw"; +import { toError } from "@/utils/fnUtils"; + import { + canEditFile, DataCompProps, - TreeFolder, - isFolder, - getFileType, getFileIcon, - canEditFile, + getFileType, + isFolder, + TreeFolder, } from "../utils"; +import { Filename, Menubar } from "./styles"; + function Folder(props: DataCompProps) { const { filename, diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx index f68162e937..2e8986be2c 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx @@ -13,11 +13,15 @@ */ import { useTranslation } from "react-i18next"; + import ImageIcon from "@mui/icons-material/Image"; -import { Filename, Flex, Menubar } from "./styles"; -import { DataCompProps } from "../utils"; + import EmptyView from "@/components/common/page/SimpleContent"; +import { DataCompProps } from "../utils"; + +import { Filename, Flex, Menubar } from "./styles"; + function Image({ filename }: DataCompProps) { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Json.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Json.tsx index 87dafb1232..0b538a2aa7 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Json.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Json.tsx @@ -12,19 +12,22 @@ * This file is part of the Antares project. */ -import { useTranslation } from "react-i18next"; -import { useSnackbar } from "notistack"; -import { editStudy, getStudyData } from "@/services/api/study"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import { downloadFile } from "@/utils/fileUtils"; import { useEffect, useState } from "react"; -import { Filename, Flex, Menubar } from "./styles"; +import { useSnackbar } from "notistack"; +import { useTranslation } from "react-i18next"; + import DownloadButton from "@/components/common/buttons/DownloadButton"; import UploadFileButton from "@/components/common/buttons/UploadFileButton"; import JSONEditor, { JSONEditorProps } from "@/components/common/JSONEditor"; import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import { editStudy, getStudyData } from "@/services/api/study"; +import { downloadFile } from "@/utils/fileUtils"; + import { DataCompProps } from "../utils"; +import { Filename, Flex, Menubar } from "./styles"; + function Json({ filePath, filename, studyId, canEdit }: DataCompProps) { const [t] = useTranslation(); const { enqueueSnackbar } = useSnackbar(); diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Matrix.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Matrix.tsx index 4d97686ca9..d4348d5b34 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Matrix.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Matrix.tsx @@ -13,6 +13,7 @@ */ import Matrix from "@/components/common/Matrix"; + import { DataCompProps } from "../utils"; function DebugMatrix({ studyId, filename, filePath, canEdit }: DataCompProps) { diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Text.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Text.tsx index ccebe2c8af..658e23c92f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Text.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Text.tsx @@ -13,25 +13,29 @@ */ import { useTranslation } from "react-i18next"; -import { Box, useTheme } from "@mui/material"; -import { getStudyData } from "@/services/api/study"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { Light as SyntaxHighlighter, type SyntaxHighlighterProps, } from "react-syntax-highlighter"; -import xml from "react-syntax-highlighter/dist/esm/languages/hljs/xml"; -import plaintext from "react-syntax-highlighter/dist/esm/languages/hljs/plaintext"; import ini from "react-syntax-highlighter/dist/esm/languages/hljs/ini"; +import plaintext from "react-syntax-highlighter/dist/esm/languages/hljs/plaintext"; import properties from "react-syntax-highlighter/dist/esm/languages/hljs/properties"; +import xml from "react-syntax-highlighter/dist/esm/languages/hljs/xml"; import { atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs"; -import { downloadFile } from "@/utils/fileUtils"; -import { Filename, Flex, Menubar } from "./styles"; + +import { Box, useTheme } from "@mui/material"; + import DownloadButton from "@/components/common/buttons/DownloadButton"; import UploadFileButton from "@/components/common/buttons/UploadFileButton"; import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import { getStudyData } from "@/services/api/study"; +import { downloadFile } from "@/utils/fileUtils"; + import { DataCompProps } from "../utils"; +import { Filename, Flex, Menubar } from "./styles"; + SyntaxHighlighter.registerLanguage("xml", xml); SyntaxHighlighter.registerLanguage("plaintext", plaintext); SyntaxHighlighter.registerLanguage("ini", ini); diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx index d0f7b523f6..a79924323e 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx @@ -12,14 +12,16 @@ * This file is part of the Antares project. */ -import Text from "./Text"; +import type { StudyMetadata } from "@/common/types"; +import ViewWrapper from "@/components/common/page/ViewWrapper"; + +import { canEditFile, DataCompProps, FileInfo, FileType } from "../utils"; + +import Folder from "./Folder"; import Image from "./Image"; import Json from "./Json"; import Matrix from "./Matrix"; -import Folder from "./Folder"; -import type { StudyMetadata } from "@/common/types"; -import { canEditFile, DataCompProps, FileInfo, FileType } from "../utils"; -import ViewWrapper from "@/components/common/page/ViewWrapper"; +import Text from "./Text"; interface Props extends FileInfo { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/DebugContext.ts b/webapp/src/components/App/Singlestudy/explore/Debug/DebugContext.ts index ad175b2f5f..83940c035f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/DebugContext.ts +++ b/webapp/src/components/App/Singlestudy/explore/Debug/DebugContext.ts @@ -13,9 +13,11 @@ */ import { createContext } from "react"; -import type { FileInfo } from "./utils"; + import { voidFn } from "@/utils/fnUtils"; +import type { FileInfo } from "./utils"; + const initialDebugContextValue = { setSelectedFile: voidFn<[FileInfo]>, reloadTreeData: voidFn, diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Tree/FileTreeItem.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Tree/FileTreeItem.tsx index a87b76e33f..e52e5d160d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Tree/FileTreeItem.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Tree/FileTreeItem.tsx @@ -12,11 +12,14 @@ * This file is part of the Antares project. */ -import TreeItemEnhanced from "@/components/common/TreeItemEnhanced"; -import { Box } from "@mui/material"; import { useContext } from "react"; + +import { Box } from "@mui/material"; + +import TreeItemEnhanced from "@/components/common/TreeItemEnhanced"; + import DebugContext from "../DebugContext"; -import { TreeData, getFileType, getFileIcon, isFolder } from "../utils"; +import { getFileIcon, getFileType, isFolder, TreeData } from "../utils"; interface Props { name: string; diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Tree/index.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Tree/index.tsx index 90e275bdbe..54d7893566 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Tree/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Tree/index.tsx @@ -13,10 +13,13 @@ */ import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView"; -import FileTreeItem from "./FileTreeItem"; + import { getParentPaths } from "@/utils/pathUtils"; + import { TreeFolder } from "../utils"; +import FileTreeItem from "./FileTreeItem"; + interface Props { data: TreeFolder; // `currentPath` must not be `undefined` to make `SimpleTreeView` controlled diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/index.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/index.tsx index 98dcc61813..742217f135 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/index.tsx @@ -13,25 +13,28 @@ */ import { useMemo, useState } from "react"; +import * as R from "ramda"; import { useTranslation } from "react-i18next"; import { useOutletContext, useSearchParams } from "react-router-dom"; +import { useUpdateEffect } from "react-use"; + import { Box } from "@mui/material"; -import Tree from "./Tree"; -import Data from "./Data"; + import { StudyMetadata } from "@/common/types"; +import SplitView from "@/components/common/SplitView"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { getStudyData } from "@/services/api/study"; + +import Data from "./Data"; import DebugContext from "./DebugContext"; +import Tree from "./Tree"; import { + type FileInfo, getFileType, type TreeData, - type FileInfo, type TreeFolder, } from "./utils"; -import * as R from "ramda"; -import { useUpdateEffect } from "react-use"; -import SplitView from "@/components/common/SplitView"; -import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; function Debug() { const [t] = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts b/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts index 61f356e824..bbe0e031f4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts @@ -12,13 +12,15 @@ * This file is part of the Antares project. */ +import * as RA from "ramda-adjunct"; + +import { SvgIconComponent } from "@mui/icons-material"; import DataObjectIcon from "@mui/icons-material/DataObject"; -import TextSnippetIcon from "@mui/icons-material/TextSnippet"; -import ImageIcon from "@mui/icons-material/Image"; -import FolderIcon from "@mui/icons-material/Folder"; import DatasetIcon from "@mui/icons-material/Dataset"; -import { SvgIconComponent } from "@mui/icons-material"; -import * as RA from "ramda-adjunct"; +import FolderIcon from "@mui/icons-material/Folder"; +import ImageIcon from "@mui/icons-material/Image"; +import TextSnippetIcon from "@mui/icons-material/TextSnippet"; + import type { StudyMetadata } from "@/common/types"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreaPropsView.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreaPropsView.tsx index 44e2859fc5..51209d9469 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreaPropsView.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreaPropsView.tsx @@ -13,11 +13,13 @@ */ import { useEffect, useState } from "react"; + import { Area } from "@/common/types"; +import PropertiesView from "@/components/common/PropertiesView"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreas } from "@/redux/selectors"; import { transformNameToId } from "@/services/utils"; -import PropertiesView from "@/components/common/PropertiesView"; + import ListElement from "../../common/ListElement"; interface PropsType { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreasTab.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreasTab.tsx index 66b7e0d30b..74566d37a1 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreasTab.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/AreasTab.tsx @@ -13,11 +13,13 @@ */ import { useEffect, useMemo } from "react"; -import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; import { useTranslation } from "react-i18next"; +import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; + import { StudyMetadata } from "@/common/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + import TabWrapper from "../../TabWrapper"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/AllocationField.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/AllocationField.tsx index e0a7a35ea7..c392a839a4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/AllocationField.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/AllocationField.tsx @@ -12,13 +12,16 @@ * This file is part of the Antares project. */ -import { Typography, Grid } from "@mui/material"; import { FieldArrayWithId } from "react-hook-form"; -import NumberFE from "@/common/fieldEditors/NumberFE"; -import { useFormContextPlus } from "@/common/Form"; -import { AllocationFormFields } from "./utils"; + +import { Grid, Typography } from "@mui/material"; + +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import { useFormContextPlus } from "@/components/common/Form"; import { validateNumber } from "@/utils/validation/number"; +import { AllocationFormFields } from "./utils"; + interface Props { field: FieldArrayWithId; index: number; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/Fields.tsx index edd0d26041..ba710f6228 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/Fields.tsx @@ -14,14 +14,17 @@ import { useFieldArray } from "react-hook-form"; import { useOutletContext } from "react-router"; -import { useFormContextPlus } from "@/common/Form"; -import { AllocationFormFields } from "./utils"; -import AllocationField from "./AllocationField"; -import DynamicList from "@/common/DynamicList"; + +import { StudyMetadata } from "@/common/types"; +import DynamicList from "@/components/common/DynamicList"; +import { useFormContextPlus } from "@/components/common/Form"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreasById } from "@/redux/selectors"; -import { StudyMetadata } from "@/common/types"; -import { useAreasOptions } from "@/hooks/useAreasOptions"; + +import { useAreasOptions } from "../hooks/useAreasOptions"; + +import AllocationField from "./AllocationField"; +import { AllocationFormFields } from "./utils"; function Fields() { const { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/index.tsx index e337adf970..c23a275dec 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/index.tsx @@ -12,24 +12,28 @@ * This file is part of the Antares project. */ -import { Grid } from "@mui/material"; -import { useOutletContext } from "react-router"; import { useState } from "react"; -import Fields from "./Fields"; +import { useOutletContext } from "react-router"; + +import { Grid } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + +import HydroMatrixDialog from "../HydroMatrixDialog"; +import { FormBox, FormPaper } from "../style"; +import { HydroMatrix } from "../utils"; +import ViewMatrixButton from "../ViewMatrixButton"; + +import Fields from "./Fields"; import { AllocationFormFields, getAllocationFormFields, setAllocationFormFields, } from "./utils"; -import Form from "@/components/common/Form"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import HydroMatrixDialog from "../HydroMatrixDialog"; -import { FormBox, FormPaper } from "../style"; -import { HydroMatrix } from "../utils"; -import ViewMatrixButton from "../ViewMatrixButton"; function Allocation() { const { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/utils.ts index 7b05690cf1..3710c71570 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Allocation/utils.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { StudyMetadata, Area } from "@/common/types"; +import { Area, StudyMetadata } from "@/common/types"; import { MatrixDataDTO } from "@/components/common/Matrix/shared/types"; import client from "@/services/api/client"; + import { AreaCoefficientItem } from "../utils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/CorrelationField.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/CorrelationField.tsx index d0d88498dc..0f0d2fc9b2 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/CorrelationField.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/CorrelationField.tsx @@ -12,15 +12,18 @@ * This file is part of the Antares project. */ -import { Typography, Grid } from "@mui/material"; import { FieldArrayWithId } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { CorrelationFormFields } from "./utils"; + +import { Grid, Typography } from "@mui/material"; + +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import { useFormContextPlus } from "@/components/common/Form"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentArea } from "@/redux/selectors"; import { validateNumber } from "@/utils/validation/number"; -import { useFormContextPlus } from "@/components/common/Form"; -import NumberFE from "@/components/common/fieldEditors/NumberFE"; + +import { CorrelationFormFields } from "./utils"; interface Props { field: FieldArrayWithId; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/Fields.tsx index ff811d8d33..3e2bc3eb6d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/Fields.tsx @@ -14,14 +14,17 @@ import { useFieldArray } from "react-hook-form"; import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import DynamicList from "@/components/common/DynamicList"; +import { useFormContextPlus } from "@/components/common/Form"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreasById, getCurrentArea } from "@/redux/selectors"; + +import { useAreasOptions } from "../hooks/useAreasOptions"; + import CorrelationField from "./CorrelationField"; import { CorrelationFormFields } from "./utils"; -import DynamicList from "@/components/common/DynamicList"; -import { useFormContextPlus } from "@/components/common/Form"; -import { useAreasOptions } from "../hooks/useAreasOptions"; function Fields() { const { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/index.tsx index dcce1bba5f..6fe7249272 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/index.tsx @@ -12,24 +12,28 @@ * This file is part of the Antares project. */ -import { Grid } from "@mui/material"; -import { useOutletContext } from "react-router"; import { useState } from "react"; +import { useOutletContext } from "react-router"; + +import { Grid } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + +import HydroMatrixDialog from "../HydroMatrixDialog"; +import { FormBox, FormPaper } from "../style"; +import { HydroMatrix } from "../utils"; +import ViewMatrixButton from "../ViewMatrixButton"; + +import Fields from "./Fields"; import { CorrelationFormFields, getCorrelationFormFields, setCorrelationFormFields, } from "./utils"; -import Fields from "./Fields"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; -import HydroMatrixDialog from "../HydroMatrixDialog"; -import { FormBox, FormPaper } from "../style"; -import ViewMatrixButton from "../ViewMatrixButton"; -import { HydroMatrix } from "../utils"; function Correlation() { const { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/utils.ts index 94dddc6d69..48eb9986dd 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/Correlation/utils.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { StudyMetadata, Area } from "@/common/types"; +import { Area, StudyMetadata } from "@/common/types"; import { MatrixDataDTO } from "@/components/common/Matrix/shared/types"; import client from "@/services/api/client"; + import { AreaCoefficientItem } from "../utils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrix.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrix.tsx index 928fa96b87..69f9ddae07 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrix.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrix.tsx @@ -12,12 +12,14 @@ * This file is part of the Antares project. */ -import Matrix from "@/components/common/Matrix"; -import { MATRICES, HydroMatrixType } from "./utils"; import { Box } from "@mui/material"; + +import Matrix from "@/components/common/Matrix"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; +import { HydroMatrixType, MATRICES } from "./utils"; + interface Props { type: HydroMatrixType; } diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrixDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrixDialog.tsx index 7231fc14d4..e737308fd4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrixDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrixDialog.tsx @@ -12,22 +12,25 @@ * This file is part of the Antares project. */ -import { Button, Box, Skeleton } from "@mui/material"; +import { useEffect, useState } from "react"; +import { AxiosError } from "axios"; import { useTranslation } from "react-i18next"; -import { useState, useEffect } from "react"; - -import { HydroMatrixType } from "./utils"; -import { getAllocationMatrix } from "./Allocation/utils"; -import { getCorrelationMatrix } from "./Correlation/utils"; import { useOutletContext } from "react-router"; -import { StudyMetadata } from "../../../../../../../common/types"; -import { MatrixDataDTO } from "@/components/common/Matrix/shared/types"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { AxiosError } from "axios"; + +import { Box, Button, Skeleton } from "@mui/material"; + import BasicDialog, { BasicDialogProps, } from "@/components/common/dialogs/BasicDialog"; import Matrix from "@/components/common/Matrix"; +import { MatrixDataDTO } from "@/components/common/Matrix/shared/types"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; + +import { StudyMetadata } from "../../../../../../../common/types"; + +import { getAllocationMatrix } from "./Allocation/utils"; +import { getCorrelationMatrix } from "./Correlation/utils"; +import { HydroMatrixType } from "./utils"; interface AdaptedMatrixData { data: number[][]; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/InflowStructure/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/InflowStructure/index.tsx index f0a635f4de..fb384ecc84 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/InflowStructure/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/InflowStructure/index.tsx @@ -12,19 +12,21 @@ * This file is part of the Antares project. */ +import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + import { - type InflowStructureFields, getInflowStructureFields, + type InflowStructureFields, updateInflowStructureFields, } from "./utils"; -import { useTranslation } from "react-i18next"; -import NumberFE from "@/components/common/fieldEditors/NumberFE"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function InflowStructure() { const [t] = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/Fields.tsx index 05c9df7e08..b9d852bf18 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/Fields.tsx @@ -17,7 +17,8 @@ import SelectFE from "@/components/common/fieldEditors/SelectFE"; import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import Fieldset from "@/components/common/Fieldset"; import { useFormContextPlus } from "@/components/common/Form"; -import { INITIALIZE_RESERVOIR_DATE_OPTIONS, HydroFormFields } from "./utils"; + +import { HydroFormFields, INITIALIZE_RESERVOIR_DATE_OPTIONS } from "./utils"; function Fields() { const { control, watch } = useFormContextPlus(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/index.tsx index c623a8f9cb..c03b0ecb17 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions/index.tsx @@ -13,17 +13,19 @@ */ import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + import Fields from "./Fields"; import { getManagementOptionsFormFields, HydroFormFields, setManagementOptionsFormFields, } from "./utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function ManagementOptions() { const { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/SplitHydroMatrix.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/SplitHydroMatrix.tsx index 1755045401..1c14ed286b 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/SplitHydroMatrix.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/SplitHydroMatrix.tsx @@ -13,9 +13,11 @@ */ import { Box } from "@mui/material"; + +import SplitView, { SplitViewProps } from "@/components/common/SplitView"; + import HydroMatrix from "./HydroMatrix"; import { HydroMatrixType } from "./utils"; -import SplitView, { SplitViewProps } from "@/components/common/SplitView"; interface Props { types: [HydroMatrixType, HydroMatrixType]; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ViewMatrixButton.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ViewMatrixButton.tsx index e049eec4c2..421084cdb5 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ViewMatrixButton.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/ViewMatrixButton.tsx @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { Button } from "@mui/material"; import { useTranslation } from "react-i18next"; +import { Button } from "@mui/material"; + interface Props { label: string; onClick: () => void; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/hooks/useAreasOptions.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/hooks/useAreasOptions.ts index cffa05fb4e..bfa979dba9 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/hooks/useAreasOptions.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/hooks/useAreasOptions.ts @@ -14,10 +14,12 @@ import { useMemo } from "react"; import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; +import { DynamicListProps } from "@/components/common/DynamicList"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreas } from "@/redux/selectors"; -import { DynamicListProps } from "@/components/common/DynamicList"; + import { AreaCoefficientItem } from "../utils"; export function useAreasOptions( diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/index.tsx index 6e24ce5331..b9477abb3f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/index.tsx @@ -14,9 +14,11 @@ import { useMemo } from "react"; import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + import TabWrapper from "../../../TabWrapper"; function Hydro() { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/style.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/style.ts index b329679cc6..733e373eb0 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/style.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/style.ts @@ -12,7 +12,7 @@ * This file is part of the Antares project. */ -import { styled, Box, Paper } from "@mui/material"; +import { Box, Paper, styled } from "@mui/material"; export const FormBox = styled(Box)(({ theme }) => ({ width: "100%", diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/utils.ts index 9980e4b538..1d35a00bc3 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Hydro/utils.ts @@ -13,10 +13,11 @@ */ import { - MatrixDataDTO, AggregateConfig, + MatrixDataDTO, } from "@/components/common/Matrix/shared/types"; import { SplitViewProps } from "@/components/common/SplitView"; + import { getAllocationMatrix } from "./Allocation/utils"; import { getCorrelationMatrix } from "./Correlation/utils"; import InflowStructure from "./InflowStructure"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/Fields.tsx index a9327305ee..52b0f72dab 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/Fields.tsx @@ -12,10 +12,10 @@ * This file is part of the Antares project. */ +import { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; -import { useMemo } from "react"; -import { ADEQUACY_PATCH_OPTIONS, PropertiesFormFields } from "./utils"; + import { StudyMetadata } from "@/common/types"; import NumberFE from "@/components/common/fieldEditors/NumberFE"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; @@ -23,6 +23,8 @@ import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import Fieldset from "@/components/common/Fieldset"; import { useFormContextPlus } from "@/components/common/Form"; +import { ADEQUACY_PATCH_OPTIONS, PropertiesFormFields } from "./utils"; + function Fields() { const { t } = useTranslation(); const { control } = useFormContextPlus(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/index.tsx index 7ff6ce5ec7..69bdc8bbee 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/index.tsx @@ -12,19 +12,22 @@ * This file is part of the Antares project. */ -import { Paper } from "@mui/material"; import { useOutletContext } from "react-router"; + +import { Paper } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + +import Fields from "./Fields"; import { - PropertiesFormFields, getPropertiesFormFields, + PropertiesFormFields, setPropertiesFormFields, } from "./utils"; -import Fields from "./Fields"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function Properties() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/utils.ts index 102ea2ae4f..842704d514 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Properties/utils.ts @@ -17,6 +17,7 @@ //////////////////////////////////////////////////////////////// import { DeepPartial } from "redux"; + import { Area, StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Fields.tsx index 2b4953c2f9..629d593175 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Fields.tsx @@ -13,11 +13,7 @@ */ import { useTranslation } from "react-i18next"; -import { - RENEWABLE_GROUPS, - RenewableCluster, - TS_INTERPRETATION_OPTIONS, -} from "./utils"; + import NumberFE from "@/components/common/fieldEditors/NumberFE"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; import StringFE from "@/components/common/fieldEditors/StringFE"; @@ -25,6 +21,12 @@ import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import Fieldset from "@/components/common/Fieldset"; import { useFormContextPlus } from "@/components/common/Form"; +import { + RENEWABLE_GROUPS, + RenewableCluster, + TS_INTERPRETATION_OPTIONS, +} from "./utils"; + function Fields() { const [t] = useTranslation(); const { control } = useFormContextPlus(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Form.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Form.tsx index 4382060f05..c321f30f1a 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Form.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/Form.tsx @@ -13,24 +13,27 @@ */ import { useCallback } from "react"; -import { Box, Button } from "@mui/material"; -import { useParams, useOutletContext, useNavigate } from "react-router-dom"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import { useTranslation } from "react-i18next"; +import { useNavigate, useOutletContext, useParams } from "react-router-dom"; + +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { Box, Button } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import useNavigateOnCondition from "@/hooks/useNavigateOnCondition"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getCurrentAreaId } from "@/redux/selectors"; +import { nameToId } from "@/services/utils"; + import Fields from "./Fields"; import Matrix from "./Matrix"; import { - RenewableCluster, getRenewableCluster, + RenewableCluster, updateRenewableCluster, } from "./utils"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getCurrentAreaId } from "@/redux/selectors"; -import useNavigateOnCondition from "@/hooks/useNavigateOnCondition"; -import { nameToId } from "@/services/utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function Renewables() { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/index.tsx index e557be1a6c..fd40947314 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/index.tsx @@ -14,32 +14,36 @@ import { useMemo, useState } from "react"; import { createMRTColumnHelper } from "material-react-table"; -import { Box } from "@mui/material"; -import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; import { useTranslation } from "react-i18next"; +import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; + +import { Box } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; -import { - RENEWABLE_GROUPS, - RenewableGroup, - createRenewableCluster, - deleteRenewableClusters, - duplicateRenewableCluster, - getRenewableClusters, - type RenewableClusterWithCapacity, -} from "./utils"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getCurrentAreaId } from "@/redux/selectors"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import GroupedDataTable from "@/components/common/GroupedDataTable"; import BooleanCell from "@/components/common/GroupedDataTable/cellRenderers/BooleanCell"; import { TRow } from "@/components/common/GroupedDataTable/types"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getCurrentAreaId } from "@/redux/selectors"; + import { addClusterCapacity, + capacityAggregationFn, getClustersWithCapacityTotals, toCapacityString, - capacityAggregationFn, } from "../common/clustersUtils"; +import { + createRenewableCluster, + deleteRenewableClusters, + duplicateRenewableCluster, + getRenewableClusters, + RENEWABLE_GROUPS, + type RenewableClusterWithCapacity, + RenewableGroup, +} from "./utils"; + const columnHelper = createMRTColumnHelper(); function Renewables() { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/utils.ts index d3178cd1d1..9320fac7f2 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Renewables/utils.ts @@ -15,6 +15,7 @@ import { Area, Cluster, StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; import type { PartialExceptFor } from "@/utils/tsUtils"; + import { ClusterWithCapacity } from "../common/clustersUtils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Fields.tsx index 0390d82e12..de401a3d61 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Fields.tsx @@ -13,18 +13,21 @@ */ import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router"; + import { Box, Tooltip } from "@mui/material"; + +import { StudyMetadata } from "@/common/types"; import NumberFE from "@/components/common/fieldEditors/NumberFE"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; import StringFE from "@/components/common/fieldEditors/StringFE"; import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import Fieldset from "@/components/common/Fieldset"; import { useFormContextPlus } from "@/components/common/Form"; -import { STORAGE_GROUPS, Storage } from "./utils"; -import { useOutletContext } from "react-router"; -import { StudyMetadata } from "@/common/types"; import { validateNumber } from "@/utils/validation/number"; +import { Storage, STORAGE_GROUPS } from "./utils"; + function Fields() { const [t] = useTranslation(); const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Form.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Form.tsx index 3a605c2c34..ab6a582fb2 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Form.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Form.tsx @@ -13,21 +13,24 @@ */ import { useCallback } from "react"; -import { Box, Button } from "@mui/material"; -import { useParams, useOutletContext, useNavigate } from "react-router-dom"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; -import { useTranslation } from "react-i18next"; import * as RA from "ramda-adjunct"; +import { useTranslation } from "react-i18next"; +import { useNavigate, useOutletContext, useParams } from "react-router-dom"; + +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { Box, Button } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; -import Fields from "./Fields"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import useNavigateOnCondition from "@/hooks/useNavigateOnCondition"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; -import { Storage, getStorage, updateStorage } from "./utils"; -import Matrix from "./Matrix"; -import useNavigateOnCondition from "@/hooks/useNavigateOnCondition"; import { nameToId } from "@/services/utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; + +import Fields from "./Fields"; +import Matrix from "./Matrix"; +import { getStorage, Storage, updateStorage } from "./utils"; function Storages() { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Matrix.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Matrix.tsx index 0c47c907e2..3e9e59d824 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Matrix.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/Matrix.tsx @@ -13,13 +13,15 @@ */ import { useMemo, useState } from "react"; -import Tabs from "@mui/material/Tabs"; -import Tab from "@mui/material/Tab"; -import Box from "@mui/material/Box"; import { useTranslation } from "react-i18next"; -import { StudyMetadata, MatrixItem } from "@/common/types"; -import SplitView from "@/components/common/SplitView"; + +import Box from "@mui/material/Box"; +import Tab from "@mui/material/Tab"; +import Tabs from "@mui/material/Tabs"; + +import { MatrixItem, StudyMetadata } from "@/common/types"; import Matrix from "@/components/common/Matrix"; +import SplitView from "@/components/common/SplitView"; interface Props { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/index.tsx index 63cbcf25de..f840e5240b 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/index.tsx @@ -13,27 +13,30 @@ */ import { useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; import { createMRTColumnHelper } from "material-react-table"; -import { Box, Tooltip } from "@mui/material"; +import { useTranslation } from "react-i18next"; import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; + +import { Box, Tooltip } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import GroupedDataTable from "@/components/common/GroupedDataTable"; +import BooleanCell from "@/components/common/GroupedDataTable/cellRenderers/BooleanCell"; +import { TRow } from "@/components/common/GroupedDataTable/types"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaId } from "@/redux/selectors"; + import { - Storage, - getStorages, - deleteStorages, createStorage, - STORAGE_GROUPS, - StorageGroup, + deleteStorages, duplicateStorage, + getStorages, getStoragesTotals, + Storage, + STORAGE_GROUPS, + StorageGroup, } from "./utils"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import GroupedDataTable from "@/components/common/GroupedDataTable"; -import BooleanCell from "@/components/common/GroupedDataTable/cellRenderers/BooleanCell"; -import { TRow } from "@/components/common/GroupedDataTable/types"; const columnHelper = createMRTColumnHelper(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/utils.ts index 9415369234..b3e2035ac1 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Storages/utils.ts @@ -12,7 +12,7 @@ * This file is part of the Antares project. */ -import { StudyMetadata, Area } from "@/common/types"; +import { Area, StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; import type { PartialExceptFor } from "@/utils/tsUtils"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Fields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Fields.tsx index 6daa4dcb94..3a48f3d698 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Fields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Fields.tsx @@ -14,8 +14,18 @@ import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; -import { StudyMetadata } from "@/common/types"; + import Box from "@mui/material/Box"; + +import { StudyMetadata } from "@/common/types"; +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import Fieldset from "@/components/common/Fieldset"; +import { useFormContextPlus } from "@/components/common/Form"; +import { validateNumber } from "@/utils/validation/number"; + import { COST_GENERATION_OPTIONS, THERMAL_GROUPS, @@ -24,13 +34,6 @@ import { TS_GENERATION_OPTIONS, TS_LAW_OPTIONS, } from "./utils"; -import { validateNumber } from "@/utils/validation/number"; -import NumberFE from "@/components/common/fieldEditors/NumberFE"; -import SelectFE from "@/components/common/fieldEditors/SelectFE"; -import StringFE from "@/components/common/fieldEditors/StringFE"; -import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; -import Fieldset from "@/components/common/Fieldset"; -import { useFormContextPlus } from "@/components/common/Form"; function Fields() { const [t] = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Form.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Form.tsx index 46e25f6020..bc215661dc 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Form.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Form.tsx @@ -13,24 +13,27 @@ */ import { useCallback } from "react"; -import { Box, Button } from "@mui/material"; -import { useParams, useOutletContext, useNavigate } from "react-router-dom"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import { useTranslation } from "react-i18next"; +import { useNavigate, useOutletContext, useParams } from "react-router-dom"; + +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { Box, Button } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import useNavigateOnCondition from "@/hooks/useNavigateOnCondition"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getCurrentAreaId } from "@/redux/selectors"; +import { nameToId } from "@/services/utils"; + import Fields from "./Fields"; import Matrix from "./Matrix"; import { - ThermalCluster, getThermalCluster, + ThermalCluster, updateThermalCluster, } from "./utils"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getCurrentAreaId } from "@/redux/selectors"; -import useNavigateOnCondition from "@/hooks/useNavigateOnCondition"; -import { nameToId } from "@/services/utils"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; -import Form from "@/components/common/Form"; function ThermalForm() { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Matrix.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Matrix.tsx index f468f7eef6..bb8ad6a7f4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Matrix.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/Matrix.tsx @@ -13,14 +13,17 @@ */ import { useMemo, useState } from "react"; -import Tabs from "@mui/material/Tabs"; -import Tab from "@mui/material/Tab"; -import Box from "@mui/material/Box"; import { useTranslation } from "react-i18next"; + +import Box from "@mui/material/Box"; +import Tab from "@mui/material/Tab"; +import Tabs from "@mui/material/Tabs"; + import { Cluster, StudyMetadata } from "@/common/types"; -import { COMMON_MATRIX_COLS, TS_GEN_MATRIX_COLS } from "./utils"; import Matrix from "@/components/common/Matrix"; +import { COMMON_MATRIX_COLS, TS_GEN_MATRIX_COLS } from "./utils"; + interface Props { study: StudyMetadata; areaId: string; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/index.tsx index 4a2f046703..beb73ac7cb 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/index.tsx @@ -14,32 +14,36 @@ import { useMemo, useState } from "react"; import { createMRTColumnHelper } from "material-react-table"; -import { Box } from "@mui/material"; -import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; import { useTranslation } from "react-i18next"; +import { useLocation, useNavigate, useOutletContext } from "react-router-dom"; + +import { Box } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; -import { - getThermalClusters, - createThermalCluster, - deleteThermalClusters, - THERMAL_GROUPS, - ThermalGroup, - duplicateThermalCluster, - type ThermalClusterWithCapacity, -} from "./utils"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getCurrentAreaId } from "@/redux/selectors"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import GroupedDataTable from "@/components/common/GroupedDataTable"; import BooleanCell from "@/components/common/GroupedDataTable/cellRenderers/BooleanCell"; import { TRow } from "@/components/common/GroupedDataTable/types"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getCurrentAreaId } from "@/redux/selectors"; + import { addClusterCapacity, + capacityAggregationFn, getClustersWithCapacityTotals, toCapacityString, - capacityAggregationFn, } from "../common/clustersUtils"; +import { + createThermalCluster, + deleteThermalClusters, + duplicateThermalCluster, + getThermalClusters, + THERMAL_GROUPS, + type ThermalClusterWithCapacity, + ThermalGroup, +} from "./utils"; + const columnHelper = createMRTColumnHelper(); function Thermal() { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/utils.ts index ef06e3a509..0aee77a519 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/Thermal/utils.ts @@ -15,6 +15,7 @@ import { Area, Cluster, StudyMetadata } from "@/common/types"; import client from "@/services/api/client"; import type { PartialExceptFor } from "@/utils/tsUtils"; + import { ClusterWithCapacity } from "../common/clustersUtils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/common/clustersUtils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/common/clustersUtils.ts index c0d03067e0..f923ac13b5 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/common/clustersUtils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/common/clustersUtils.ts @@ -13,8 +13,9 @@ */ import { MRT_AggregationFn } from "material-react-table"; -import { ThermalClusterWithCapacity } from "@/Thermal/utils"; -import { RenewableClusterWithCapacity } from "@/Renewables/utils"; + +import { RenewableClusterWithCapacity } from "../Renewables/utils"; +import { ThermalClusterWithCapacity } from "../Thermal/utils"; export function toCapacityString( enabledCapacity: number, diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/index.tsx index 927c07edc3..50b336542e 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/index.tsx @@ -13,18 +13,20 @@ */ import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; -import AreaPropsView from "./AreaPropsView"; -import AreasTab from "./AreasTab"; -import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; -import { getStudySynthesis, getCurrentArea } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { setCurrentArea } from "@/redux/ducks/studySyntheses"; -import useAppSelector from "@/redux/hooks/useAppSelector"; import EmptyView from "@/components/common/page/SimpleContent"; import ViewWrapper from "@/components/common/page/ViewWrapper"; import SplitView from "@/components/common/SplitView"; import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import { setCurrentArea } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; +import { getCurrentArea, getStudySynthesis } from "@/redux/selectors"; + +import AreaPropsView from "./AreaPropsView"; +import AreasTab from "./AreasTab"; function Areas() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/style.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/style.ts index 73594af06e..49c55f80bd 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/style.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Areas/style.ts @@ -12,7 +12,7 @@ * This file is part of the Antares project. */ -import { styled, Box } from "@mui/material"; +import { Box, styled } from "@mui/material"; export const Root = styled(Box)(({ theme }) => ({ width: "100%", diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/AddDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/AddDialog.tsx index 95351e113c..dc4bd256ce 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/AddDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/AddDialog.tsx @@ -13,30 +13,34 @@ */ import { useMemo } from "react"; -import { Box } from "@mui/material"; -import { useTranslation } from "react-i18next"; import { useSnackbar } from "notistack"; -import { - BindingConstraint, - OPERATORS, - TIME_STEPS, -} from "./BindingConstView/utils"; -import { createBindingConstraint } from "@/services/api/studydata"; -import { StudyMetadata } from "@/common/types"; -import { setCurrentBindingConst } from "@/redux/ducks/studySyntheses"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import { Control } from "react-hook-form"; +import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; -import { validateString } from "@/utils/validation/string"; + +import { Box } from "@mui/material"; + +import { StudyMetadata } from "@/common/types"; import FormDialog from "@/components/common/dialogs/FormDialog"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; import StringFE from "@/components/common/fieldEditors/StringFE"; import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import { setCurrentBindingConst } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import { createBindingConstraint } from "@/services/api/studydata"; +import { validateString } from "@/utils/validation/string"; + import { - TimeStep, BindingConstraintOperator, + TimeStep, } from "../../../Commands/Edition/commandTypes"; -import { Control } from "react-hook-form"; + +import { + BindingConstraint, + OPERATORS, + TIME_STEPS, +} from "./BindingConstView/utils"; interface Props { open: boolean; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstPropsView.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstPropsView.tsx index 9f86b1357f..f224f10326 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstPropsView.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstPropsView.tsx @@ -14,11 +14,13 @@ import { useEffect, useMemo, useState } from "react"; -import AddDialog from "./AddDialog"; -import { BindingConstraint } from "./BindingConstView/utils"; import PropertiesView from "@/components/common/PropertiesView"; + import ListElement from "../../common/ListElement"; +import { BindingConstraint } from "./BindingConstView/utils"; +import AddDialog from "./AddDialog"; + interface Props { list: BindingConstraint[]; onClick: (name: string) => void; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/OptionsList.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/OptionsList.tsx index 2add52f781..11f467f259 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/OptionsList.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/OptionsList.tsx @@ -13,11 +13,13 @@ */ import { useEffect } from "react"; -import { useTranslation } from "react-i18next"; import { useFormContext } from "react-hook-form"; -import SelectFE from "@/common/fieldEditors/SelectFE"; +import { useTranslation } from "react-i18next"; + import { AllClustersAndLinks } from "@/common/types"; -import { ConstraintTerm, isTermExist, generateTermId } from "@/utils"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; + +import { ConstraintTerm, generateTermId, isTermExist } from "../../utils"; interface Props { list: AllClustersAndLinks; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/index.tsx index 139d2bb789..9ff506c28e 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/AddConstraintTermForm/index.tsx @@ -13,16 +13,20 @@ */ import { useState } from "react"; -import { Box, Button, Typography } from "@mui/material"; -import AddCircleOutlineRoundedIcon from "@mui/icons-material/AddCircleOutlineRounded"; import { useTranslation } from "react-i18next"; + +import AddCircleOutlineRoundedIcon from "@mui/icons-material/AddCircleOutlineRounded"; +import { Box, Button, Typography } from "@mui/material"; + import { AllClustersAndLinks } from "@/common/types"; +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import { useFormContextPlus } from "@/components/common/Form"; + +import ConstraintElement from "../../constraintviews/ConstraintElement"; +import OffsetInput from "../../constraintviews/OffsetInput"; +import { ConstraintTerm } from "../../utils"; + import OptionsList from "./OptionsList"; -import NumberFE from "@/common/fieldEditors/NumberFE"; -import { useFormContextPlus } from "@/common/Form"; -import { type ConstraintTerm } from "@/utils"; -import ConstraintElement from "@/constraintviews/ConstraintElement"; -import OffsetInput from "@/constraintviews/OffsetInput"; interface Props { options: AllClustersAndLinks; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/index.tsx index 971766e128..a38a35348b 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/AddConstraintTermDialog/index.tsx @@ -12,25 +12,26 @@ * This file is part of the Antares project. */ +import { BaseSyntheticEvent } from "react"; import { AxiosError } from "axios"; -import { useTranslation } from "react-i18next"; import { useSnackbar } from "notistack"; import { UseFieldArrayAppend } from "react-hook-form"; -import FormDialog, { FormDialogProps } from "@/common/dialogs/FormDialog"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { - isLinkTerm, - type BindingConstraint, - type ConstraintTerm, -} from "@/utils"; -import AddConstraintTermForm from "./AddConstraintTermForm"; -import { createConstraintTerm } from "@/services/api/studydata"; +import { useTranslation } from "react-i18next"; + import { AllClustersAndLinks } from "@/common/types"; +import FormDialog, { + FormDialogProps, +} from "@/components/common/dialogs/FormDialog"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; import { getLinksAndClusters } from "@/redux/selectors"; -import { BaseSyntheticEvent } from "react"; -import UsePromiseCond from "@/common/utils/UsePromiseCond"; +import { createConstraintTerm } from "@/services/api/studydata"; + +import { BindingConstraint, ConstraintTerm, isLinkTerm } from "../utils"; + +import AddConstraintTermForm from "./AddConstraintTermForm"; interface Props extends Omit { studyId: string; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/BindingConstForm.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/BindingConstForm.tsx index 4dea259d19..1b1adce5d4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/BindingConstForm.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/BindingConstForm.tsx @@ -12,32 +12,35 @@ * This file is part of the Antares project. */ -import { AxiosError } from "axios"; import { useMemo, useState } from "react"; +import { AxiosError } from "axios"; +import { useSnackbar } from "notistack"; +import { useFieldArray } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { Box, Button } from "@mui/material"; + import AddCircleOutlineRoundedIcon from "@mui/icons-material/AddCircleOutlineRounded"; import DeleteIcon from "@mui/icons-material/Delete"; -import { useFieldArray } from "react-hook-form"; -import { useSnackbar } from "notistack"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { - type ConstraintTerm, - generateTermId, - BindingConstraint, -} from "./utils"; +import { Box, Button } from "@mui/material"; + import { AllClustersAndLinks, StudyMetadata } from "@/common/types"; -import ConstraintTermItem from "./ConstraintTerm"; -import { useFormContextPlus } from "@/common/Form"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import Fieldset from "@/components/common/Fieldset"; +import { useFormContextPlus } from "@/components/common/Form"; +import TextSeparator from "@/components/common/TextSeparator"; +import useDebounce from "@/hooks/useDebounce"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { deleteConstraintTerm, updateConstraintTerm, } from "@/services/api/studydata"; -import TextSeparator from "@/common/TextSeparator"; + import AddConstraintTermDialog from "./AddConstraintTermDialog"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; -import useDebounce from "@/hooks/useDebounce"; -import Fieldset from "@/common/Fieldset"; +import ConstraintTermItem from "./ConstraintTerm"; +import { + BindingConstraint, + type ConstraintTerm, + generateTermId, +} from "./utils"; interface Props { study: StudyMetadata; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintFields.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintFields.tsx index 9512f8b59a..c97ab15651 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintFields.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintFields.tsx @@ -12,6 +12,21 @@ * This file is part of the Antares project. */ +import { useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; + +import { Dataset } from "@mui/icons-material"; +import { Box, Button } from "@mui/material"; + +import { StudyMetadata } from "@/common/types"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import Fieldset from "@/components/common/Fieldset"; +import { useFormContextPlus } from "@/components/common/Form"; +import { validateString } from "@/utils/validation/string"; + +import ConstraintMatrix from "./Matrix"; import { BindingConstraint, OPERATORS, @@ -19,19 +34,6 @@ import { TIME_STEPS, } from "./utils"; -import Fieldset from "@/common/Fieldset"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { StudyMetadata } from "@/common/types"; -import SwitchFE from "@/common/fieldEditors/SwitchFE"; -import { useFormContextPlus } from "@/common/Form"; -import { useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Box, Button } from "@mui/material"; -import { Dataset } from "@mui/icons-material"; -import { validateString } from "@/utils/validation/string"; -import ConstraintMatrix from "./Matrix"; - interface Props { study: StudyMetadata; constraintId: string; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/OptionsList.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/OptionsList.tsx index c717ec623f..4d87e3d86f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/OptionsList.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/OptionsList.tsx @@ -14,11 +14,14 @@ import { useMemo } from "react"; import { useTranslation } from "react-i18next"; -import { AllClustersAndLinks } from "@/common/types"; -import SelectSingle from "@/common/SelectSingle"; -import { ConstraintTerm, generateTermId, isTermExist } from "@/utils"; + import { Box } from "@mui/material"; +import { AllClustersAndLinks } from "@/common/types"; +import SelectSingle from "@/components/common/SelectSingle"; + +import { ConstraintTerm, generateTermId, isTermExist } from "../utils"; + interface Option { id: string; name: string; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/index.tsx index 59a6be6f73..d1140b0310 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/ConstraintTerm/index.tsx @@ -13,15 +13,19 @@ */ import { ChangeEvent, useMemo, useState } from "react"; -import { Box, Button, TextField, Typography } from "@mui/material"; +import { useTranslation } from "react-i18next"; + import AddCircleOutlineRoundedIcon from "@mui/icons-material/AddCircleOutlineRounded"; import DeleteRoundedIcon from "@mui/icons-material/DeleteRounded"; -import { useTranslation } from "react-i18next"; -import { ConstraintTerm, isLinkTerm } from "@/utils"; +import { Box, Button, TextField, Typography } from "@mui/material"; + import { AllClustersAndLinks } from "@/common/types"; + +import ConstraintElement from "../constraintviews/ConstraintElement"; +import OffsetInput from "../constraintviews/OffsetInput"; +import { ConstraintTerm, isLinkTerm } from "../utils"; + import OptionsList from "./OptionsList"; -import ConstraintElement from "@/constraintviews/ConstraintElement"; -import OffsetInput from "@/constraintviews/OffsetInput"; interface Props { options: AllClustersAndLinks; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/Matrix.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/Matrix.tsx index e7a10184c8..36ad9c20a2 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/Matrix.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/Matrix.tsx @@ -13,8 +13,9 @@ */ import { useTranslation } from "react-i18next"; -import { Operator } from "./utils"; + import { Box, Button } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; import BasicDialog, { BasicDialogProps, @@ -22,6 +23,8 @@ import BasicDialog, { import Matrix from "@/components/common/Matrix"; import SplitView from "@/components/common/SplitView"; +import { Operator } from "./utils"; + interface Props { study: StudyMetadata; operator: Operator; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/ConstraintElement.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/ConstraintElement.tsx index 757c2eb019..a162029fe8 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/ConstraintElement.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/ConstraintElement.tsx @@ -12,11 +12,13 @@ * This file is part of the Antares project. */ -import { FormControlLabel, Switch, Typography } from "@mui/material"; import { ReactNode } from "react"; -import { ConstraintElementData, ConstraintElementRoot } from "./style"; import { useTranslation } from "react-i18next"; +import { FormControlLabel, Switch, Typography } from "@mui/material"; + +import { ConstraintElementData, ConstraintElementRoot } from "./style"; + interface ElementProps { left: ReactNode; right: ReactNode; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/OffsetInput.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/OffsetInput.tsx index f63a7288c1..373717d15b 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/OffsetInput.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/constraintviews/OffsetInput.tsx @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ +import { PropsWithChildren } from "react"; + import HighlightOffIcon from "@mui/icons-material/HighlightOff"; import { Box } from "@mui/material"; -import { PropsWithChildren } from "react"; interface Props { onRemove: () => void; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/index.tsx index 5c2c67c7df..381e5f1309 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/index.tsx @@ -12,35 +12,39 @@ * This file is part of the Antares project. */ -import { BindingConstraint } from "./utils"; +import { useState } from "react"; +import { AxiosError } from "axios"; +import { t } from "i18next"; +import { useSnackbar } from "notistack"; +import { useOutletContext } from "react-router"; + +import Delete from "@mui/icons-material/Delete"; import { Box, Button, Paper, Skeleton } from "@mui/material"; -import Form from "@/common/Form"; -import UsePromiseCond, { mergeResponses } from "@/common/utils/UsePromiseCond"; + +import { StudyMetadata } from "@/common/types"; +import { CommandEnum } from "@/components/App/Singlestudy/Commands/Edition/commandTypes"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import Form from "@/components/common/Form"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import UsePromiseCond, { + mergeResponses, +} from "@/components/common/utils/UsePromiseCond"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromise from "@/hooks/usePromise"; +import { setCurrentBindingConst } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; +import { getLinksAndClusters } from "@/redux/selectors"; import { getBindingConstraint, getBindingConstraintList, updateBindingConstraint, } from "@/services/api/studydata"; -import { useOutletContext } from "react-router"; +import { appendCommands } from "@/services/api/variant"; -import { AxiosError } from "axios"; import BindingConstForm from "./BindingConstForm"; -import { CommandEnum } from "@/Commands/Edition/commandTypes"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; import ConstraintFields from "./ConstraintFields"; -import Delete from "@mui/icons-material/Delete"; -import { StudyMetadata } from "@/common/types"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import { appendCommands } from "@/services/api/variant"; -import { getLinksAndClusters } from "@/redux/selectors"; -import { setCurrentBindingConst } from "@/redux/ducks/studySyntheses"; -import { t } from "i18next"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import usePromise from "@/hooks/usePromise"; -import { useSnackbar } from "notistack"; -import { useState } from "react"; -import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; +import { BindingConstraint } from "./utils"; interface Props { constraintId: string; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/index.tsx index b313e1cc8b..ec68fe4cfd 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/BindingConstraints/index.tsx @@ -12,22 +12,25 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; +import { useEffect } from "react"; import { useOutletContext } from "react-router"; + +import { Box } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; -import BindingConstPropsView from "./BindingConstPropsView"; -import { getBindingConst, getCurrentBindingConstId } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { setCurrentBindingConst } from "@/redux/ducks/studySyntheses"; -import BindingConstView from "./BindingConstView"; -import usePromise from "@/hooks/usePromise"; -import { getBindingConstraintList } from "@/services/api/studydata"; -import { useEffect } from "react"; -import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; import SimpleLoader from "@/components/common/loaders/SimpleLoader"; import EmptyView from "@/components/common/page/SimpleContent"; import SplitView from "@/components/common/SplitView"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import usePromise from "@/hooks/usePromise"; +import { setCurrentBindingConst } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getBindingConst, getCurrentBindingConstId } from "@/redux/selectors"; +import { getBindingConstraintList } from "@/services/api/studydata"; + +import BindingConstPropsView from "./BindingConstPropsView"; +import BindingConstView from "./BindingConstView"; function BindingConstraints() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkPropsView.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkPropsView.tsx index 86082a2a14..936f494b1d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkPropsView.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkPropsView.tsx @@ -13,10 +13,12 @@ */ import { useEffect, useState } from "react"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getCurrentLinkId, getLinks } from "@/redux/selectors"; + import { LinkElement } from "@/common/types"; import PropertiesView from "@/components/common/PropertiesView"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getCurrentLinkId, getLinks } from "@/redux/selectors"; + import ListElement from "../../common/ListElement"; interface PropsType { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkForm.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkForm.tsx index 830497aaf1..a6c1348276 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkForm.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkForm.tsx @@ -12,13 +12,12 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; -import { AxiosError } from "axios"; import { useMemo } from "react"; +import { AxiosError } from "axios"; import { useTranslation } from "react-i18next"; -import { editStudy } from "@/services/api/study"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { getLinkPath, LinkFields } from "./utils"; + +import { Box } from "@mui/material"; + import { LinkElement, StudyMetadata } from "@/common/types"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; @@ -26,8 +25,13 @@ import Fieldset from "@/components/common/Fieldset"; import { useFormContextPlus } from "@/components/common/Form"; import { AutoSubmitHandler } from "@/components/common/Form/types"; import Matrix from "@/components/common/Matrix"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { editStudy } from "@/services/api/study"; + import OutputFilters from "../../../common/OutputFilters"; + import LinkMatrixView from "./LinkMatrixView"; +import { getLinkPath, LinkFields } from "./utils"; interface Props { link: LinkElement; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkMatrixView.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkMatrixView.tsx index af0bf650f8..5f2a89f6dc 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkMatrixView.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/LinkMatrixView.tsx @@ -13,11 +13,13 @@ */ import { SyntheticEvent, useMemo, useState } from "react"; -import Tabs from "@mui/material/Tabs"; -import Tab from "@mui/material/Tab"; -import Box from "@mui/material/Box"; import { useTranslation } from "react-i18next"; -import { StudyMetadata, MatrixItem } from "@/common/types"; + +import Box from "@mui/material/Box"; +import Tab from "@mui/material/Tab"; +import Tabs from "@mui/material/Tabs"; + +import { MatrixItem, StudyMetadata } from "@/common/types"; import Matrix from "@/components/common/Matrix"; import SplitView from "@/components/common/SplitView"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/index.tsx index 5d9a475821..0e7a127098 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/index.tsx @@ -13,12 +13,14 @@ */ import { useOutletContext } from "react-router"; + import { LinkElement, StudyMetadata } from "@/common/types"; +import Form from "@/components/common/Form"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; import usePromise from "@/hooks/usePromise"; + import LinkForm from "./LinkForm"; import { getDefaultValues } from "./utils"; -import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; -import Form from "@/components/common/Form"; interface Props { link: LinkElement; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/utils.ts index 7f59b9e4f3..7ba74715c6 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/LinkView/utils.ts @@ -13,8 +13,10 @@ */ import { FieldValues } from "react-hook-form"; + import { getStudyData } from "@/services/api/study"; -import { FilteringType } from "@/common/types"; + +import { FilteringType } from "../../../common/types"; type TransCapacitiesType = "infinite" | "ignore" | "enabled"; type AssetType = "ac" | "dc" | "gaz" | "virt"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/index.tsx index cd303caf9c..4508c00925 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Links/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Links/index.tsx @@ -13,17 +13,19 @@ */ import { useOutletContext } from "react-router"; + import { StudyMetadata } from "@/common/types"; -import LinkPropsView from "./LinkPropsView"; -import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; -import { getCurrentLink } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { setCurrentLink } from "@/redux/ducks/studySyntheses"; -import LinkView from "./LinkView"; import EmptyView from "@/components/common/page/SimpleContent"; import ViewWrapper from "@/components/common/page/ViewWrapper"; import SplitView from "@/components/common/SplitView"; import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import { setCurrentLink } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; +import { getCurrentLink } from "@/redux/selectors"; + +import LinkPropsView from "./LinkPropsView"; +import LinkView from "./LinkView"; function Links() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaConfig.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaConfig.tsx index beb021f05e..6de637ce2f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaConfig.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaConfig.tsx @@ -14,19 +14,20 @@ import { useEffect, useState } from "react"; import { ColorResult, MaterialPicker } from "react-color"; -import { Box, TextField, Divider } from "@mui/material"; import { useTranslation } from "react-i18next"; -import { LinkElement, UpdateAreaUi } from "@/common/types"; -import AreaLinks from "./AreaLinks"; -import AreaLink from "./AreaLink"; +import { Box, Divider, TextField } from "@mui/material"; -import { AreaColorPicker, AreaHuePicker } from "./style"; -import DeleteAreaDialog from "./DeleteAreaDialog"; +import { LinkElement, UpdateAreaUi } from "@/common/types"; import { StudyMapNode } from "@/redux/ducks/studyMaps"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentLayer } from "@/redux/selectors"; +import AreaLink from "./AreaLink"; +import AreaLinks from "./AreaLinks"; +import DeleteAreaDialog from "./DeleteAreaDialog"; +import { AreaColorPicker, AreaHuePicker } from "./style"; + interface Props { node?: StudyMapNode; updateUI: (id: string, value: UpdateAreaUi) => void; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLink.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLink.tsx index ff6f437bc2..1e79b7e4ae 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLink.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLink.tsx @@ -13,6 +13,7 @@ */ import { useTranslation } from "react-i18next"; + import { LinkElement } from "@/common/types"; import { setCurrentArea, setCurrentLink } from "@/redux/ducks/studySyntheses"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; @@ -20,9 +21,9 @@ import useAppDispatch from "@/redux/hooks/useAppDispatch"; import { AreaLinkContainer, AreaLinkContent, + AreaLinkLabel, AreaLinkRoot, AreaLinkTitle, - AreaLinkLabel, } from "./style"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLinks.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLinks.tsx index 2283b84abc..e1b511e437 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLinks.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/AreaLinks.tsx @@ -14,11 +14,13 @@ import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router-dom"; + import { StudyMetadata } from "@/common/types"; import { setCurrentArea, setCurrentLink } from "@/redux/ducks/studySyntheses"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentAreaLinks } from "@/redux/selectors"; + import { AreaLinkContainer, AreaLinkContent, diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/DeleteAreaDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/DeleteAreaDialog.tsx index c94f139d7b..4859c9ad8d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/DeleteAreaDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/DeleteAreaDialog.tsx @@ -12,12 +12,15 @@ * This file is part of the Antares project. */ -import { Box, Button, Typography } from "@mui/material"; -import { AxiosError } from "axios"; import { useState } from "react"; +import { AxiosError } from "axios"; import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; + +import { Box, Button, Typography } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { deleteStudyMapLink, @@ -27,7 +30,7 @@ import { } from "@/redux/ducks/studyMaps"; import { setCurrentArea, setCurrentLink } from "@/redux/ducks/studySyntheses"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; + import { AreaDeleteIcon } from "./style"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/index.tsx index 8b772838a8..7a36429b21 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/index.tsx @@ -14,17 +14,20 @@ import { useEffect, useState } from "react"; import { useOutletContext } from "react-router-dom"; + import { StudyMetadata, UpdateAreaUi } from "@/common/types"; -import PropertiesView from "@/common/PropertiesView"; -import ListElement from "@/common/ListElement"; -import { AreasContainer } from "./style"; +import PropertiesView from "@/components/common/PropertiesView"; +import { StudyMapNode } from "@/redux/ducks/studyMaps"; +import { setCurrentArea } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentLink, getCurrentStudyMapNode } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import AreaConfig from "./AreaConfig"; import { isSearchMatching } from "@/utils/stringUtils"; -import { setCurrentArea } from "@/redux/ducks/studySyntheses"; -import { StudyMapNode } from "@/redux/ducks/studyMaps"; + +import ListElement from "../../../common/ListElement"; + +import AreaConfig from "./AreaConfig"; +import { AreasContainer } from "./style"; interface Props { onAdd: () => void; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/style.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/style.ts index aabe4c4bf2..e0106bf45a 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/style.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Areas/style.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { styled, Box } from "@mui/material"; import { HuePicker } from "react-color"; + import DeleteIcon from "@mui/icons-material/Delete"; +import { Box, styled } from "@mui/material"; export const AreasContainer = styled(Box)(() => ({ width: "100%", diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/CreateAreaDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/CreateAreaDialog.tsx index 9e8de943a2..e3a11ed2e1 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/CreateAreaDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/CreateAreaDialog.tsx @@ -13,13 +13,15 @@ */ import { useTranslation } from "react-i18next"; + import AddCircleIcon from "@mui/icons-material/AddCircle"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; + +import FormDialog from "@/components/common/dialogs/FormDialog"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreas } from "@/redux/selectors"; -import Fieldset from "@/common/Fieldset"; import { validateString } from "@/utils/validation/string"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/CreateDistrictDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/CreateDistrictDialog.tsx index bd24df08fb..15c16b3ea4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/CreateDistrictDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/CreateDistrictDialog.tsx @@ -12,18 +12,20 @@ * This file is part of the Antares project. */ +import { useMemo } from "react"; import { useTranslation } from "react-i18next"; -import AddCircleIcon from "@mui/icons-material/AddCircle"; import { useOutletContext } from "react-router"; -import { useMemo } from "react"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; + +import AddCircleIcon from "@mui/icons-material/AddCircle"; + import { StudyMetadata } from "@/common/types"; -import SwitchFE from "@/common/fieldEditors/SwitchFE"; -import Fieldset from "@/common/Fieldset"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { createStudyMapDistrict } from "@/redux/ducks/studyMaps"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getStudyMapDistrictsById } from "@/redux/selectors"; import { validateString } from "@/utils/validation/string"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/UpdateDistrictDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/UpdateDistrictDialog.tsx index 07633b3781..5a0660f533 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/UpdateDistrictDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/UpdateDistrictDialog.tsx @@ -12,26 +12,28 @@ * This file is part of the Antares project. */ +import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; + import { Delete, Edit } from "@mui/icons-material"; import { Button, Typography } from "@mui/material"; -import { useState } from "react"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; + import { StudyMetadata } from "@/common/types"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getStudyMapDistrictsById } from "@/redux/selectors"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import Fieldset from "@/common/Fieldset"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; -import SwitchFE from "@/common/fieldEditors/SwitchFE"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { deleteStudyMapDistrict, updateStudyMapDistrict, } from "@/redux/ducks/studyMaps"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getStudyMapDistrictsById } from "@/redux/selectors"; interface Props { open: boolean; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/index.tsx index c27e2b0da4..b37ae9a00a 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Districts/index.tsx @@ -12,19 +12,22 @@ * This file is part of the Antares project. */ -import { Box, Button } from "@mui/material"; import { useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; + import { Add, Edit } from "@mui/icons-material"; -import { useTranslation } from "react-i18next"; +import { Box, Button } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import TableForm from "@/components/common/TableForm"; +import { updateStudyMapDistrict } from "@/redux/ducks/studyMaps"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreas, getStudyMapDistrictsById } from "@/redux/selectors"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import TableForm from "@/common/TableForm"; + import CreateDistrictDialog from "./CreateDistrictDialog"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { updateStudyMapDistrict } from "@/redux/ducks/studyMaps"; import UpdateDistrictDialog from "./UpdateDistrictDialog"; function Districts() { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/CreateLayerDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/CreateLayerDialog.tsx index 1633513d52..ba06f0bf15 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/CreateLayerDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/CreateLayerDialog.tsx @@ -12,18 +12,20 @@ * This file is part of the Antares project. */ +import { useMemo } from "react"; +import { AxiosError } from "axios"; import { useTranslation } from "react-i18next"; -import AddCircleIcon from "@mui/icons-material/AddCircle"; import { useOutletContext } from "react-router"; -import { AxiosError } from "axios"; -import { useMemo } from "react"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; + +import AddCircleIcon from "@mui/icons-material/AddCircle"; + import { StudyMetadata } from "@/common/types"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createStudyMapLayer } from "@/redux/ducks/studyMaps"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getStudyMapLayersById } from "@/redux/selectors"; import { validateString } from "@/utils/validation/string"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/UpdateLayerDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/UpdateLayerDialog.tsx index 0bc3e40dce..1811767051 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/UpdateLayerDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/UpdateLayerDialog.tsx @@ -12,25 +12,27 @@ * This file is part of the Antares project. */ +import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; + import { Delete, Edit } from "@mui/icons-material"; import { Button, Typography } from "@mui/material"; -import { useMemo, useState } from "react"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; + import { StudyMetadata } from "@/common/types"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getStudyMapLayersById } from "@/redux/selectors"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import Fieldset from "@/common/Fieldset"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { deleteStudyMapLayer, updateStudyMapLayer, } from "@/redux/ducks/studyMaps"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getStudyMapLayersById } from "@/redux/selectors"; import { validateString } from "@/utils/validation/string"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/index.tsx index 3ed7b6c6a5..c07a55c6db 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/Layers/index.tsx @@ -12,19 +12,22 @@ * This file is part of the Antares project. */ -import { Box, Button } from "@mui/material"; import { useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; + import { Add, Edit } from "@mui/icons-material"; -import { useTranslation } from "react-i18next"; +import { Box, Button } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; +import TableForm from "@/components/common/TableForm"; +import { updateStudyMapLayer } from "@/redux/ducks/studyMaps"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreas, getStudyMapLayersById } from "@/redux/selectors"; -import { SubmitHandlerPlus } from "@/common/Form/types"; -import TableForm from "@/common/TableForm"; + import CreateLayerDialog from "./CreateLayerDialog"; -import { updateStudyMapLayer } from "@/redux/ducks/studyMaps"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; import UpdateLayerDialog from "./UpdateLayerDialog"; function Layers() { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/index.tsx index e52842abc5..8a5a2b9d4f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapConfig/index.tsx @@ -12,13 +12,15 @@ * This file is part of the Antares project. */ -import { Box, Button, Tab } from "@mui/material"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; -import { useTranslation } from "react-i18next"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; + +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import { TabContext, TabList, TabPanel } from "@mui/lab"; -import Layers from "./Layers"; +import { Box, Button, Tab } from "@mui/material"; + import Districts from "./Districts"; +import Layers from "./Layers"; interface Props { onClose: () => void; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapControlButtons.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapControlButtons.tsx index 973245da0f..9f0d7303eb 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapControlButtons.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapControlButtons.tsx @@ -12,12 +12,13 @@ * This file is part of the Antares project. */ -import Button from "@mui/material/Button"; -import ButtonGroup from "@mui/material/ButtonGroup"; -import SettingsIcon from "@mui/icons-material/Settings"; import AddIcon from "@mui/icons-material/Add"; import RemoveIcon from "@mui/icons-material/Remove"; +import SettingsIcon from "@mui/icons-material/Settings"; import { Box } from "@mui/material"; +import Button from "@mui/material/Button"; +import ButtonGroup from "@mui/material/ButtonGroup"; + import { MAX_ZOOM_LEVEL, MIN_ZOOM_LEVEL } from "./utils"; interface Props { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapGraph.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapGraph.tsx index e03d807710..0e254d1c15 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapGraph.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapGraph.tsx @@ -12,12 +12,13 @@ * This file is part of the Antares project. */ +import { RefObject, useEffect, useState } from "react"; import { AxiosError } from "axios"; import { DebouncedFunc } from "lodash"; -import { RefObject, useEffect, useState } from "react"; import { Graph, GraphLink, GraphNode } from "react-d3-graph"; import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router-dom"; + import { LinkProperties, StudyMetadata } from "@/common/types"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { createStudyMapLink, StudyMapNode } from "@/redux/ducks/studyMaps"; @@ -26,6 +27,7 @@ import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentLayer } from "@/redux/selectors"; import { makeLinkId } from "@/redux/utils"; + import Node from "./Node"; import { INITIAL_ZOOM, useRenderNodes } from "./utils"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapHeader.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapHeader.tsx index df125b510c..5e72445ae7 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapHeader.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/MapHeader.tsx @@ -12,10 +12,12 @@ * This file is part of the Antares project. */ -import { Box, Chip, Typography } from "@mui/material"; import { useTranslation } from "react-i18next"; + +import { Box, Chip, Typography } from "@mui/material"; + import { LinkProperties } from "@/common/types"; -import { StudyMapNode, setCurrentLayer } from "@/redux/ducks/studyMaps"; +import { setCurrentLayer, StudyMapNode } from "@/redux/ducks/studyMaps"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getCurrentLayer, getStudyMapLayersById } from "@/redux/selectors"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Node.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Node.tsx index 398b7a869a..b00626578d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Node.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/Node.tsx @@ -13,7 +13,9 @@ */ import AddLinkIcon from "@mui/icons-material/AddLink"; + import { StudyMapNode } from "@/redux/ducks/studyMaps"; + import { NodeContainer, NodeDefault, NodeHighlighted } from "./style"; interface PropType { diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/index.tsx index 3b5bd6458a..ad5c201fb6 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/index.tsx @@ -13,41 +13,44 @@ */ import { useEffect, useMemo, useRef, useState } from "react"; -import { useOutletContext } from "react-router-dom"; -import AutoSizer from "react-virtualized-auto-sizer"; -import { useTranslation } from "react-i18next"; -import { Graph, GraphLink, GraphNode } from "react-d3-graph"; import { AxiosError } from "axios"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; +import { Graph, GraphLink, GraphNode } from "react-d3-graph"; +import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router-dom"; +import AutoSizer from "react-virtualized-auto-sizer"; + +import { Box } from "@mui/material"; + import { LinkProperties, StudyMetadata, UpdateAreaUi } from "@/common/types"; -import MapGraph from "./MapGraph"; -import Areas from "./Areas"; -import CreateAreaDialog from "./CreateAreaDialog"; +import SplitView from "@/components/common/SplitView"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import useDebouncedState from "@/hooks/useDebouncedState"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { getUpdatedNode, INITIAL_ZOOM, NODE_COLOR } from "./utils"; -import { MapContainer } from "./style"; +import { + createStudyMapNode, + StudyMapNode, + updateStudyMapNode, +} from "@/redux/ducks/studyMaps"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; +import useStudyMaps from "@/redux/hooks/useStudyMaps"; import { getCurrentLayer, getCurrentStudyMapNode, getStudyMapLinks, getStudyMapNodes, } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; + +import Areas from "./Areas"; +import CreateAreaDialog from "./CreateAreaDialog"; import MapConfig from "./MapConfig"; -import useStudyMaps from "@/redux/hooks/useStudyMaps"; -import { - StudyMapNode, - createStudyMapNode, - updateStudyMapNode, -} from "@/redux/ducks/studyMaps"; -import UsePromiseCond from "@/common/utils/UsePromiseCond"; -import MapHeader from "./MapHeader"; import MapControlButtons from "./MapControlButtons"; -import useDebouncedState from "@/hooks/useDebouncedState"; -import SplitView from "@/common/SplitView"; -import { Box } from "@mui/material"; +import MapGraph from "./MapGraph"; +import MapHeader from "./MapHeader"; +import { MapContainer } from "./style"; +import { getUpdatedNode, INITIAL_ZOOM, NODE_COLOR } from "./utils"; function Map() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/style.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/style.ts index 26fc46f753..e44965ee02 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/style.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/style.ts @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { styled, Box, Chip } from "@mui/material"; +import { Box, Chip, styled } from "@mui/material"; + import mapbackground from "@/assets/img/mapbackground.png"; + import { getTextColor, RGB } from "./utils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/utils.ts index 28e55a007c..465dabc085 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/Map/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/Map/utils.ts @@ -13,6 +13,7 @@ */ import { useMemo } from "react"; + import { StudyLayer } from "@/common/types"; import { StudyMapNode } from "@/redux/ducks/studyMaps"; diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/index.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/index.tsx index 77defaa9b9..fec6066cbc 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/index.tsx @@ -13,14 +13,17 @@ */ import { useEffect, useMemo } from "react"; +import { useTranslation } from "react-i18next"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; + import { Box } from "@mui/material"; -import { useTranslation } from "react-i18next"; + import { StudyMetadata } from "@/common/types"; +import { setCurrentArea } from "@/redux/ducks/studySyntheses"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAreas, getCurrentAreaId, getLinks } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { setCurrentArea } from "@/redux/ducks/studySyntheses"; + import TabWrapper from "../TabWrapper"; function Modelization() { diff --git a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/ResultFilters.tsx b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/ResultFilters.tsx index d6295c3127..5e28bfd33c 100644 --- a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/ResultFilters.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/ResultFilters.tsx @@ -12,13 +12,16 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; import { useTranslation } from "react-i18next"; -import { DataType, Timestep } from "./utils"; + +import { Box } from "@mui/material"; + +import DownloadMatrixButton from "../../../../../common/buttons/DownloadMatrixButton"; import BooleanFE from "../../../../../common/fieldEditors/BooleanFE"; -import SelectFE from "../../../../../common/fieldEditors/SelectFE"; import NumberFE from "../../../../../common/fieldEditors/NumberFE"; -import DownloadMatrixButton from "../../../../../common/buttons/DownloadMatrixButton"; +import SelectFE from "../../../../../common/fieldEditors/SelectFE"; + +import { DataType, Timestep } from "./utils"; interface Props { year: number; diff --git a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx index a040dd9c53..35a159543d 100644 --- a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx @@ -12,6 +12,11 @@ * This file is part of the Antares project. */ +import { useEffect, useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { useNavigate, useOutletContext, useParams } from "react-router"; + +import GridOffIcon from "@mui/icons-material/GridOff"; import { Box, Skeleton, @@ -19,16 +24,33 @@ import { ToggleButtonGroup, ToggleButtonGroupProps, } from "@mui/material"; -import { useEffect, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useNavigate, useOutletContext, useParams } from "react-router"; -import GridOffIcon from "@mui/icons-material/GridOff"; + import { Area, LinkElement, MatrixType, StudyMetadata } from "@/common/types"; +import ButtonBack from "@/components/common/ButtonBack"; +import MatrixGrid from "@/components/common/Matrix/components/MatrixGrid"; +import { Column } from "@/components/common/Matrix/shared/constants"; +import { + generateCustomColumns, + generateDateTime, +} from "@/components/common/Matrix/shared/utils"; +import EmptyView from "@/components/common/page/SimpleContent"; +import PropertiesView from "@/components/common/PropertiesView"; +import SplitView from "@/components/common/SplitView"; +import UsePromiseCond, { + mergeResponses, +} from "@/components/common/utils/UsePromiseCond"; import usePromise from "@/hooks/usePromise"; import useAppSelector from "@/redux/hooks/useAppSelector"; +import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; import { getAreas, getLinks, getStudyOutput } from "@/redux/selectors"; +import { getStudyMatrixIndex } from "@/services/api/matrix"; import { getStudyData } from "@/services/api/study"; +import { toError } from "@/utils/fnUtils"; import { isSearchMatching } from "@/utils/stringUtils"; + +import ListElement from "../../common/ListElement"; + +import ResultFilters from "./ResultFilters"; import { createPath, DataType, @@ -37,24 +59,6 @@ import { SYNTHESIS_ITEMS, Timestep, } from "./utils"; -import useStudySynthesis from "@/redux/hooks/useStudySynthesis"; -import { getStudyMatrixIndex } from "@/services/api/matrix"; -import SplitView from "@/components/common/SplitView"; -import PropertiesView from "@/components/common/PropertiesView"; -import ButtonBack from "@/components/common/ButtonBack"; -import ResultFilters from "./ResultFilters"; -import UsePromiseCond, { - mergeResponses, -} from "@/components/common/utils/UsePromiseCond"; -import MatrixGrid from "@/components/common/Matrix/components/MatrixGrid"; -import { - generateCustomColumns, - generateDateTime, -} from "@/components/common/Matrix/shared/utils"; -import { Column } from "@/components/common/Matrix/shared/constants"; -import EmptyView from "@/components/common/page/SimpleContent"; -import { toError } from "@/utils/fnUtils"; -import ListElement from "../../common/ListElement"; function ResultDetails() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Results/index.tsx b/webapp/src/components/App/Singlestudy/explore/Results/index.tsx index 991b3bb4b6..500e17cf2a 100644 --- a/webapp/src/components/App/Singlestudy/explore/Results/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Results/index.tsx @@ -12,6 +12,20 @@ * This file is part of the Antares project. */ +import { useMemo, useState } from "react"; +import { AxiosError } from "axios"; +import moment from "moment"; +import * as R from "ramda"; +import { useTranslation } from "react-i18next"; +import { useNavigate, useOutletContext } from "react-router-dom"; + +import ArchiveIcon from "@mui/icons-material/Archive"; +import CalendarTodayIcon from "@mui/icons-material/CalendarToday"; +import DeleteForeverIcon from "@mui/icons-material/DeleteForever"; +import DownloadIcon from "@mui/icons-material/Download"; +import EqualizerIcon from "@mui/icons-material/Equalizer"; +import EventAvailableIcon from "@mui/icons-material/EventAvailable"; +import UnarchiveIcon from "@mui/icons-material/Unarchive"; import { Box, CircularProgress, @@ -26,20 +40,13 @@ import { Tooltip, Typography, } from "@mui/material"; -import { useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import CalendarTodayIcon from "@mui/icons-material/CalendarToday"; -import EventAvailableIcon from "@mui/icons-material/EventAvailable"; -import ArchiveIcon from "@mui/icons-material/Archive"; -import UnarchiveIcon from "@mui/icons-material/Unarchive"; -import DownloadIcon from "@mui/icons-material/Download"; -import DeleteForeverIcon from "@mui/icons-material/DeleteForever"; -import EqualizerIcon from "@mui/icons-material/Equalizer"; -import * as R from "ramda"; -import { useNavigate, useOutletContext } from "react-router-dom"; import { grey } from "@mui/material/colors"; -import moment from "moment"; -import { AxiosError } from "axios"; + +import { LaunchJob, StudyMetadata, StudyOutput } from "@/common/types"; +import LaunchJobLogView from "@/components/App/Tasks/LaunchJobLogView"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import DigestDialog from "@/components/common/dialogs/DigestDialog"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { archiveOutput, @@ -49,13 +56,8 @@ import { getStudyOutputs, unarchiveOutput, } from "@/services/api/study"; -import { LaunchJob, StudyMetadata, StudyOutput } from "@/common/types"; import { convertUTCToLocalTime } from "@/services/utils"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import type { EmptyObject } from "@/utils/tsUtils"; -import LaunchJobLogView from "@/components/App/Tasks/LaunchJobLogView"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; -import DigestDialog from "@/components/common/dialogs/DigestDialog"; interface OutputDetail { name: string; diff --git a/webapp/src/components/App/Singlestudy/explore/TabWrapper.tsx b/webapp/src/components/App/Singlestudy/explore/TabWrapper.tsx index b443922883..b52fd79a50 100644 --- a/webapp/src/components/App/Singlestudy/explore/TabWrapper.tsx +++ b/webapp/src/components/App/Singlestudy/explore/TabWrapper.tsx @@ -14,11 +14,13 @@ import { useEffect, useState } from "react"; import * as React from "react"; +import { matchPath, Outlet, useLocation, useNavigate } from "react-router-dom"; + import { styled, SxProps, Theme } from "@mui/material"; -import Tabs from "@mui/material/Tabs"; -import Tab from "@mui/material/Tab"; import Box from "@mui/material/Box"; -import { Outlet, matchPath, useLocation, useNavigate } from "react-router-dom"; +import Tab from "@mui/material/Tab"; +import Tabs from "@mui/material/Tabs"; + import { StudyMetadata } from "@/common/types"; import { mergeSxProp } from "@/utils/muiUtils"; diff --git a/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/CreateTemplateTableDialog.tsx b/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/CreateTemplateTableDialog.tsx index f58cd07058..da1ce10a86 100644 --- a/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/CreateTemplateTableDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/CreateTemplateTableDialog.tsx @@ -13,12 +13,16 @@ */ import { useTranslation } from "react-i18next"; + import AddCircleIcon from "@mui/icons-material/AddCircle"; -import { createTableTemplate, type TableTemplate } from "@/utils"; + +import { SubmitHandlerPlus } from "@/components/common/Form/types"; + +import { createTableTemplate, TableTemplate } from "../utils"; + import TableTemplateFormDialog, { TableTemplateFormDialogProps, } from "./TableTemplateFormDialog"; -import { SubmitHandlerPlus } from "@/common/Form/types"; interface Props extends Pick { diff --git a/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/TableTemplateFormDialog.tsx b/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/TableTemplateFormDialog.tsx index 8452589fdb..eabb3ac192 100644 --- a/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/TableTemplateFormDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/TableTemplateFormDialog.tsx @@ -12,19 +12,24 @@ * This file is part of the Antares project. */ -import { Box } from "@mui/material"; +import { useMemo } from "react"; import { startCase } from "lodash"; import { useTranslation } from "react-i18next"; -import FormDialog, { FormDialogProps } from "@/common/dialogs/FormDialog"; -import ListFE from "@/common/fieldEditors/ListFE"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import StringFE from "@/common/fieldEditors/StringFE"; -import { getTableColumnsForType, type TableTemplate } from "@/utils"; + +import { Box } from "@mui/material"; + +import FormDialog, { + FormDialogProps, +} from "@/components/common/dialogs/FormDialog"; +import ListFE from "@/components/common/fieldEditors/ListFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; import { TABLE_MODE_TYPES } from "@/services/api/studies/tableMode/constants"; -import { useMemo } from "react"; import { validateArray } from "@/utils/validation/array"; import { validateString } from "@/utils/validation/string"; +import { getTableColumnsForType, TableTemplate } from "../utils"; + export interface TableTemplateFormDialogProps extends Pick< FormDialogProps, diff --git a/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/UpdateTemplateTableDialog.tsx b/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/UpdateTemplateTableDialog.tsx index 5935dc7bcb..7eca4c7c9a 100644 --- a/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/UpdateTemplateTableDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/TableModeList/dialogs/UpdateTemplateTableDialog.tsx @@ -13,12 +13,16 @@ */ import { useTranslation } from "react-i18next"; + import EditIcon from "@mui/icons-material/Edit"; + +import { SubmitHandlerPlus } from "@/components/common/Form/types"; + +import { TableTemplate } from "../utils"; + import TableTemplateFormDialog, { TableTemplateFormDialogProps, } from "./TableTemplateFormDialog"; -import { TableTemplate } from "@/utils"; -import { SubmitHandlerPlus } from "@/common/Form/types"; interface Props extends Pick { diff --git a/webapp/src/components/App/Singlestudy/explore/TableModeList/index.tsx b/webapp/src/components/App/Singlestudy/explore/TableModeList/index.tsx index 91f3cd04b3..a0d1f5d321 100644 --- a/webapp/src/components/App/Singlestudy/explore/TableModeList/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/TableModeList/index.tsx @@ -13,23 +13,27 @@ */ import { useState } from "react"; -import { MenuItem } from "@mui/material"; +import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router"; import { useUpdateEffect } from "react-use"; -import { useTranslation } from "react-i18next"; -import DeleteIcon from "@mui/icons-material/Delete"; import { v4 as uuidv4 } from "uuid"; -import PropertiesView from "@/common/PropertiesView"; -import ListElement from "@/common/ListElement"; -import type { TableTemplate } from "./utils"; -import storage, { StorageKey } from "@/services/utils/localStorage"; + +import DeleteIcon from "@mui/icons-material/Delete"; +import { MenuItem } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import ViewWrapper from "@/components/common/page/ViewWrapper"; +import PropertiesView from "@/components/common/PropertiesView"; +import SplitView from "@/components/common/SplitView"; +import TableMode from "@/components/common/TableMode"; +import storage, { StorageKey } from "@/services/utils/localStorage"; + +import ListElement from "../common/ListElement"; + import CreateTemplateTableDialog from "./dialogs/CreateTemplateTableDialog"; import UpdateTemplateTableDialog from "./dialogs/UpdateTemplateTableDialog"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; -import TableMode from "@/common/TableMode"; -import SplitView from "@/common/SplitView"; -import ViewWrapper from "@/common/page/ViewWrapper"; +import type { TableTemplate } from "./utils"; function TableModeList() { const { t } = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/TableModeList/utils.ts b/webapp/src/components/App/Singlestudy/explore/TableModeList/utils.ts index 06f0ee4b43..0fb0bd7650 100644 --- a/webapp/src/components/App/Singlestudy/explore/TableModeList/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/TableModeList/utils.ts @@ -13,11 +13,12 @@ */ import { v4 as uuidv4 } from "uuid"; + +import { TABLE_MODE_COLUMNS_BY_TYPE } from "@/services/api/studies/tableMode/constants"; import { TableModeColumnsForType, TableModeType, } from "@/services/api/studies/tableMode/types"; -import { TABLE_MODE_COLUMNS_BY_TYPE } from "@/services/api/studies/tableMode/constants"; //////////////////////////////////////////////////////////////// // Types diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CandidateForm.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CandidateForm.tsx index ba7c501c08..c148816cf0 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CandidateForm.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CandidateForm.tsx @@ -12,33 +12,36 @@ * This file is part of the Antares project. */ -import { useState, useEffect } from "react"; +import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; + +import { Title } from "@mui/icons-material"; +import DeleteIcon from "@mui/icons-material/Delete"; +import SaveIcon from "@mui/icons-material/Save"; import { Box, - Divider, - Typography, Button, ButtonGroup, + Divider, Paper, TextField, + Typography, } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import SaveIcon from "@mui/icons-material/Save"; -import DeleteIcon from "@mui/icons-material/Delete"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; + +import { LinkCreationInfoDTO } from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import SelectSingle from "@/components/common/SelectSingle"; + import { - Title, + ActiveButton, Fields, - SelectFields, HoverButton, - ActiveButton, - StyledVisibilityIcon, + SelectFields, StyledDeleteIcon, -} from "@/share/styles"; -import { LinkCreationInfoDTO } from "@/common/types"; -import { XpansionCandidate } from "@/types"; -import SelectSingle from "@/common/SelectSingle"; -import SwitchFE from "@/common/fieldEditors/SwitchFE"; + StyledVisibilityIcon, +} from "../share/styles"; +import { XpansionCandidate } from "../types"; interface PropType { candidate: XpansionCandidate | undefined; diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CreateCandidateDialog.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CreateCandidateDialog.tsx index 03df63d36f..33d7cbe9fe 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CreateCandidateDialog.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/CreateCandidateDialog.tsx @@ -13,20 +13,23 @@ */ import { useMemo, useState } from "react"; -import { Button, ButtonGroup } from "@mui/material"; +import * as R from "ramda"; import { useTranslation } from "react-i18next"; + import AddCircleIcon from "@mui/icons-material/AddCircle"; -import * as R from "ramda"; +import { Button, ButtonGroup } from "@mui/material"; + import { LinkCreationInfoDTO } from "@/common/types"; -import { XpansionCandidate } from "@/types"; -import FormDialog from "@/common/dialogs/FormDialog"; -import StringFE from "@/common/fieldEditors/StringFE"; -import Fieldset from "@/common/Fieldset"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import NumberFE from "@/common/fieldEditors/NumberFE"; -import { SubmitHandlerPlus } from "@/common/Form/types"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import StringFE from "@/components/common/fieldEditors/StringFE"; +import Fieldset from "@/components/common/Fieldset"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { validateString } from "@/utils/validation/string"; +import { XpansionCandidate } from "../types"; + interface PropType { open: boolean; links: LinkCreationInfoDTO[]; diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/XpansionPropsView.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/XpansionPropsView.tsx index 813949d38c..28b1a382f7 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/XpansionPropsView.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/XpansionPropsView.tsx @@ -13,13 +13,16 @@ */ import { useCallback, useEffect, useState } from "react"; -import { Box, Button } from "@mui/material"; import { useTranslation } from "react-i18next"; + import DeleteIcon from "@mui/icons-material/Delete"; -import PropertiesView from "@/common/PropertiesView"; -import { XpansionCandidate } from "@/types"; -import ConfirmationDialog from "@/common/dialogs/ConfirmationDialog"; -import ListElement from "@/common/ListElement"; +import { Box, Button } from "@mui/material"; + +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import PropertiesView from "@/components/common/PropertiesView"; + +import ListElement from "../../common/ListElement"; +import { XpansionCandidate } from "../types"; interface PropsType { candidateList: XpansionCandidate[]; diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/index.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/index.tsx index 3b3d2bdfd6..82bd5ca28f 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Candidates/index.tsx @@ -13,34 +13,38 @@ */ import { useState } from "react"; -import { useOutletContext, useNavigate } from "react-router-dom"; import { AxiosError } from "axios"; +import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; -import { Backdrop, Box, CircularProgress } from "@mui/material"; +import { useNavigate, useOutletContext } from "react-router-dom"; import { usePromise as usePromiseWrapper } from "react-use"; -import { useSnackbar } from "notistack"; + +import { Backdrop, Box, CircularProgress } from "@mui/material"; + import { MatrixType, StudyMetadata } from "@/common/types"; -import { XpansionCandidate } from "@/types"; +import DataViewerDialog from "@/components/common/dialogs/DataViewerDialog"; +import EmptyView from "@/components/common/page/SimpleContent"; +import SplitView from "@/components/common/SplitView"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import { getAllLinks } from "@/services/api/studydata"; import { - getAllCandidates, - getAllCapacities, - deleteXpansionConfiguration, addCandidate, deleteCandidate, - updateCandidate, + deleteXpansionConfiguration, + getAllCandidates, + getAllCapacities, getCapacity, + updateCandidate, xpansionConfigurationExist, } from "@/services/api/xpansion"; -import { transformNameToId, removeEmptyFields } from "@/services/utils/index"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { getAllLinks } from "@/services/api/studydata"; -import XpansionPropsView from "./XpansionPropsView"; -import CreateCandidateDialog from "./CreateCandidateDialog"; +import { removeEmptyFields, transformNameToId } from "@/services/utils/index"; + +import { XpansionCandidate } from "../types"; + import CandidateForm from "./CandidateForm"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import DataViewerDialog from "@/common/dialogs/DataViewerDialog"; -import EmptyView from "@/common/page/SimpleContent"; -import SplitView from "@/common/SplitView"; +import CreateCandidateDialog from "./CreateCandidateDialog"; +import XpansionPropsView from "./XpansionPropsView"; function Candidates() { const [t] = useTranslation(); diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Capacities.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Capacities.tsx index 7dbd3f7f74..0d6be90648 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Capacities.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Capacities.tsx @@ -13,11 +13,12 @@ */ import { - getAllCapacities, + addCapacity, deleteCapacity, + getAllCapacities, getCapacity, - addCapacity, } from "@/services/api/xpansion"; + import FileList from "./FileList"; function Capacities() { diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Constraints.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Constraints.tsx index a9d18a87f1..0126fa9ace 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Constraints.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Constraints.tsx @@ -13,11 +13,12 @@ */ import { - getAllConstraints, + addConstraints, deleteConstraints, + getAllConstraints, getConstraint, - addConstraints, } from "@/services/api/xpansion"; + import FileList from "./FileList"; function Constraints() { diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/FileList.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/FileList.tsx index 03f1e992d0..0285a213f4 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/FileList.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/FileList.tsx @@ -13,17 +13,20 @@ */ import { useState } from "react"; -import { useOutletContext } from "react-router-dom"; import { AxiosError } from "axios"; import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router-dom"; + import { Box, Paper } from "@mui/material"; + import { MatrixType, StudyMetadata } from "@/common/types"; +import DataViewerDialog from "@/components/common/dialogs/DataViewerDialog"; +import FileTable from "@/components/common/FileTable"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import DataViewerDialog from "@/common/dialogs/DataViewerDialog"; -import FileTable from "@/common/FileTable"; -import { Title } from "./share/styles"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import UsePromiseCond from "@/common/utils/UsePromiseCond"; + +import { Title } from "./share/styles"; interface PropTypes { addResource: (studyId: string, file: File) => Promise; diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/SettingsForm.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/SettingsForm.tsx index d15bb5a203..867312ddee 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/SettingsForm.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/SettingsForm.tsx @@ -12,21 +12,20 @@ * This file is part of the Antares project. */ -import { useState, useEffect } from "react"; -import { Box, Divider, Typography, Button, TextField } from "@mui/material"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; + +import { Title } from "@mui/icons-material"; import SaveIcon from "@mui/icons-material/Save"; -import { XpansionResourceType, XpansionSettings } from "@/types"; -import { - Fields, - SelectFields, - Title, - StyledVisibilityIcon, -} from "@/share/styles"; -import SelectSingle from "@/common/SelectSingle"; -import NumberFE from "@/common/fieldEditors/NumberFE"; -import SelectFE from "@/common/fieldEditors/SelectFE"; -import SwitchFE from "@/common/fieldEditors/SwitchFE"; +import { Box, Button, Divider, TextField, Typography } from "@mui/material"; + +import NumberFE from "@/components/common/fieldEditors/NumberFE"; +import SelectFE from "@/components/common/fieldEditors/SelectFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import SelectSingle from "@/components/common/SelectSingle"; + +import { Fields, SelectFields, StyledVisibilityIcon } from "../share/styles"; +import { XpansionResourceType, XpansionSettings } from "../types"; interface PropType { settings: XpansionSettings; diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/index.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/index.tsx index 16d068f86c..f85ed47242 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Settings/index.tsx @@ -13,28 +13,32 @@ */ import { useState } from "react"; -import { useOutletContext } from "react-router-dom"; import { AxiosError } from "axios"; +import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router-dom"; + import { Box, Paper } from "@mui/material"; -import { useSnackbar } from "notistack"; + import { StudyMetadata } from "@/common/types"; -import { XpansionResourceType, XpansionSettings } from "@/types"; +import DataViewerDialog from "@/components/common/dialogs/DataViewerDialog"; +import SimpleLoader from "@/components/common/loaders/SimpleLoader"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { - getXpansionSettings, + getAllCandidates, getAllConstraints, - getConstraint, - updateXpansionSettings, getAllWeights, + getConstraint, getWeight, - getAllCandidates, + getXpansionSettings, + updateXpansionSettings, } from "@/services/api/xpansion"; -import SettingsForm from "./SettingsForm"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import SimpleLoader from "@/common/loaders/SimpleLoader"; import { removeEmptyFields } from "@/services/utils/index"; -import DataViewerDialog from "@/common/dialogs/DataViewerDialog"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; + +import { XpansionResourceType, XpansionSettings } from "../types"; + +import SettingsForm from "./SettingsForm"; const resourceContentFetcher = ( resourceType: string, diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/Weights.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/Weights.tsx index 18d80a5aaa..f62196ccc3 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/Weights.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/Weights.tsx @@ -15,9 +15,10 @@ import { addWeight, deleteWeight, - getWeight, getAllWeights, + getWeight, } from "@/services/api/xpansion"; + import FileList from "./FileList"; function Weights() { diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/index.tsx b/webapp/src/components/App/Singlestudy/explore/Xpansion/index.tsx index 579f5db214..4a76b4e2ce 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/index.tsx @@ -15,19 +15,22 @@ /* eslint-disable react-hooks/exhaustive-deps */ import { useEffect, useMemo, useState } from "react"; import { AxiosError } from "axios"; +import { useTranslation } from "react-i18next"; import { useOutletContext } from "react-router-dom"; + +import { Add } from "@mui/icons-material"; import { Box, Button } from "@mui/material"; -import { useTranslation } from "react-i18next"; + import { StudyMetadata } from "@/common/types"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { createXpansionConfiguration, xpansionConfigurationExist, } from "@/services/api/xpansion"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import TabWrapper from "@/TabWrapper"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import UsePromiseCond from "@/common/utils/UsePromiseCond"; -import { Add } from "@mui/icons-material"; + +import TabWrapper from "../TabWrapper"; function Xpansion() { const { study } = useOutletContext<{ study: StudyMetadata }>(); diff --git a/webapp/src/components/App/Singlestudy/explore/Xpansion/share/styles.ts b/webapp/src/components/App/Singlestudy/explore/Xpansion/share/styles.ts index 96fb5dbd31..abb682f949 100644 --- a/webapp/src/components/App/Singlestudy/explore/Xpansion/share/styles.ts +++ b/webapp/src/components/App/Singlestudy/explore/Xpansion/share/styles.ts @@ -12,9 +12,9 @@ * This file is part of the Antares project. */ -import { Box, Typography, Button, styled } from "@mui/material"; -import VisibilityIcon from "@mui/icons-material/Visibility"; import DeleteIcon from "@mui/icons-material/Delete"; +import VisibilityIcon from "@mui/icons-material/Visibility"; +import { Box, Button, styled, Typography } from "@mui/material"; export const Fields = styled(Box)(({ theme }) => ({ display: "flex", diff --git a/webapp/src/components/App/Singlestudy/explore/common/ListElement.tsx b/webapp/src/components/App/Singlestudy/explore/common/ListElement.tsx index 0eb6bcf56c..ac34ba8ef6 100644 --- a/webapp/src/components/App/Singlestudy/explore/common/ListElement.tsx +++ b/webapp/src/components/App/Singlestudy/explore/common/ListElement.tsx @@ -12,6 +12,9 @@ * This file is part of the Antares project. */ +import { useState } from "react"; + +import ArrowRightOutlinedIcon from "@mui/icons-material/ArrowRightOutlined"; import { Box, ListItemButton, @@ -23,8 +26,7 @@ import { Theme, Tooltip, } from "@mui/material"; -import ArrowRightOutlinedIcon from "@mui/icons-material/ArrowRightOutlined"; -import { useState } from "react"; + import { IdType } from "@/common/types"; import { mergeSxProp } from "@/utils/muiUtils"; diff --git a/webapp/src/components/App/Singlestudy/explore/common/OutputFilters.tsx b/webapp/src/components/App/Singlestudy/explore/common/OutputFilters.tsx index 08a111e1c9..62452fb003 100644 --- a/webapp/src/components/App/Singlestudy/explore/common/OutputFilters.tsx +++ b/webapp/src/components/App/Singlestudy/explore/common/OutputFilters.tsx @@ -15,11 +15,13 @@ import { useMemo } from "react"; import { FieldPath } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { FilteringType } from "./types"; + import SelectFE from "@/components/common/fieldEditors/SelectFE"; import Fieldset from "@/components/common/Fieldset"; import { ControlPlus } from "@/components/common/Form/types"; +import { FilteringType } from "./types"; + interface FilterFieldValues { filterSynthesis: FilteringType[]; filterByYear: FilteringType[]; diff --git a/webapp/src/components/App/Singlestudy/index.tsx b/webapp/src/components/App/Singlestudy/index.tsx index 38d5f72bf7..9ffdf393e3 100644 --- a/webapp/src/components/App/Singlestudy/index.tsx +++ b/webapp/src/components/App/Singlestudy/index.tsx @@ -13,12 +13,14 @@ */ /* eslint-disable react-hooks/exhaustive-deps */ -import { useEffect, useCallback, useMemo, useState } from "react"; -import { useParams } from "react-router-dom"; -import { Box, Divider } from "@mui/material"; +import { useCallback, useEffect, useMemo, useState } from "react"; import debug from "debug"; import { useTranslation } from "react-i18next"; +import { useParams } from "react-router-dom"; import { usePromise as usePromiseWrapper } from "react-use"; + +import { Box, Divider } from "@mui/material"; + import { StudyMetadata, StudySummary, @@ -26,17 +28,18 @@ import { WSEvent, WSMessage, } from "@/common/types"; +import SimpleLoader from "@/components/common/loaders/SimpleLoader"; +import { fetchStudyVersions, setCurrentStudy } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import { getStudyMetadata } from "@/services/api/study"; -import NavHeader from "./NavHeader"; import { getVariantChildren, getVariantParents } from "@/services/api/variant"; -import TabWrapper from "./explore/TabWrapper"; -import HomeView from "./HomeView"; -import { fetchStudyVersions, setCurrentStudy } from "@/redux/ducks/studies"; import { findNodeInTree } from "@/services/utils"; -import CommandDrawer from "./Commands"; import { addWsMessageListener } from "@/services/webSockets"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import SimpleLoader from "@/common/loaders/SimpleLoader"; + +import TabWrapper from "./explore/TabWrapper"; +import CommandDrawer from "./Commands"; +import HomeView from "./HomeView"; +import NavHeader from "./NavHeader"; const logError = debug("antares:singlestudy:error"); diff --git a/webapp/src/components/App/Studies/BatchModeMenu.tsx b/webapp/src/components/App/Studies/BatchModeMenu.tsx index a301b4e27f..429a95dda0 100644 --- a/webapp/src/components/App/Studies/BatchModeMenu.tsx +++ b/webapp/src/components/App/Studies/BatchModeMenu.tsx @@ -12,11 +12,13 @@ * This file is part of the Antares project. */ -import BoltIcon from "@mui/icons-material/Bolt"; -import { Box, Button, IconButton, Tooltip } from "@mui/material"; -import { t } from "i18next"; import { useState } from "react"; +import { t } from "i18next"; + +import BoltIcon from "@mui/icons-material/Bolt"; import LibraryAddCheckIcon from "@mui/icons-material/LibraryAddCheck"; +import { Box, Button, IconButton, Tooltip } from "@mui/material"; + import LauncherDialog from "./LauncherDialog"; interface Props { diff --git a/webapp/src/components/App/Studies/CreateStudyDialog.tsx b/webapp/src/components/App/Studies/CreateStudyDialog.tsx index e3a0225df1..42fa5b585a 100644 --- a/webapp/src/components/App/Studies/CreateStudyDialog.tsx +++ b/webapp/src/components/App/Studies/CreateStudyDialog.tsx @@ -12,18 +12,14 @@ * This file is part of the Antares project. */ +import { AxiosError } from "axios"; import debug from "debug"; import { useSnackbar } from "notistack"; +import * as R from "ramda"; import { useTranslation } from "react-i18next"; -import { AxiosError } from "axios"; import { usePromise } from "react-use"; -import * as R from "ramda"; + import { StudyPublicMode } from "@/common/types"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { createStudy } from "@/redux/ducks/studies"; -import { getStudyVersionsFormatted, getGroups } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; import FormDialog from "@/components/common/dialogs/FormDialog"; import CheckboxesTagsFE from "@/components/common/fieldEditors/CheckboxesTagsFE"; import SelectFE from "@/components/common/fieldEditors/SelectFE"; @@ -31,6 +27,11 @@ import StringFE from "@/components/common/fieldEditors/StringFE"; import Fieldset from "@/components/common/Fieldset"; import { SubmitHandlerPlus } from "@/components/common/Form/types"; import { PUBLIC_MODE_LIST } from "@/components/common/utils/constants"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { createStudy } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getGroups, getStudyVersionsFormatted } from "@/redux/selectors"; const logErr = debug("antares:createstudyform:error"); diff --git a/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/MultipleLinkElement/index.tsx b/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/MultipleLinkElement/index.tsx index aa108d6b46..a85febbf9d 100644 --- a/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/MultipleLinkElement/index.tsx +++ b/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/MultipleLinkElement/index.tsx @@ -12,13 +12,17 @@ * This file is part of the Antares project. */ -import { Box, Chip, ListItem } from "@mui/material"; import { useState } from "react"; import { useTranslation } from "react-i18next"; -import SelectSingle from "@/common/SelectSingle"; -import TextSeparator from "@/common/TextSeparator"; -import { AddIcon } from "@/TagSelect/style"; -import { FilterLinkContainer, Root, Container } from "./style"; + +import { Box, Chip, ListItem } from "@mui/material"; + +import SelectSingle from "@/components/common/SelectSingle"; +import TextSeparator from "@/components/common/TextSeparator"; + +import { AddIcon } from "../../TagSelect/style"; + +import { Container, FilterLinkContainer, Root } from "./style"; interface FilterLink { area1: string; diff --git a/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/SingleLinkElement/index.tsx b/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/SingleLinkElement/index.tsx index 91d94eb962..5558359610 100644 --- a/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/SingleLinkElement/index.tsx +++ b/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/SingleLinkElement/index.tsx @@ -12,10 +12,13 @@ * This file is part of the Antares project. */ -import { Box, TextField } from "@mui/material"; import { useState } from "react"; import { useTranslation } from "react-i18next"; -import TextSeparator from "@/common/TextSeparator"; + +import { Box, TextField } from "@mui/material"; + +import TextSeparator from "@/components/common/TextSeparator"; + import { Root } from "./style"; interface FilterLink { diff --git a/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/index.tsx b/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/index.tsx index 76ceab1036..026d0f4714 100644 --- a/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/index.tsx +++ b/webapp/src/components/App/Studies/ExportModal/ExportFilter/Filter/index.tsx @@ -14,12 +14,15 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; + import { TextField } from "@mui/material"; + import { Area, Set, StudyOutputDownloadType } from "@/common/types"; -import { Root } from "./style"; +import SelectMulti from "@/components/common/SelectMulti"; + import MultipleLinkElement from "./MultipleLinkElement"; import SingleLinkElement from "./SingleLinkElement"; -import SelectMulti from "@/components/common/SelectMulti"; +import { Root } from "./style"; interface PropTypes { type: StudyOutputDownloadType; diff --git a/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/index.tsx b/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/index.tsx index 4ea269470f..b2b4e02b79 100644 --- a/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/index.tsx +++ b/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/index.tsx @@ -13,7 +13,9 @@ */ import { useState } from "react"; + import { Chip, ListItem, TextField } from "@mui/material"; + import { AddIcon, InputContainer, Root, TagContainer } from "./style"; interface PropTypes { diff --git a/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/style.ts b/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/style.ts index b043b11320..1fcfe14d19 100644 --- a/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/style.ts +++ b/webapp/src/components/App/Studies/ExportModal/ExportFilter/TagSelect/style.ts @@ -12,8 +12,8 @@ * This file is part of the Antares project. */ -import { Box, List, styled } from "@mui/material"; import AddCircleOutlinedIcon from "@mui/icons-material/AddCircleOutlined"; +import { Box, List, styled } from "@mui/material"; export const Root = styled(Box)(({ theme }) => ({ width: "100%", diff --git a/webapp/src/components/App/Studies/ExportModal/ExportFilter/index.tsx b/webapp/src/components/App/Studies/ExportModal/ExportFilter/index.tsx index 6d7bddd804..f25b213eb2 100644 --- a/webapp/src/components/App/Studies/ExportModal/ExportFilter/index.tsx +++ b/webapp/src/components/App/Studies/ExportModal/ExportFilter/index.tsx @@ -13,22 +13,25 @@ */ import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; import _ from "lodash"; +import { useTranslation } from "react-i18next"; + import { Box, Checkbox, FormControlLabel, styled } from "@mui/material"; + import { Area, - Set as District, FileStudyTreeConfigDTO, + Set as District, StudyOutputDownloadDTO, StudyOutputDownloadLevelDTO, StudyOutputDownloadType, } from "@/common/types"; -import Filter from "./Filter"; -import TagSelect from "./TagSelect"; import SelectMulti from "@/components/common/SelectMulti"; import SelectSingle from "@/components/common/SelectSingle"; +import Filter from "./Filter"; +import TagSelect from "./TagSelect"; + const Root = styled(Box)(({ theme }) => ({ flex: 1, width: "100%", diff --git a/webapp/src/components/App/Studies/ExportModal/index.tsx b/webapp/src/components/App/Studies/ExportModal/index.tsx index 654e034912..fc293777ab 100644 --- a/webapp/src/components/App/Studies/ExportModal/index.tsx +++ b/webapp/src/components/App/Studies/ExportModal/index.tsx @@ -13,13 +13,15 @@ */ import { ReactNode, useEffect, useState } from "react"; -import * as R from "ramda"; import { AxiosError } from "axios"; -import { Box, Button } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import { useSnackbar } from "notistack"; import debug from "debug"; import _ from "lodash"; +import { useSnackbar } from "notistack"; +import * as R from "ramda"; +import { useTranslation } from "react-i18next"; + +import { Box, Button } from "@mui/material"; + import { FileStudyTreeConfigDTO, GenericInfo, @@ -29,19 +31,20 @@ import { StudyOutputDownloadLevelDTO, StudyOutputDownloadType, } from "@/common/types"; +import BasicDialog, { + BasicDialogProps, +} from "@/components/common/dialogs/BasicDialog"; +import SelectSingle from "@/components/common/SelectSingle"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { - exportStudy, + downloadOutput, exportOuput as callExportOutput, + exportStudy, getStudyOutputs, getStudySynthesis, - downloadOutput, } from "@/services/api/study"; + import ExportFilter from "./ExportFilter"; -import BasicDialog, { - BasicDialogProps, -} from "@/components/common/dialogs/BasicDialog"; -import SelectSingle from "@/components/common/SelectSingle"; const logError = debug("antares:studies:card:error"); diff --git a/webapp/src/components/App/Studies/FilterDrawer.tsx b/webapp/src/components/App/Studies/FilterDrawer.tsx index d72c12bcab..e4e2a5f31f 100644 --- a/webapp/src/components/App/Studies/FilterDrawer.tsx +++ b/webapp/src/components/App/Studies/FilterDrawer.tsx @@ -12,13 +12,18 @@ * This file is part of the Antares project. */ +import { useEffect, useRef } from "react"; import { useTranslation } from "react-i18next"; + +import { Button, Drawer, List, ListItem, Typography } from "@mui/material"; import Box from "@mui/material/Box"; -import Toolbar from "@mui/material/Toolbar"; import Divider from "@mui/material/Divider"; -import { Button, Drawer, List, ListItem, Typography } from "@mui/material"; -import { useEffect, useRef } from "react"; -import { STUDIES_FILTER_WIDTH } from "@/theme"; +import Toolbar from "@mui/material/Toolbar"; + +import CheckboxesTagsFE from "@/components/common/fieldEditors/CheckboxesTagsFE"; +import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; +import { StudyFilters, updateStudyFilters } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getGroups, @@ -26,11 +31,8 @@ import { getStudyVersions, getUsers, } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { StudyFilters, updateStudyFilters } from "@/redux/ducks/studies"; import { displayVersionName } from "@/services/utils"; -import CheckboxesTagsFE from "@/components/common/fieldEditors/CheckboxesTagsFE"; -import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; +import { STUDIES_FILTER_WIDTH } from "@/theme"; interface Props { open: boolean; diff --git a/webapp/src/components/App/Studies/HeaderBottom.tsx b/webapp/src/components/App/Studies/HeaderBottom.tsx index da5128e766..52c6d9971d 100644 --- a/webapp/src/components/App/Studies/HeaderBottom.tsx +++ b/webapp/src/components/App/Studies/HeaderBottom.tsx @@ -12,17 +12,19 @@ * This file is part of the Antares project. */ -import { Box, Button, Chip, Divider } from "@mui/material"; import { useTranslation } from "react-i18next"; -import { indigo, purple } from "@mui/material/colors"; import { useUnmount } from "react-use"; + +import { Box, Button, Chip, Divider } from "@mui/material"; +import { indigo, purple } from "@mui/material/colors"; + +import { GroupDTO, UserDTO } from "@/common/types"; +import SearchFE from "@/components/common/fieldEditors/SearchFE"; +import { StudyFilters, updateStudyFilters } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getGroups, getStudyFilters, getUsers } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { StudyFilters, updateStudyFilters } from "@/redux/ducks/studies"; -import { GroupDTO, UserDTO } from "@/common/types"; import { displayVersionName } from "@/services/utils"; -import SearchFE from "@/components/common/fieldEditors/SearchFE"; interface PropTypes { onOpenFilterClick: VoidFunction; diff --git a/webapp/src/components/App/Studies/HeaderTopRight.tsx b/webapp/src/components/App/Studies/HeaderTopRight.tsx index 0b23497a7f..c919b05c20 100644 --- a/webapp/src/components/App/Studies/HeaderTopRight.tsx +++ b/webapp/src/components/App/Studies/HeaderTopRight.tsx @@ -12,15 +12,18 @@ * This file is part of the Antares project. */ -import { Button } from "@mui/material"; import { useState } from "react"; import { useTranslation } from "react-i18next"; + import AddCircleOutlineOutlinedIcon from "@mui/icons-material/AddCircleOutlineOutlined"; import UploadOutlinedIcon from "@mui/icons-material/UploadOutlined"; +import { Button } from "@mui/material"; + +import ImportDialog from "@/components/common/dialogs/ImportDialog"; import { createStudy } from "@/redux/ducks/studies"; -import CreateStudyDialog from "./CreateStudyDialog"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import ImportDialog from "@/components/common/dialogs/ImportDialog"; + +import CreateStudyDialog from "./CreateStudyDialog"; function HeaderRight() { const [openCreateDialog, setOpenCreateDialog] = useState(false); diff --git a/webapp/src/components/App/Studies/LauncherDialog.tsx b/webapp/src/components/App/Studies/LauncherDialog.tsx index f9862c1c7b..24ac72247a 100644 --- a/webapp/src/components/App/Studies/LauncherDialog.tsx +++ b/webapp/src/components/App/Studies/LauncherDialog.tsx @@ -13,6 +13,12 @@ */ import { useState } from "react"; +import { useSnackbar } from "notistack"; +import * as R from "ramda"; +import { useTranslation } from "react-i18next"; +import { shallowEqual } from "react-redux"; +import { useMountedState } from "react-use"; + import { Box, Button, @@ -26,12 +32,17 @@ import { TextField, Typography, } from "@mui/material"; -import * as R from "ramda"; -import { useTranslation } from "react-i18next"; -import { useSnackbar } from "notistack"; -import { useMountedState } from "react-use"; -import { shallowEqual } from "react-redux"; + import { LaunchOptions, StudyMetadata, StudyOutput } from "@/common/types"; +import BasicDialog from "@/components/common/dialogs/BasicDialog"; +import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; +import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; +import SelectSingle from "@/components/common/SelectSingle"; +import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getStudy } from "@/redux/selectors"; import { getLauncherCores, getLauncherTimeLimit, @@ -39,16 +50,7 @@ import { getStudyOutputs, launchStudy, } from "@/services/api/study"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getStudy } from "@/redux/selectors"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; import { convertVersions } from "@/services/utils"; -import BasicDialog from "@/components/common/dialogs/BasicDialog"; -import CheckBoxFE from "@/components/common/fieldEditors/CheckBoxFE"; -import SwitchFE from "@/components/common/fieldEditors/SwitchFE"; -import SelectSingle from "@/components/common/SelectSingle"; -import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; interface Props { open: boolean; diff --git a/webapp/src/components/App/Studies/MoveStudyDialog.tsx b/webapp/src/components/App/Studies/MoveStudyDialog.tsx index 2c0a85d359..6635c44377 100644 --- a/webapp/src/components/App/Studies/MoveStudyDialog.tsx +++ b/webapp/src/components/App/Studies/MoveStudyDialog.tsx @@ -12,18 +12,20 @@ * This file is part of the Antares project. */ -import { DialogProps } from "@mui/material"; -import TextField from "@mui/material/TextField"; import { useSnackbar } from "notistack"; import * as R from "ramda"; import { useTranslation } from "react-i18next"; import { usePromise } from "react-use"; + +import { DialogProps } from "@mui/material"; +import TextField from "@mui/material/TextField"; + import { StudyMetadata } from "@/common/types"; +import FormDialog from "@/components/common/dialogs/FormDialog"; +import { SubmitHandlerPlus } from "@/components/common/Form/types"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { moveStudy } from "@/services/api/study"; import { isStringEmpty } from "@/services/utils"; -import FormDialog from "@/components/common/dialogs/FormDialog"; -import { SubmitHandlerPlus } from "@/components/common/Form/types"; interface Props extends DialogProps { study: StudyMetadata; diff --git a/webapp/src/components/App/Studies/RefreshButton.tsx b/webapp/src/components/App/Studies/RefreshButton.tsx index 15294336f0..23d24b6c51 100644 --- a/webapp/src/components/App/Studies/RefreshButton.tsx +++ b/webapp/src/components/App/Studies/RefreshButton.tsx @@ -12,11 +12,13 @@ * This file is part of the Antares project. */ -import { Button, Tooltip } from "@mui/material"; -import RefreshIcon from "@mui/icons-material/Refresh"; import { useTranslation } from "react-i18next"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; + +import RefreshIcon from "@mui/icons-material/Refresh"; +import { Button, Tooltip } from "@mui/material"; + import { fetchStudies } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; interface Props { showLabel?: boolean; diff --git a/webapp/src/components/App/Studies/SideNav.tsx b/webapp/src/components/App/Studies/SideNav.tsx index 8d522ff1f5..ccce361f22 100644 --- a/webapp/src/components/App/Studies/SideNav.tsx +++ b/webapp/src/components/App/Studies/SideNav.tsx @@ -12,13 +12,16 @@ * This file is part of the Antares project. */ -import { useNavigate } from "react-router"; -import { Box, Typography, List, ListItem, ListItemText } from "@mui/material"; import { useTranslation } from "react-i18next"; -import { STUDIES_SIDE_NAV_WIDTH } from "@/theme"; -import StudyTree from "./StudyTree"; +import { useNavigate } from "react-router"; + +import { Box, List, ListItem, ListItemText, Typography } from "@mui/material"; + import useAppSelector from "@/redux/hooks/useAppSelector"; import { getFavoriteStudies } from "@/redux/selectors"; +import { STUDIES_SIDE_NAV_WIDTH } from "@/theme"; + +import StudyTree from "./StudyTree"; function SideNav() { const favorites = useAppSelector(getFavoriteStudies); diff --git a/webapp/src/components/App/Studies/StudiesList/StudyCardCell.tsx b/webapp/src/components/App/Studies/StudiesList/StudyCardCell.tsx index 9a8007ddd5..c382415590 100644 --- a/webapp/src/components/App/Studies/StudiesList/StudyCardCell.tsx +++ b/webapp/src/components/App/Studies/StudiesList/StudyCardCell.tsx @@ -13,12 +13,16 @@ */ import { memo } from "react"; +import { areEqual, GridChildComponentProps } from "react-window"; + import { Box, Skeleton } from "@mui/material"; -import { GridChildComponentProps, areEqual } from "react-window"; + import { StudyMetadata } from "@/common/types"; -import { StudiesListProps } from "."; + import StudyCard from "../StudyCard"; +import { StudiesListProps } from "."; + type Props = GridChildComponentProps<{ setStudyToLaunch: (id: StudyMetadata["id"]) => void; columnCount: number; diff --git a/webapp/src/components/App/Studies/StudiesList/index.tsx b/webapp/src/components/App/Studies/StudiesList/index.tsx index 37d6d6e7c1..04125d3d0f 100644 --- a/webapp/src/components/App/Studies/StudiesList/index.tsx +++ b/webapp/src/components/App/Studies/StudiesList/index.tsx @@ -13,55 +13,59 @@ */ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { AxiosError } from "axios"; +import { useTranslation } from "react-i18next"; +import AutoSizer from "react-virtualized-auto-sizer"; +import { FixedSizeGrid, GridOnScrollProps } from "react-window"; +import { v4 as uuidv4 } from "uuid"; + +import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward"; +import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward"; +import FolderOffIcon from "@mui/icons-material/FolderOff"; +import HomeIcon from "@mui/icons-material/Home"; +import NavigateNextIcon from "@mui/icons-material/NavigateNext"; +import RadarIcon from "@mui/icons-material/Radar"; import { Box, - Typography, Breadcrumbs, - Select, - MenuItem, + FormControl, + IconButton, + InputLabel, + ListItemIcon, ListItemText, + MenuItem, + Select, SelectChangeEvent, - ListItemIcon, Tooltip, - FormControl, - InputLabel, - IconButton, + Typography, } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import NavigateNextIcon from "@mui/icons-material/NavigateNext"; -import AutoSizer from "react-virtualized-auto-sizer"; -import HomeIcon from "@mui/icons-material/Home"; -import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward"; -import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward"; -import FolderOffIcon from "@mui/icons-material/FolderOff"; -import RadarIcon from "@mui/icons-material/Radar"; -import { FixedSizeGrid, GridOnScrollProps } from "react-window"; -import { v4 as uuidv4 } from "uuid"; -import { AxiosError } from "axios"; + import { StudyMetadata } from "@/common/types"; -import { STUDIES_HEIGHT_HEADER, STUDIES_LIST_HEADER_HEIGHT } from "@/theme"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import useDebounce from "@/hooks/useDebounce"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { setStudyScrollPosition, StudiesSortConf, updateStudiesSortConf, updateStudyFilters, } from "@/redux/ducks/studies"; -import useDebounce from "@/hooks/useDebounce"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; import { getStudiesScrollPosition, getStudiesSortConf, getStudyFilters, } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import StudyCardCell from "./StudyCardCell"; import { scanFolder } from "@/services/api/study"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import { STUDIES_HEIGHT_HEADER, STUDIES_LIST_HEADER_HEIGHT } from "@/theme"; + import BatchModeMenu from "../BatchModeMenu"; import LauncherDialog from "../LauncherDialog"; import RefreshButton from "../RefreshButton"; +import StudyCardCell from "./StudyCardCell"; + const CARD_TARGET_WIDTH = 500; const CARD_HEIGHT = 250; diff --git a/webapp/src/components/App/Studies/StudyCard.tsx b/webapp/src/components/App/Studies/StudyCard.tsx index 492259d265..6b4a963438 100644 --- a/webapp/src/components/App/Studies/StudyCard.tsx +++ b/webapp/src/components/App/Studies/StudyCard.tsx @@ -13,61 +13,65 @@ */ import { memo, useState } from "react"; -import { NavLink, useNavigate } from "react-router-dom"; import { AxiosError } from "axios"; +import debug from "debug"; import { useSnackbar } from "notistack"; import { useTranslation } from "react-i18next"; +import { NavLink, useNavigate } from "react-router-dom"; +import { areEqual } from "react-window"; + +import AltRouteOutlinedIcon from "@mui/icons-material/AltRouteOutlined"; +import ArchiveOutlinedIcon from "@mui/icons-material/ArchiveOutlined"; +import BoltIcon from "@mui/icons-material/Bolt"; +import CheckCircleIcon from "@mui/icons-material/CheckCircle"; +import ContentCopyIcon from "@mui/icons-material/ContentCopy"; +import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined"; +import DownloadOutlinedIcon from "@mui/icons-material/DownloadOutlined"; +import DriveFileMoveIcon from "@mui/icons-material/DriveFileMove"; +import EditOutlinedIcon from "@mui/icons-material/EditOutlined"; +import FileCopyOutlinedIcon from "@mui/icons-material/FileCopyOutlined"; +import MoreVertIcon from "@mui/icons-material/MoreVert"; +import PersonOutlineIcon from "@mui/icons-material/PersonOutline"; +import ScheduleOutlinedIcon from "@mui/icons-material/ScheduleOutlined"; +import UnarchiveOutlinedIcon from "@mui/icons-material/UnarchiveOutlined"; +import UpdateOutlinedIcon from "@mui/icons-material/UpdateOutlined"; import { Box, + Button, Card, CardActions, CardContent, - Button, - Typography, - Menu, - MenuItem, + Chip, + Divider, ListItemIcon, ListItemText, + Menu, + MenuItem, Tooltip, - Chip, - Divider, + Typography, } from "@mui/material"; -import { styled } from "@mui/material/styles"; import { indigo } from "@mui/material/colors"; -import ScheduleOutlinedIcon from "@mui/icons-material/ScheduleOutlined"; -import UpdateOutlinedIcon from "@mui/icons-material/UpdateOutlined"; -import PersonOutlineIcon from "@mui/icons-material/PersonOutline"; -import DriveFileMoveIcon from "@mui/icons-material/DriveFileMove"; -import MoreVertIcon from "@mui/icons-material/MoreVert"; -import CheckCircleIcon from "@mui/icons-material/CheckCircle"; -import UnarchiveOutlinedIcon from "@mui/icons-material/UnarchiveOutlined"; -import DownloadOutlinedIcon from "@mui/icons-material/DownloadOutlined"; -import ArchiveOutlinedIcon from "@mui/icons-material/ArchiveOutlined"; -import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined"; -import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import BoltIcon from "@mui/icons-material/Bolt"; -import FileCopyOutlinedIcon from "@mui/icons-material/FileCopyOutlined"; -import AltRouteOutlinedIcon from "@mui/icons-material/AltRouteOutlined"; -import debug from "debug"; -import { areEqual } from "react-window"; -import EditOutlinedIcon from "@mui/icons-material/EditOutlined"; +import { styled } from "@mui/material/styles"; + import { StudyMetadata, StudyType } from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import StarToggle from "@/components/common/StarToggle"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { deleteStudy, toggleFavorite } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getStudy, isStudyFavorite } from "@/redux/selectors"; +import * as studyApi from "@/services/api/study"; import { buildModificationDate, convertUTCToLocalTime, displayVersionName, } from "@/services/utils"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; + +import PropertiesDialog from "../Singlestudy/PropertiesDialog"; + import ExportModal from "./ExportModal"; import MoveStudyDialog from "./MoveStudyDialog"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import { getStudy, isStudyFavorite } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { deleteStudy, toggleFavorite } from "@/redux/ducks/studies"; -import * as studyApi from "@/services/api/study"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; -import StarToggle from "@/components/common/StarToggle"; -import PropertiesDialog from "../Singlestudy/PropertiesDialog"; const logError = debug("antares:studieslist:error"); diff --git a/webapp/src/components/App/Studies/StudyTree.tsx b/webapp/src/components/App/Studies/StudyTree.tsx index 244a20eb7b..29b8b69084 100644 --- a/webapp/src/components/App/Studies/StudyTree.tsx +++ b/webapp/src/components/App/Studies/StudyTree.tsx @@ -12,15 +12,18 @@ * This file is part of the Antares project. */ -import { StudyTreeNode } from "./utils"; +import * as R from "ramda"; + +import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView"; + +import TreeItemEnhanced from "@/components/common/TreeItemEnhanced"; +import { updateStudyFilters } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; import { getStudiesTree, getStudyFilters } from "@/redux/selectors"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { updateStudyFilters } from "@/redux/ducks/studies"; -import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView"; import { getParentPaths } from "@/utils/pathUtils"; -import * as R from "ramda"; -import TreeItemEnhanced from "@/components/common/TreeItemEnhanced"; + +import { StudyTreeNode } from "./utils"; function StudyTree() { const folder = useAppSelector((state) => getStudyFilters(state).folder, R.T); diff --git a/webapp/src/components/App/Studies/index.tsx b/webapp/src/components/App/Studies/index.tsx index df45369533..15972153cb 100644 --- a/webapp/src/components/App/Studies/index.tsx +++ b/webapp/src/components/App/Studies/index.tsx @@ -13,24 +13,27 @@ */ import { useState } from "react"; -import { Box, Divider } from "@mui/material"; import { useTranslation } from "react-i18next"; + import TravelExploreOutlinedIcon from "@mui/icons-material/TravelExploreOutlined"; -import SideNav from "./SideNav"; -import StudiesList from "./StudiesList"; +import { Box, Divider } from "@mui/material"; + +import SimpleLoader from "@/components/common/loaders/SimpleLoader"; +import RootPage from "@/components/common/page/RootPage"; +import UseAsyncAppSelectorCond from "@/redux/components/UseAsyncAppSelectorCond"; import { fetchStudies } from "@/redux/ducks/studies"; -import HeaderTopRight from "./HeaderTopRight"; -import HeaderBottom from "./HeaderBottom"; +import useAsyncAppSelector from "@/redux/hooks/useAsyncAppSelector"; import { getStudiesState, getStudyIdsFilteredAndSorted, } from "@/redux/selectors"; -import useAsyncAppSelector from "@/redux/hooks/useAsyncAppSelector"; + import FilterDrawer from "./FilterDrawer"; -import UseAsyncAppSelectorCond from "@/redux/components/UseAsyncAppSelectorCond"; +import HeaderBottom from "./HeaderBottom"; +import HeaderTopRight from "./HeaderTopRight"; import RefreshButton from "./RefreshButton"; -import SimpleLoader from "@/components/common/loaders/SimpleLoader"; -import RootPage from "@/components/common/page/RootPage"; +import SideNav from "./SideNav"; +import StudiesList from "./StudiesList"; function Studies() { const [t] = useTranslation(); diff --git a/webapp/src/components/App/Tasks/JobTableView.tsx b/webapp/src/components/App/Tasks/JobTableView.tsx index d9a95a1fdc..1e89398a71 100644 --- a/webapp/src/components/App/Tasks/JobTableView.tsx +++ b/webapp/src/components/App/Tasks/JobTableView.tsx @@ -14,38 +14,40 @@ import { useCallback, useEffect, useState } from "react"; import moment from "moment"; +import { useTranslation } from "react-i18next"; +import { useInterval } from "react-use"; + +import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; +import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp"; +import RefreshIcon from "@mui/icons-material/Refresh"; import { - Paper, - TableContainer, - Table, - TableHead, - TableRow, - TableCell, - TableBody, Box, + Button, + Checkbox, FormControl, + FormControlLabel, InputLabel, - Select, MenuItem, - Tooltip, - Button, + Paper, + Select, SelectChangeEvent, - Checkbox, - FormControlLabel, - Typography, Skeleton, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + Tooltip, + Typography, } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import RefreshIcon from "@mui/icons-material/Refresh"; -import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp"; -import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; import { grey } from "@mui/material/colors"; -import { TaskView, TaskType } from "@/common/types"; -import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import { getLauncherMetrics } from "@/services/api/study"; -import { useInterval } from "react-use"; + +import { TaskType, TaskView } from "@/common/types"; import LinearProgressWithLabel from "@/components/common/LinearProgressWithLabel"; import UsePromiseCond from "@/components/common/utils/UsePromiseCond"; +import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; +import { getLauncherMetrics } from "@/services/api/study"; interface PropType { content: TaskView[]; diff --git a/webapp/src/components/App/Tasks/LaunchJobLogView.tsx b/webapp/src/components/App/Tasks/LaunchJobLogView.tsx index 9a0cc59b8e..1f6502d14a 100644 --- a/webapp/src/components/App/Tasks/LaunchJobLogView.tsx +++ b/webapp/src/components/App/Tasks/LaunchJobLogView.tsx @@ -15,13 +15,15 @@ import { useState } from "react"; import { AxiosError } from "axios"; import { useTranslation } from "react-i18next"; -import { Box, Tooltip } from "@mui/material"; + import ErrorIcon from "@mui/icons-material/Error"; import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile"; -import { getStudyJobLog } from "@/services/api/study"; +import { Box, Tooltip } from "@mui/material"; + import { LaunchJob } from "@/common/types"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import LogModal from "@/components/common/LogModal"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { getStudyJobLog } from "@/services/api/study"; interface PropsType { job: LaunchJob; diff --git a/webapp/src/components/App/Tasks/NotificationBadge.tsx b/webapp/src/components/App/Tasks/NotificationBadge.tsx index 18bb27df02..7e6354cf13 100644 --- a/webapp/src/components/App/Tasks/NotificationBadge.tsx +++ b/webapp/src/components/App/Tasks/NotificationBadge.tsx @@ -14,22 +14,24 @@ import { ReactNode, useCallback, useEffect, useRef } from "react"; import debug from "debug"; -import { Box, Typography } from "@mui/material"; +import { useSnackbar, VariantType } from "notistack"; import { useTranslation } from "react-i18next"; import { useLocation } from "react-router-dom"; + import CircleIcon from "@mui/icons-material/Circle"; -import { useSnackbar, VariantType } from "notistack"; +import { Box, Typography } from "@mui/material"; import { red } from "@mui/material/colors"; + import { TaskEventPayload, WSEvent, WSMessage } from "@/common/types"; -import { getTask } from "@/services/api/tasks"; -import { addWsMessageListener } from "@/services/webSockets"; import { incrementTaskNotifications, resetTaskNotifications, } from "@/redux/ducks/ui"; -import { getTaskNotificationsCount } from "@/redux/selectors"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getTaskNotificationsCount } from "@/redux/selectors"; +import { getTask } from "@/services/api/tasks"; +import { addWsMessageListener } from "@/services/webSockets"; const logError = debug("antares:downloadbadge:error"); diff --git a/webapp/src/components/App/Tasks/index.tsx b/webapp/src/components/App/Tasks/index.tsx index ce165e6488..5597905ff3 100644 --- a/webapp/src/components/App/Tasks/index.tsx +++ b/webapp/src/components/App/Tasks/index.tsx @@ -13,76 +13,79 @@ */ /* eslint-disable react-hooks/exhaustive-deps */ -import { useState, useEffect, useMemo } from "react"; +import { useEffect, useMemo, useState } from "react"; import { AxiosError } from "axios"; import debug from "debug"; +import { debounce } from "lodash"; +import moment from "moment"; import { useTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; + import AssignmentIcon from "@mui/icons-material/Assignment"; -import moment from "moment"; +import BlockIcon from "@mui/icons-material/Block"; +import CalendarTodayIcon from "@mui/icons-material/CalendarToday"; +import DownloadIcon from "@mui/icons-material/Download"; +import EventAvailableIcon from "@mui/icons-material/EventAvailable"; +import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord"; +import InfoIcon from "@mui/icons-material/Info"; import { - useTheme, - Typography, Box, + Chip, CircularProgress, Tooltip, - Chip, + Typography, + useTheme, } from "@mui/material"; -import { Link } from "react-router-dom"; -import { debounce } from "lodash"; -import BlockIcon from "@mui/icons-material/Block"; -import InfoIcon from "@mui/icons-material/Info"; -import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord"; -import CalendarTodayIcon from "@mui/icons-material/CalendarToday"; -import EventAvailableIcon from "@mui/icons-material/EventAvailable"; -import DownloadIcon from "@mui/icons-material/Download"; import { grey, indigo } from "@mui/material/colors"; + import { - addWsMessageListener, - sendWsSubscribeMessage, - WsChannel, -} from "@/services/webSockets"; -import JobTableView from "./JobTableView"; -import { convertUTCToLocalTime } from "@/services/utils/index"; -import { - downloadJobOutput, - killStudy, - getStudyJobs, -} from "@/services/api/study"; + LaunchJob, + LaunchJobProgressDTO, + LaunchJobsProgress, + TaskDTO, + TaskEventPayload, + TaskStatus, + TaskType, + WSEvent, + WSMessage, +} from "@/common/types"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import DownloadLink from "@/components/common/DownloadLink"; +import LinearProgressWithLabel from "@/components/common/LinearProgressWithLabel"; +import SimpleLoader from "@/components/common/loaders/SimpleLoader"; +import LogModal from "@/components/common/LogModal"; +import RootPage from "@/components/common/page/RootPage"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; +import { fetchStudies } from "@/redux/ducks/studies"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getStudies } from "@/redux/selectors"; import { convertFileDownloadDTO, FileDownload, - getDownloadUrl, FileDownloadDTO, getDownloadsList, + getDownloadUrl, } from "@/services/api/downloads"; -import { fetchStudies } from "@/redux/ducks/studies"; import { - LaunchJob, - TaskDTO, - TaskEventPayload, - WSEvent, - WSMessage, - TaskType, - TaskStatus, - LaunchJobsProgress, - LaunchJobProgressDTO, -} from "@/common/types"; + downloadJobOutput, + getStudyJobs, + killStudy, +} from "@/services/api/study"; import { getAllMiscRunningTasks, getProgress, getTask, } from "@/services/api/tasks"; +import { convertUTCToLocalTime } from "@/services/utils/index"; +import { + addWsMessageListener, + sendWsSubscribeMessage, + WsChannel, +} from "@/services/webSockets"; + +import JobTableView from "./JobTableView"; import LaunchJobLogView from "./LaunchJobLogView"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { getStudies } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; -import DownloadLink from "@/components/common/DownloadLink"; -import LinearProgressWithLabel from "@/components/common/LinearProgressWithLabel"; -import SimpleLoader from "@/components/common/loaders/SimpleLoader"; -import LogModal from "@/components/common/LogModal"; -import RootPage from "@/components/common/page/RootPage"; const logError = debug("antares:studymanagement:error"); diff --git a/webapp/src/components/App/index.tsx b/webapp/src/components/App/index.tsx index fe97f194eb..89102d913d 100644 --- a/webapp/src/components/App/index.tsx +++ b/webapp/src/components/App/index.tsx @@ -12,63 +12,67 @@ * This file is part of the Antares project. */ +import { SnackbarKey, SnackbarProvider, useSnackbar } from "notistack"; import { BrowserRouter as Router, Navigate, + Outlet, Route, Routes, - Outlet, } from "react-router-dom"; + +import CloseIcon from "@mui/icons-material/Close"; import { CssBaseline, IconButton, ThemeProvider } from "@mui/material"; -import { SnackbarKey, SnackbarProvider, useSnackbar } from "notistack"; + import maintheme from "@/theme"; -import Studies from "./Studies"; -import Data from "./Data"; -import Tasks from "./Tasks"; -import Settings from "./Settings"; -import Api from "./Api"; -import SingleStudy from "./Singlestudy"; -import Modelization from "./Singlestudy/explore/Modelization"; -import Results from "./Singlestudy/explore/Results"; + +import LoginWrapper from "../wrappers/LoginWrapper"; +import MaintenanceWrapper from "../wrappers/MaintenanceWrapper"; +import MenuWrapper from "../wrappers/MenuWrapper"; + import Configuration from "./Singlestudy/explore/Configuration"; -import BindingConstraints from "./Singlestudy/explore/Modelization/BindingConstraints"; -import Links from "./Singlestudy/explore/Modelization/Links"; -import Areas from "./Singlestudy/explore/Modelization/Areas"; -import Map from "./Singlestudy/explore/Modelization/Map"; import Debug from "./Singlestudy/explore/Debug"; -import Xpansion from "./Singlestudy/explore/Xpansion"; -import Candidates from "./Singlestudy/explore/Xpansion/Candidates"; -import XpansionSettings from "./Singlestudy/explore/Xpansion/Settings"; -import Capacities from "./Singlestudy/explore/Xpansion/Capacities"; -import Properties from "./Singlestudy/explore/Modelization/Areas/Properties"; -import Load from "./Singlestudy/explore/Modelization/Areas/Load"; +import Modelization from "./Singlestudy/explore/Modelization"; +import Areas from "./Singlestudy/explore/Modelization/Areas"; import Hydro from "./Singlestudy/explore/Modelization/Areas/Hydro"; +import Allocation from "./Singlestudy/explore/Modelization/Areas/Hydro/Allocation"; +import Correlation from "./Singlestudy/explore/Modelization/Areas/Hydro/Correlation"; +import HydroMatrix from "./Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrix"; +import ManagementOptions from "./Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions"; +import SplitHydroMatrix from "./Singlestudy/explore/Modelization/Areas/Hydro/SplitHydroMatrix"; +import { HYDRO_ROUTES } from "./Singlestudy/explore/Modelization/Areas/Hydro/utils"; +import Load from "./Singlestudy/explore/Modelization/Areas/Load"; import MiscGen from "./Singlestudy/explore/Modelization/Areas/MiscGen"; +import Properties from "./Singlestudy/explore/Modelization/Areas/Properties"; +import Renewables from "./Singlestudy/explore/Modelization/Areas/Renewables"; +import RenewableForm from "./Singlestudy/explore/Modelization/Areas/Renewables/Form"; import Reserve from "./Singlestudy/explore/Modelization/Areas/Reserve"; -import Wind from "./Singlestudy/explore/Modelization/Areas/Wind"; import Solar from "./Singlestudy/explore/Modelization/Areas/Solar"; -import ResultDetails from "./Singlestudy/explore/Results/ResultDetails"; -import Constraints from "./Singlestudy/explore/Xpansion/Constraints"; -import Weights from "./Singlestudy/explore/Xpansion/Weights"; -import TableModeList from "./Singlestudy/explore/TableModeList"; -import ManagementOptions from "./Singlestudy/explore/Modelization/Areas/Hydro/ManagementOptions"; -import { HYDRO_ROUTES } from "./Singlestudy/explore/Modelization/Areas/Hydro/utils"; -import HydroMatrix from "./Singlestudy/explore/Modelization/Areas/Hydro/HydroMatrix"; -import Layers from "./Singlestudy/explore/Modelization/Map/MapConfig/Layers"; -import Districts from "./Singlestudy/explore/Modelization/Map/MapConfig/Districts"; -import Allocation from "./Singlestudy/explore/Modelization/Areas/Hydro/Allocation"; -import Correlation from "./Singlestudy/explore/Modelization/Areas/Hydro/Correlation"; import Storages from "./Singlestudy/explore/Modelization/Areas/Storages"; import StorageForm from "./Singlestudy/explore/Modelization/Areas/Storages/Form"; import Thermal from "./Singlestudy/explore/Modelization/Areas/Thermal"; import ThermalForm from "./Singlestudy/explore/Modelization/Areas/Thermal/Form"; -import Renewables from "./Singlestudy/explore/Modelization/Areas/Renewables"; -import RenewableForm from "./Singlestudy/explore/Modelization/Areas/Renewables/Form"; -import SplitHydroMatrix from "./Singlestudy/explore/Modelization/Areas/Hydro/SplitHydroMatrix"; -import CloseIcon from "@mui/icons-material/Close"; -import LoginWrapper from "../wrappers/LoginWrapper"; -import MaintenanceWrapper from "../wrappers/MaintenanceWrapper"; -import MenuWrapper from "../wrappers/MenuWrapper"; +import Wind from "./Singlestudy/explore/Modelization/Areas/Wind"; +import BindingConstraints from "./Singlestudy/explore/Modelization/BindingConstraints"; +import Links from "./Singlestudy/explore/Modelization/Links"; +import Map from "./Singlestudy/explore/Modelization/Map"; +import Districts from "./Singlestudy/explore/Modelization/Map/MapConfig/Districts"; +import Layers from "./Singlestudy/explore/Modelization/Map/MapConfig/Layers"; +import Results from "./Singlestudy/explore/Results"; +import ResultDetails from "./Singlestudy/explore/Results/ResultDetails"; +import TableModeList from "./Singlestudy/explore/TableModeList"; +import Xpansion from "./Singlestudy/explore/Xpansion"; +import Candidates from "./Singlestudy/explore/Xpansion/Candidates"; +import Capacities from "./Singlestudy/explore/Xpansion/Capacities"; +import Constraints from "./Singlestudy/explore/Xpansion/Constraints"; +import XpansionSettings from "./Singlestudy/explore/Xpansion/Settings"; +import Weights from "./Singlestudy/explore/Xpansion/Weights"; +import Api from "./Api"; +import Data from "./Data"; +import Settings from "./Settings"; +import SingleStudy from "./Singlestudy"; +import Studies from "./Studies"; +import Tasks from "./Tasks"; // TODO: replace 'notistack' by 'sonner' (https://sonner.emilkowal.ski/) function SnackbarCloseButton({ snackbarKey }: { snackbarKey: SnackbarKey }) { diff --git a/webapp/src/components/common/ButtonBack.tsx b/webapp/src/components/common/ButtonBack.tsx index 49fd1a5355..a31676cb04 100644 --- a/webapp/src/components/common/ButtonBack.tsx +++ b/webapp/src/components/common/ButtonBack.tsx @@ -12,10 +12,11 @@ * This file is part of the Antares project. */ -import { Box, Button } from "@mui/material"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import { useTranslation } from "react-i18next"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { Box, Button } from "@mui/material"; + interface Props { onClick: VoidFunction; } diff --git a/webapp/src/components/common/DocLink.tsx b/webapp/src/components/common/DocLink.tsx index 48e5468701..2e9feb093a 100644 --- a/webapp/src/components/common/DocLink.tsx +++ b/webapp/src/components/common/DocLink.tsx @@ -13,7 +13,7 @@ */ import { Help } from "@mui/icons-material"; -import { Tooltip, IconButton, SxProps, Theme } from "@mui/material"; +import { IconButton, SxProps, Theme, Tooltip } from "@mui/material"; interface Props { to: string; diff --git a/webapp/src/components/common/DownloadLink.tsx b/webapp/src/components/common/DownloadLink.tsx index 41659c5f2c..e835cf1434 100644 --- a/webapp/src/components/common/DownloadLink.tsx +++ b/webapp/src/components/common/DownloadLink.tsx @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { IconButton, Tooltip } from "@mui/material"; import { ReactElement } from "react"; + +import { IconButton, Tooltip } from "@mui/material"; + import { refresh } from "@/redux/ducks/auth"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; import useAppSelector from "@/redux/hooks/useAppSelector"; diff --git a/webapp/src/components/common/DynamicDataTable/TableRowGroup.tsx b/webapp/src/components/common/DynamicDataTable/TableRowGroup.tsx index 523694704a..d684b36fb4 100644 --- a/webapp/src/components/common/DynamicDataTable/TableRowGroup.tsx +++ b/webapp/src/components/common/DynamicDataTable/TableRowGroup.tsx @@ -12,18 +12,20 @@ * This file is part of the Antares project. */ +import { ChangeEvent, useMemo, useState } from "react"; + +import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"; +import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp"; import { - TableRow, - TableCell, - IconButton, Box, + IconButton, + TableCell, + TableRow, Typography, } from "@mui/material"; -import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"; -import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp"; -import { ChangeEvent, useMemo, useState } from "react"; + import TableRowItem from "./TableRowItem"; -import { Item, Column, calculateColumnResults } from "./utils"; +import { calculateColumnResults, Column, Item } from "./utils"; interface Props { itemsByGroup: { group?: string; items: Item[] }; diff --git a/webapp/src/components/common/DynamicDataTable/TableRowItem.tsx b/webapp/src/components/common/DynamicDataTable/TableRowItem.tsx index 214a84a730..f699f9410f 100644 --- a/webapp/src/components/common/DynamicDataTable/TableRowItem.tsx +++ b/webapp/src/components/common/DynamicDataTable/TableRowItem.tsx @@ -12,9 +12,11 @@ * This file is part of the Antares project. */ -import { TableCell, Checkbox, Chip, TableRow } from "@mui/material"; import { ChangeEvent, memo, useCallback } from "react"; -import { Item, Column } from "./utils"; + +import { Checkbox, Chip, TableCell, TableRow } from "@mui/material"; + +import { Column, Item } from "./utils"; interface Props { item: Item; diff --git a/webapp/src/components/common/DynamicDataTable/TableToolbar.tsx b/webapp/src/components/common/DynamicDataTable/TableToolbar.tsx index 7364176e7b..c4b9271fb8 100644 --- a/webapp/src/components/common/DynamicDataTable/TableToolbar.tsx +++ b/webapp/src/components/common/DynamicDataTable/TableToolbar.tsx @@ -12,16 +12,17 @@ * This file is part of the Antares project. */ +import { useTranslation } from "react-i18next"; + +import DeleteIcon from "@mui/icons-material/Delete"; import { - Toolbar, alpha, - Typography, - Tooltip, - IconButton, Fade, + IconButton, + Toolbar, + Tooltip, + Typography, } from "@mui/material"; -import DeleteIcon from "@mui/icons-material/Delete"; -import { useTranslation } from "react-i18next"; interface Props { numSelected: number; diff --git a/webapp/src/components/common/DynamicDataTable/index.tsx b/webapp/src/components/common/DynamicDataTable/index.tsx index 6d00babf94..f04a8d13dd 100644 --- a/webapp/src/components/common/DynamicDataTable/index.tsx +++ b/webapp/src/components/common/DynamicDataTable/index.tsx @@ -12,15 +12,6 @@ * This file is part of the Antares project. */ -import Box from "@mui/material/Box"; -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableContainer from "@mui/material/TableContainer"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; -import CompareArrowsIcon from "@mui/icons-material/CompareArrows"; -import AddIcon from "@mui/icons-material/Add"; import { ChangeEvent, FunctionComponent, @@ -28,12 +19,23 @@ import { useMemo, useState, } from "react"; -import { Button, Checkbox } from "@mui/material"; import { useTranslation } from "react-i18next"; + +import AddIcon from "@mui/icons-material/Add"; +import CompareArrowsIcon from "@mui/icons-material/CompareArrows"; +import { Button, Checkbox } from "@mui/material"; +import Box from "@mui/material/Box"; +import Table from "@mui/material/Table"; +import TableBody from "@mui/material/TableBody"; +import TableCell from "@mui/material/TableCell"; +import TableContainer from "@mui/material/TableContainer"; +import TableHead from "@mui/material/TableHead"; +import TableRow from "@mui/material/TableRow"; + import TableRowGroup from "./TableRowGroup"; -import TableToolbar from "./TableToolbar"; import TableRowItem from "./TableRowItem"; -import { Item, Column, AddItemDialogProps } from "./utils"; +import TableToolbar from "./TableToolbar"; +import { AddItemDialogProps, Column, Item } from "./utils"; export interface DynamicDataTableProps { items: Item[]; diff --git a/webapp/src/components/common/DynamicList.tsx b/webapp/src/components/common/DynamicList.tsx index d0ce83e085..581f1ead02 100644 --- a/webapp/src/components/common/DynamicList.tsx +++ b/webapp/src/components/common/DynamicList.tsx @@ -13,9 +13,11 @@ */ import React from "react"; -import { Grid, Divider, IconButton } from "@mui/material"; import { t } from "i18next"; + import RemoveCircleOutlineIcon from "@mui/icons-material/RemoveCircleOutline"; +import { Divider, Grid, IconButton } from "@mui/material"; + import SelectFE from "./fieldEditors/SelectFE"; interface ListOption { diff --git a/webapp/src/components/common/EditableMatrix/MatrixGraphView.tsx b/webapp/src/components/common/EditableMatrix/MatrixGraphView.tsx index 9e95b76581..4f34615078 100644 --- a/webapp/src/components/common/EditableMatrix/MatrixGraphView.tsx +++ b/webapp/src/components/common/EditableMatrix/MatrixGraphView.tsx @@ -13,8 +13,10 @@ */ import { useState } from "react"; +import { useTranslation } from "react-i18next"; import Plot from "react-plotly.js"; import AutoSizer from "react-virtualized-auto-sizer"; + import { Box, Checkbox, @@ -27,11 +29,13 @@ import { Select, SelectChangeEvent, } from "@mui/material"; -import { useTranslation } from "react-i18next"; + import { MatrixType } from "@/common/types"; -import "handsontable/dist/handsontable.min.css"; + import { formatDateFromIndex } from "./utils"; +import "handsontable/dist/handsontable.min.css"; + interface PropTypes { matrix: MatrixType; } diff --git a/webapp/src/components/common/EditableMatrix/index.tsx b/webapp/src/components/common/EditableMatrix/index.tsx index 4ef3a5be1d..5f850f917f 100644 --- a/webapp/src/components/common/EditableMatrix/index.tsx +++ b/webapp/src/components/common/EditableMatrix/index.tsx @@ -12,23 +12,27 @@ * This file is part of the Antares project. */ -import { useEffect, useState, useRef } from "react"; +import { useEffect, useRef, useState } from "react"; import debug from "debug"; import HT from "handsontable"; + import { - MatrixIndex, MatrixEditDTO, - MatrixType, + MatrixIndex, MatrixStats, + MatrixType, } from "@/common/types"; -import "handsontable/dist/handsontable.min.css"; + +import Handsontable, { HotTableClass } from "../Handsontable"; + import { Root } from "./style"; import { + cellChangesToMatrixEdits, computeStats, createDateFromIndex, - cellChangesToMatrixEdits, } from "./utils"; -import Handsontable, { HotTableClass } from "../Handsontable"; + +import "handsontable/dist/handsontable.min.css"; const logError = debug("antares:editablematrix:error"); diff --git a/webapp/src/components/common/EditableMatrix/style.ts b/webapp/src/components/common/EditableMatrix/style.ts index dcd6dc3159..d9e96ac4d8 100644 --- a/webapp/src/components/common/EditableMatrix/style.ts +++ b/webapp/src/components/common/EditableMatrix/style.ts @@ -12,7 +12,7 @@ * This file is part of the Antares project. */ -import { styled, Box, Button } from "@mui/material"; +import { Box, Button, styled } from "@mui/material"; export const Root = styled(Box)(({ theme }) => ({ width: "100%", diff --git a/webapp/src/components/common/EditableMatrix/utils.ts b/webapp/src/components/common/EditableMatrix/utils.ts index bc421edac0..6c5c77a083 100644 --- a/webapp/src/components/common/EditableMatrix/utils.ts +++ b/webapp/src/components/common/EditableMatrix/utils.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ +import HT from "handsontable"; import _ from "lodash"; import moment, { DurationInputArg2 } from "moment"; -import HT from "handsontable"; + import { MatrixEditDTO, MatrixIndex, diff --git a/webapp/src/components/common/Fieldset.tsx b/webapp/src/components/common/Fieldset.tsx index 2581183f31..786986b7bb 100644 --- a/webapp/src/components/common/Fieldset.tsx +++ b/webapp/src/components/common/Fieldset.tsx @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { Box, BoxProps, Divider, SxProps, Theme } from "@mui/material"; import * as RA from "ramda-adjunct"; + +import { Box, BoxProps, Divider, SxProps, Theme } from "@mui/material"; + import { mergeSxProp } from "@/utils/muiUtils"; interface FieldsetProps { diff --git a/webapp/src/components/common/FileTable.tsx b/webapp/src/components/common/FileTable.tsx index 3b22554fc3..e36b811e8d 100644 --- a/webapp/src/components/common/FileTable.tsx +++ b/webapp/src/components/common/FileTable.tsx @@ -13,31 +13,34 @@ */ import { ReactNode, useState } from "react"; +import { useTranslation } from "react-i18next"; + +import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; +import ContentCopyIcon from "@mui/icons-material/ContentCopy"; +import DeleteIcon from "@mui/icons-material/Delete"; +import DownloadIcon from "@mui/icons-material/Download"; +import UploadOutlinedIcon from "@mui/icons-material/UploadOutlined"; +import VisibilityIcon from "@mui/icons-material/Visibility"; import { Box, + Button, Divider, - TableContainer, + IconButton, Table, + TableBody, + TableCell, + TableContainer, TableHead, TableRow, - TableCell, - TableBody, Tooltip, - IconButton, Typography, - Button, } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import VisibilityIcon from "@mui/icons-material/Visibility"; -import UploadOutlinedIcon from "@mui/icons-material/UploadOutlined"; -import DeleteIcon from "@mui/icons-material/Delete"; -import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import DownloadIcon from "@mui/icons-material/Download"; -import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; -import ConfirmationDialog from "./dialogs/ConfirmationDialog"; + import { GenericInfo } from "@/common/types"; -import DownloadLink from "./DownloadLink"; + +import ConfirmationDialog from "./dialogs/ConfirmationDialog"; import ImportDialog from "./dialogs/ImportDialog"; +import DownloadLink from "./DownloadLink"; interface PropType { title: ReactNode; diff --git a/webapp/src/components/common/Form/index.tsx b/webapp/src/components/common/Form/index.tsx index 6a2fab7e3c..8414b58237 100644 --- a/webapp/src/components/common/Form/index.tsx +++ b/webapp/src/components/common/Form/index.tsx @@ -14,6 +14,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { FormEvent, useEffect, useMemo, useRef, useState } from "react"; +import axios from "axios"; +import clsx from "clsx"; +import * as R from "ramda"; +import * as RA from "ramda-adjunct"; import { DeepPartial, FieldPath, @@ -26,7 +30,12 @@ import { UseFormProps, } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import * as RA from "ramda-adjunct"; +import { useUpdateEffect } from "react-use"; + +import RedoIcon from "@mui/icons-material/Redo"; +import SaveIcon from "@mui/icons-material/Save"; +import UndoIcon from "@mui/icons-material/Undo"; +import { LoadingButton, LoadingButtonProps } from "@mui/lab"; import { Box, CircularProgress, @@ -37,29 +46,23 @@ import { Theme, Tooltip, } from "@mui/material"; -import SaveIcon from "@mui/icons-material/Save"; -import { useUpdateEffect } from "react-use"; -import * as R from "ramda"; -import clsx from "clsx"; -import { LoadingButton, LoadingButtonProps } from "@mui/lab"; -import UndoIcon from "@mui/icons-material/Undo"; -import RedoIcon from "@mui/icons-material/Redo"; -import axios from "axios"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; + import useDebounce from "@/hooks/useDebounce"; -import { - ROOT_ERROR_KEY, - getDirtyValues, - stringToPath, - toAutoSubmitConfig, -} from "./utils"; import useDebouncedState from "@/hooks/useDebouncedState"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import usePrompt from "@/hooks/usePrompt"; -import { SubmitHandlerPlus, UseFormReturnPlus } from "./types"; +import { mergeSxProp } from "@/utils/muiUtils"; + import FormContext from "./FormContext"; +import { SubmitHandlerPlus, UseFormReturnPlus } from "./types"; import useFormApiPlus from "./useFormApiPlus"; import useFormUndoRedo from "./useFormUndoRedo"; -import { mergeSxProp } from "@/utils/muiUtils"; +import { + getDirtyValues, + ROOT_ERROR_KEY, + stringToPath, + toAutoSubmitConfig, +} from "./utils"; export interface AutoSubmitConfig { enable: boolean; diff --git a/webapp/src/components/common/Form/useFormApiPlus.ts b/webapp/src/components/common/Form/useFormApiPlus.ts index 1cecee3008..82f7c8bf1c 100644 --- a/webapp/src/components/common/Form/useFormApiPlus.ts +++ b/webapp/src/components/common/Form/useFormApiPlus.ts @@ -12,6 +12,8 @@ * This file is part of the Antares project. */ +import { MutableRefObject, useEffect, useMemo, useRef } from "react"; +import * as RA from "ramda-adjunct"; import { BatchFieldArrayUpdate, FieldPath, @@ -22,14 +24,14 @@ import { UseFormSetValue, UseFormUnregister, } from "react-hook-form"; -import * as RA from "ramda-adjunct"; -import { MutableRefObject, useEffect, useMemo, useRef } from "react"; + import useAutoUpdateRef from "@/hooks/useAutoUpdateRef"; + import { + AutoSubmitHandler, UseFormRegisterPlus, UseFormReturnPlus, UseFormSetValues, - AutoSubmitHandler, } from "./types"; interface Params { diff --git a/webapp/src/components/common/Form/useFormUndoRedo.ts b/webapp/src/components/common/Form/useFormUndoRedo.ts index 6e152a9588..bc763a904a 100644 --- a/webapp/src/components/common/Form/useFormUndoRedo.ts +++ b/webapp/src/components/common/Form/useFormUndoRedo.ts @@ -12,13 +12,15 @@ * This file is part of the Antares project. */ -import useUndo, { Actions } from "use-undo"; -import { FieldValues } from "react-hook-form"; import { useCallback, useEffect, useRef } from "react"; import * as R from "ramda"; -import { UseFormReturnPlus } from "./types"; +import { FieldValues } from "react-hook-form"; +import useUndo, { Actions } from "use-undo"; + import useAutoUpdateRef from "@/hooks/useAutoUpdateRef"; +import { UseFormReturnPlus } from "./types"; + enum ActionType { Undo = "UNDO", Redo = "REDO", diff --git a/webapp/src/components/common/Form/utils.ts b/webapp/src/components/common/Form/utils.ts index e01e882708..980a6d049c 100644 --- a/webapp/src/components/common/Form/utils.ts +++ b/webapp/src/components/common/Form/utils.ts @@ -13,6 +13,7 @@ */ import * as RA from "ramda-adjunct"; + import { AutoSubmitConfig, FormProps } from "."; export function toAutoSubmitConfig( diff --git a/webapp/src/components/common/GroupedDataTable/CreateDialog.tsx b/webapp/src/components/common/GroupedDataTable/CreateDialog.tsx index 72fb3fe03a..abea4a2bed 100644 --- a/webapp/src/components/common/GroupedDataTable/CreateDialog.tsx +++ b/webapp/src/components/common/GroupedDataTable/CreateDialog.tsx @@ -12,16 +12,20 @@ * This file is part of the Antares project. */ -import AddCircleIcon from "@mui/icons-material/AddCircle"; -import type { TRow } from "./types"; import { useTranslation } from "react-i18next"; + +import AddCircleIcon from "@mui/icons-material/AddCircle"; + import { validateString } from "@/utils/validation/string"; + import FormDialog from "../dialogs/FormDialog"; import SelectFE from "../fieldEditors/SelectFE"; import StringFE from "../fieldEditors/StringFE"; import Fieldset from "../Fieldset"; import { SubmitHandlerPlus } from "../Form/types"; +import type { TRow } from "./types"; + interface Props { open: boolean; onClose: VoidFunction; diff --git a/webapp/src/components/common/GroupedDataTable/DuplicateDialog.tsx b/webapp/src/components/common/GroupedDataTable/DuplicateDialog.tsx index e4cc1840f0..9c3f476160 100644 --- a/webapp/src/components/common/GroupedDataTable/DuplicateDialog.tsx +++ b/webapp/src/components/common/GroupedDataTable/DuplicateDialog.tsx @@ -13,8 +13,11 @@ */ import { useTranslation } from "react-i18next"; + import ContentCopyIcon from "@mui/icons-material/ContentCopy"; + import { validateString } from "@/utils/validation/string"; + import FormDialog from "../dialogs/FormDialog"; import StringFE from "../fieldEditors/StringFE"; import Fieldset from "../Fieldset"; diff --git a/webapp/src/components/common/GroupedDataTable/cellRenderers/BooleanCell.tsx b/webapp/src/components/common/GroupedDataTable/cellRenderers/BooleanCell.tsx index b59c496854..583b78a27f 100644 --- a/webapp/src/components/common/GroupedDataTable/cellRenderers/BooleanCell.tsx +++ b/webapp/src/components/common/GroupedDataTable/cellRenderers/BooleanCell.tsx @@ -12,10 +12,11 @@ * This file is part of the Antares project. */ -import { Chip } from "@mui/material"; import type { MRT_Cell, MRT_RowData } from "material-react-table"; import { useTranslation } from "react-i18next"; +import { Chip } from "@mui/material"; + interface Props { cell: MRT_Cell; } diff --git a/webapp/src/components/common/GroupedDataTable/index.tsx b/webapp/src/components/common/GroupedDataTable/index.tsx index 71f3e52733..18a4684a44 100644 --- a/webapp/src/components/common/GroupedDataTable/index.tsx +++ b/webapp/src/components/common/GroupedDataTable/index.tsx @@ -12,36 +12,40 @@ * This file is part of the Antares project. */ -import Box from "@mui/material/Box"; -import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline"; -import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; -import DeleteIcon from "@mui/icons-material/Delete"; -import { Button, Skeleton } from "@mui/material"; +import { useEffect, useMemo, useRef, useState } from "react"; import { MaterialReactTable, + type MRT_ColumnDef, + type MRT_RowSelectionState, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, useMaterialReactTable, - type MRT_RowSelectionState, - type MRT_ColumnDef, } from "material-react-table"; -import { useTranslation } from "react-i18next"; -import { useEffect, useMemo, useRef, useState } from "react"; -import CreateDialog from "./CreateDialog"; -import { generateUniqueValue, getTableOptionsForAlign } from "./utils"; -import DuplicateDialog from "./DuplicateDialog"; -import { translateWithColon } from "@/utils/i18nUtils"; -import useAutoUpdateRef from "@/hooks/useAutoUpdateRef"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; -import { PromiseAny } from "@/utils/tsUtils"; +import { useTranslation } from "react-i18next"; + +import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline"; +import ContentCopyIcon from "@mui/icons-material/ContentCopy"; +import DeleteIcon from "@mui/icons-material/Delete"; +import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; +import { Button, Skeleton } from "@mui/material"; +import Box from "@mui/material/Box"; + +import useAutoUpdateRef from "@/hooks/useAutoUpdateRef"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { toError } from "@/utils/fnUtils"; import useOperationInProgressCount from "@/hooks/useOperationInProgressCount"; -import type { TRow } from "./types"; +import { toError } from "@/utils/fnUtils"; +import { translateWithColon } from "@/utils/i18nUtils"; +import { PromiseAny } from "@/utils/tsUtils"; + import ConfirmationDialog from "../dialogs/ConfirmationDialog"; +import CreateDialog from "./CreateDialog"; +import DuplicateDialog from "./DuplicateDialog"; +import type { TRow } from "./types"; +import { generateUniqueValue, getTableOptionsForAlign } from "./utils"; + export interface GroupedDataTableProps< TGroups extends string[], TData extends TRow, diff --git a/webapp/src/components/common/GroupedDataTable/utils.ts b/webapp/src/components/common/GroupedDataTable/utils.ts index 07b670d25a..8645094c69 100644 --- a/webapp/src/components/common/GroupedDataTable/utils.ts +++ b/webapp/src/components/common/GroupedDataTable/utils.ts @@ -13,7 +13,9 @@ */ import * as R from "ramda"; + import { TableCellProps } from "@mui/material"; + import type { TRow } from "./types"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/common/Handsontable.tsx b/webapp/src/components/common/Handsontable.tsx index 1d5f9096d2..ad463f301b 100644 --- a/webapp/src/components/common/Handsontable.tsx +++ b/webapp/src/components/common/Handsontable.tsx @@ -12,11 +12,13 @@ * This file is part of the Antares project. */ +import { forwardRef } from "react"; import { registerAllModules } from "handsontable/registry"; +import * as RA from "ramda-adjunct"; + import HotTable, { HotTableProps } from "@handsontable/react"; import { styled } from "@mui/material"; -import { forwardRef } from "react"; -import * as RA from "ramda-adjunct"; + import { SECONDARY_MAIN_COLOR } from "@/theme"; // Register Handsontable's modules diff --git a/webapp/src/components/common/JSONEditor/index.tsx b/webapp/src/components/common/JSONEditor/index.tsx index e33f74fd4e..327867efec 100644 --- a/webapp/src/components/common/JSONEditor/index.tsx +++ b/webapp/src/components/common/JSONEditor/index.tsx @@ -13,22 +13,26 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ +import { useMemo, useRef } from "react"; import JSONEditorClass, { - type JSONEditorOptions, type HistoryItem, + type JSONEditorOptions, } from "jsoneditor"; -import { useMemo, useRef } from "react"; -import { useDeepCompareEffect, useMount } from "react-use"; -import "jsoneditor/dist/jsoneditor.min.css"; -import "./dark-theme.css"; -import { PromiseAny } from "@/utils/tsUtils"; -import useAutoUpdateRef from "@/hooks/useAutoUpdateRef"; -import { createSaveButton } from "./utils"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; +import { useDeepCompareEffect, useMount } from "react-use"; + +import { Box } from "@mui/material"; + +import useAutoUpdateRef from "@/hooks/useAutoUpdateRef"; import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { toError } from "@/utils/fnUtils"; -import { Box } from "@mui/material"; +import { PromiseAny } from "@/utils/tsUtils"; + +import { createSaveButton } from "./utils"; + +import "jsoneditor/dist/jsoneditor.min.css"; +import "./dark-theme.css"; export interface JSONEditorProps extends JSONEditorOptions { json: any; diff --git a/webapp/src/components/common/LinearProgressWithLabel.tsx b/webapp/src/components/common/LinearProgressWithLabel.tsx index 642efd3a4d..e2e65ef941 100644 --- a/webapp/src/components/common/LinearProgressWithLabel.tsx +++ b/webapp/src/components/common/LinearProgressWithLabel.tsx @@ -12,14 +12,15 @@ * This file is part of the Antares project. */ +import * as R from "ramda"; + import { - Tooltip, Box, LinearProgress, - Typography, LinearProgressProps, + Tooltip, + Typography, } from "@mui/material"; -import * as R from "ramda"; const renderLoadColor = (val: number): LinearProgressProps["color"] => R.cond([ diff --git a/webapp/src/components/common/LogModal.tsx b/webapp/src/components/common/LogModal.tsx index 85d6cd3330..1b15bbbce5 100644 --- a/webapp/src/components/common/LogModal.tsx +++ b/webapp/src/components/common/LogModal.tsx @@ -13,27 +13,30 @@ */ import { + CSSProperties, + KeyboardEvent, + UIEvent, useCallback, useEffect, - useState, useRef, - UIEvent, - KeyboardEvent, - CSSProperties, + useState, } from "react"; -import { Box, Button, Typography } from "@mui/material"; import { useTranslation } from "react-i18next"; + import DownloadIcon from "@mui/icons-material/Download"; -import { exportText } from "@/services/utils/index"; +import { Box, Button, Typography } from "@mui/material"; + import { WSEvent, WSLogMessage, WSMessage } from "@/common/types"; -import SimpleLoader from "./loaders/SimpleLoader"; -import BasicDialog from "./dialogs/BasicDialog"; +import { exportText } from "@/services/utils/index"; import { addWsMessageListener, sendWsSubscribeMessage, WsChannel, } from "@/services/webSockets"; +import BasicDialog from "./dialogs/BasicDialog"; +import SimpleLoader from "./loaders/SimpleLoader"; + interface Props { isOpen: boolean; jobId?: string; diff --git a/webapp/src/components/common/Matrix/components/MatrixActions/MatrixActions.test.tsx b/webapp/src/components/common/Matrix/components/MatrixActions/MatrixActions.test.tsx index f2077c21aa..39b4b7292b 100644 --- a/webapp/src/components/common/Matrix/components/MatrixActions/MatrixActions.test.tsx +++ b/webapp/src/components/common/Matrix/components/MatrixActions/MatrixActions.test.tsx @@ -13,8 +13,10 @@ */ import React from "react"; + import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; + import MatrixActions from "."; vi.mock("../buttons/SplitButton", () => ({ diff --git a/webapp/src/components/common/Matrix/components/MatrixActions/index.tsx b/webapp/src/components/common/Matrix/components/MatrixActions/index.tsx index b5faa9b785..b740ad1e47 100644 --- a/webapp/src/components/common/Matrix/components/MatrixActions/index.tsx +++ b/webapp/src/components/common/Matrix/components/MatrixActions/index.tsx @@ -12,12 +12,14 @@ * This file is part of the Antares project. */ -import { Box, Divider, IconButton, Tooltip } from "@mui/material"; -import SplitButton from "@/components/common/buttons/SplitButton"; -import DownloadMatrixButton from "@/components/common/buttons/DownloadMatrixButton"; -import { FileDownload, Save, Undo, Redo } from "@mui/icons-material"; import { useTranslation } from "react-i18next"; + +import { FileDownload, Redo, Save, Undo } from "@mui/icons-material"; import { LoadingButton } from "@mui/lab"; +import { Box, Divider, IconButton, Tooltip } from "@mui/material"; + +import DownloadMatrixButton from "@/components/common/buttons/DownloadMatrixButton"; +import SplitButton from "@/components/common/buttons/SplitButton"; interface MatrixActionsProps { onImport: VoidFunction; diff --git a/webapp/src/components/common/Matrix/components/MatrixGrid/MatrixGrid.test.tsx b/webapp/src/components/common/Matrix/components/MatrixGrid/MatrixGrid.test.tsx index 7f3f44aa7b..f220e6bb37 100644 --- a/webapp/src/components/common/Matrix/components/MatrixGrid/MatrixGrid.test.tsx +++ b/webapp/src/components/common/Matrix/components/MatrixGrid/MatrixGrid.test.tsx @@ -12,15 +12,17 @@ * This file is part of the Antares project. */ +import Box from "@mui/material/Box"; import { render } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; -import Box from "@mui/material/Box"; -import MatrixGrid, { MatrixGridProps } from "."; -import SplitView from "../../../SplitView"; -import type { EnhancedGridColumn } from "../../shared/types"; + import { mockGetBoundingClientRect } from "../../../../../tests/mocks/mockGetBoundingClientRect"; import { mockHTMLCanvasElement } from "../../../../../tests/mocks/mockHTMLCanvasElement"; +import SplitView from "../../../SplitView"; import { Column } from "../../shared/constants"; +import type { EnhancedGridColumn } from "../../shared/types"; + +import MatrixGrid, { MatrixGridProps } from "."; interface RenderMatrixOptions { width?: string; diff --git a/webapp/src/components/common/Matrix/components/MatrixGrid/index.tsx b/webapp/src/components/common/Matrix/components/MatrixGrid/index.tsx index 48cc0ba540..c9a0bb4e63 100644 --- a/webapp/src/components/common/Matrix/components/MatrixGrid/index.tsx +++ b/webapp/src/components/common/Matrix/components/MatrixGrid/index.tsx @@ -12,7 +12,8 @@ * This file is part of the Antares project. */ -import "@glideapps/glide-data-grid/dist/index.css"; +import { useMemo, useState } from "react"; + import DataEditor, { CompactSelection, EditableGridCell, @@ -22,17 +23,20 @@ import DataEditor, { GridSelection, Item, } from "@glideapps/glide-data-grid"; + +import { useColumnMapping } from "../../hooks/useColumnMapping"; import { useGridCellContent } from "../../hooks/useGridCellContent"; -import { useMemo, useState } from "react"; +import { useMatrixPortal } from "../../hooks/useMatrixPortal"; import { type EnhancedGridColumn, type GridUpdate, type MatrixAggregates, } from "../../shared/types"; -import { useColumnMapping } from "../../hooks/useColumnMapping"; -import { useMatrixPortal } from "../../hooks/useMatrixPortal"; + import { darkTheme, readOnlyDarkTheme } from "./styles"; +import "@glideapps/glide-data-grid/dist/index.css"; + export interface MatrixGridProps { data: number[][]; rows: number; diff --git a/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/fixtures.ts b/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/fixtures.ts index 7573b84251..a9086f4fb8 100644 --- a/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/fixtures.ts +++ b/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/fixtures.ts @@ -13,6 +13,7 @@ */ import { Column } from "../../../shared/constants"; + import { createColumn, createNumericColumn } from "./utils"; export const COLUMNS = { diff --git a/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/useColumnMapping.test.ts b/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/useColumnMapping.test.ts index 8d16c51b0d..fe35c0d609 100644 --- a/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/useColumnMapping.test.ts +++ b/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/useColumnMapping.test.ts @@ -12,11 +12,13 @@ * This file is part of the Antares project. */ +import { Item } from "@glideapps/glide-data-grid"; import { renderHook } from "@testing-library/react"; + import { useColumnMapping } from ".."; -import { Item } from "@glideapps/glide-data-grid"; -import { createCoordinate, renderColumnMapping } from "./utils"; + import { COLUMNS } from "./fixtures"; +import { createCoordinate, renderColumnMapping } from "./utils"; describe("useColumnMapping", () => { describe("hook initialization", () => { diff --git a/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/utils.ts b/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/utils.ts index eaf97da516..67777b5a18 100644 --- a/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/utils.ts +++ b/webapp/src/components/common/Matrix/hooks/useColumnMapping/__tests__/utils.ts @@ -14,9 +14,10 @@ import { Item } from "@glideapps/glide-data-grid"; import { renderHook } from "@testing-library/react"; + +import { Column } from "../../../shared/constants"; import type { ColumnType, EnhancedGridColumn } from "../../../shared/types"; import { useColumnMapping } from ".."; -import { Column } from "../../../shared/constants"; export const createCoordinate = (col: number, row: number): Item => [col, row] as Item; diff --git a/webapp/src/components/common/Matrix/hooks/useColumnMapping/index.ts b/webapp/src/components/common/Matrix/hooks/useColumnMapping/index.ts index b9ceb95ebf..280a4e7dcb 100644 --- a/webapp/src/components/common/Matrix/hooks/useColumnMapping/index.ts +++ b/webapp/src/components/common/Matrix/hooks/useColumnMapping/index.ts @@ -13,9 +13,11 @@ */ import { useMemo } from "react"; + import { Item } from "@glideapps/glide-data-grid"; -import { EnhancedGridColumn } from "../../shared/types"; + import { Column } from "../../shared/constants"; +import { EnhancedGridColumn } from "../../shared/types"; /** * A custom hook that provides coordinate mapping functions for a grid with mixed column types. diff --git a/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/fixtures.ts b/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/fixtures.ts index c13aa938c5..f6a9d4714d 100644 --- a/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/fixtures.ts +++ b/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/fixtures.ts @@ -12,8 +12,8 @@ * This file is part of the Antares project. */ -import type { ColumnType, EnhancedGridColumn } from "../../../shared/types"; import { Column } from "../../../shared/constants"; +import type { ColumnType, EnhancedGridColumn } from "../../../shared/types"; import type { TestCase } from "../types"; export const createColumn = ( diff --git a/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/useGridCellContent.test.ts b/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/useGridCellContent.test.ts index e2103c53e7..ca124ec0c7 100644 --- a/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/useGridCellContent.test.ts +++ b/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/useGridCellContent.test.ts @@ -13,14 +13,15 @@ */ import { Column } from "../../../shared/constants"; + +import { assertNumberCell, assertTextCell } from "./assertions"; import { - createColumn, AGGREGATE_DATA, - MIXED_DATA, + createColumn, FORMAT_TEST_CASES, + MIXED_DATA, } from "./fixtures"; import { createCoordinate, renderGridCellContent } from "./utils"; -import { assertNumberCell, assertTextCell } from "./assertions"; describe("useGridCellContent", () => { describe("Aggregate columns", () => { diff --git a/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/utils.ts b/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/utils.ts index a75d80f3ea..cfa8a6a5be 100644 --- a/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/utils.ts +++ b/webapp/src/components/common/Matrix/hooks/useGridCellContent/__tests__/utils.ts @@ -12,11 +12,12 @@ * This file is part of the Antares project. */ -import { renderHook } from "@testing-library/react"; import { type Item } from "@glideapps/glide-data-grid"; +import { renderHook } from "@testing-library/react"; + import { useColumnMapping } from "../../useColumnMapping"; -import { useGridCellContent } from ".."; import type { RenderOptions } from "../types"; +import { useGridCellContent } from ".."; export const createCoordinate = (col: number, row: number): Item => [col, row] as Item; diff --git a/webapp/src/components/common/Matrix/hooks/useGridCellContent/index.ts b/webapp/src/components/common/Matrix/hooks/useGridCellContent/index.ts index 0e20b0b2b9..3a3ff74b32 100644 --- a/webapp/src/components/common/Matrix/hooks/useGridCellContent/index.ts +++ b/webapp/src/components/common/Matrix/hooks/useGridCellContent/index.ts @@ -13,14 +13,17 @@ */ import { useCallback, useMemo } from "react"; + import { GridCell, GridCellKind, Item } from "@glideapps/glide-data-grid"; + +import { Column } from "../../shared/constants"; import { - type EnhancedGridColumn, type ColumnType, + type EnhancedGridColumn, MatrixAggregates, } from "../../shared/types"; import { formatGridNumber } from "../../shared/utils"; -import { Column } from "../../shared/constants"; + import { type CellContentGenerator } from "./types"; /** diff --git a/webapp/src/components/common/Matrix/hooks/useGridCellContent/types.ts b/webapp/src/components/common/Matrix/hooks/useGridCellContent/types.ts index 9858e11beb..f3c7c92ff1 100644 --- a/webapp/src/components/common/Matrix/hooks/useGridCellContent/types.ts +++ b/webapp/src/components/common/Matrix/hooks/useGridCellContent/types.ts @@ -13,6 +13,7 @@ */ import { GridCell, Item } from "@glideapps/glide-data-grid"; + import type { EnhancedGridColumn, MatrixAggregates } from "../../shared/types"; export type GridToDataFunction = (cell: Item) => Item | null; diff --git a/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts b/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts index b781a9400c..4b0caaad73 100644 --- a/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts +++ b/webapp/src/components/common/Matrix/hooks/useMatrix/index.ts @@ -14,22 +14,31 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import { AxiosError } from "axios"; -import { enqueueSnackbar } from "notistack"; import { t } from "i18next"; +import { enqueueSnackbar } from "notistack"; +import useUndo from "use-undo"; + +import { GridCellKind } from "@glideapps/glide-data-grid"; + import { MatrixIndex } from "../../../../../common/types"; import useEnqueueErrorSnackbar from "../../../../../hooks/useEnqueueErrorSnackbar"; +import usePrompt from "../../../../../hooks/usePrompt"; import { getStudyMatrixIndex, updateMatrix, } from "../../../../../services/api/matrix"; +import { importFile } from "../../../../../services/api/studies/raw"; import { getStudyData } from "../../../../../services/api/study"; +import { fetchMatrixFn } from "../../../../App/Singlestudy/explore/Modelization/Areas/Hydro/utils"; +import { aggregatesTheme } from "../../components/MatrixGrid/styles"; +import { Aggregate, Column, Operation } from "../../shared/constants"; import { + AggregateConfig, EnhancedGridColumn, - MatrixDataDTO, GridUpdate, - MatrixUpdateDTO, MatrixAggregates, - AggregateConfig, + MatrixDataDTO, + MatrixUpdateDTO, } from "../../shared/types"; import { calculateMatrixAggregates, @@ -37,13 +46,6 @@ import { generateDateTime, getAggregateTypes, } from "../../shared/utils"; -import useUndo from "use-undo"; -import { GridCellKind } from "@glideapps/glide-data-grid"; -import { importFile } from "../../../../../services/api/studies/raw"; -import { fetchMatrixFn } from "../../../../App/Singlestudy/explore/Modelization/Areas/Hydro/utils"; -import usePrompt from "../../../../../hooks/usePrompt"; -import { Aggregate, Column, Operation } from "../../shared/constants"; -import { aggregatesTheme } from "../../components/MatrixGrid/styles"; interface DataState { data: MatrixDataDTO["data"]; diff --git a/webapp/src/components/common/Matrix/hooks/useMatrix/useMatrix.test.tsx b/webapp/src/components/common/Matrix/hooks/useMatrix/useMatrix.test.tsx index 7dabcb97a5..54882a26b6 100644 --- a/webapp/src/components/common/Matrix/hooks/useMatrix/useMatrix.test.tsx +++ b/webapp/src/components/common/Matrix/hooks/useMatrix/useMatrix.test.tsx @@ -12,19 +12,21 @@ * This file is part of the Antares project. */ -import { renderHook, act, waitFor } from "@testing-library/react"; -import { useMatrix } from "../useMatrix"; -import * as apiMatrix from "@/services/api/matrix"; -import * as apiStudy from "@/services/api/study"; -import * as rawStudy from "@/services/api/studies/raw"; +import { GridCellKind } from "@glideapps/glide-data-grid"; +import { act, renderHook, waitFor } from "@testing-library/react"; + import { MatrixEditDTO, MatrixIndex, Operator, StudyOutputDownloadLevelDTO, } from "@/common/types"; +import * as apiMatrix from "@/services/api/matrix"; +import * as rawStudy from "@/services/api/studies/raw"; +import * as apiStudy from "@/services/api/study"; + import { GridUpdate, MatrixDataDTO } from "../../shared/types"; -import { GridCellKind } from "@glideapps/glide-data-grid"; +import { useMatrix } from "../useMatrix"; vi.mock("@/services/api/matrix"); vi.mock("@/services/api/study"); diff --git a/webapp/src/components/common/Matrix/hooks/useMatrixPortal/useMatrixPortal.test.tsx b/webapp/src/components/common/Matrix/hooks/useMatrixPortal/useMatrixPortal.test.tsx index 8b3bdfda32..72aa50e1f8 100644 --- a/webapp/src/components/common/Matrix/hooks/useMatrixPortal/useMatrixPortal.test.tsx +++ b/webapp/src/components/common/Matrix/hooks/useMatrixPortal/useMatrixPortal.test.tsx @@ -14,6 +14,7 @@ import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; + import { useMatrixPortal } from "../useMatrixPortal"; function NonRefComponent() { diff --git a/webapp/src/components/common/Matrix/index.tsx b/webapp/src/components/common/Matrix/index.tsx index de3de41a39..99ce6b9e1c 100644 --- a/webapp/src/components/common/Matrix/index.tsx +++ b/webapp/src/components/common/Matrix/index.tsx @@ -13,20 +13,23 @@ */ import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { useOutletContext } from "react-router"; + import { Divider, Skeleton } from "@mui/material"; + import { StudyMetadata } from "@/common/types"; import { fetchMatrixFn } from "@/components/App/Singlestudy/explore/Modelization/Areas/Hydro/utils"; -import MatrixGrid from "./components/MatrixGrid"; -import { useMatrix } from "./hooks/useMatrix"; -import { useTranslation } from "react-i18next"; -import { useOutletContext } from "react-router"; + import ImportDialog from "../dialogs/ImportDialog"; import EmptyView from "../page/SimpleContent"; + import MatrixActions from "./components/MatrixActions"; +import MatrixGrid from "./components/MatrixGrid"; +import { useMatrix } from "./hooks/useMatrix"; import { AggregateConfig } from "./shared/types"; import { MatrixContainer, MatrixHeader, MatrixTitle } from "./styles"; - interface MatrixProps { url: string; title?: string; diff --git a/webapp/src/components/common/Matrix/shared/__tests__/fixtures.ts b/webapp/src/components/common/Matrix/shared/__tests__/fixtures.ts index c6a728b816..a4730be14d 100644 --- a/webapp/src/components/common/Matrix/shared/__tests__/fixtures.ts +++ b/webapp/src/components/common/Matrix/shared/__tests__/fixtures.ts @@ -13,6 +13,7 @@ */ import { Aggregate, TimeFrequency } from "../constants"; + import { FormatTestCase } from "./types"; export const BASE_DATA = { diff --git a/webapp/src/components/common/Matrix/shared/__tests__/utils.test.ts b/webapp/src/components/common/Matrix/shared/__tests__/utils.test.ts index ace38e0f34..7255b9903a 100644 --- a/webapp/src/components/common/Matrix/shared/__tests__/utils.test.ts +++ b/webapp/src/components/common/Matrix/shared/__tests__/utils.test.ts @@ -21,12 +21,13 @@ import { generateTimeSeriesColumns, getAggregateTypes, } from "../utils"; + import { - DATE_TIME_TEST_CASES, - COLUMN_TEST_CASES, + AGGREGATE_CONFIG_CASES, AGGREGATE_TEST_CASES, + COLUMN_TEST_CASES, + DATE_TIME_TEST_CASES, FORMAT_TEST_CASES, - AGGREGATE_CONFIG_CASES, } from "./fixtures"; describe("Matrix Utils", () => { diff --git a/webapp/src/components/common/Matrix/shared/constants.ts b/webapp/src/components/common/Matrix/shared/constants.ts index 026d91bcf3..c98416c2ca 100644 --- a/webapp/src/components/common/Matrix/shared/constants.ts +++ b/webapp/src/components/common/Matrix/shared/constants.ts @@ -13,21 +13,22 @@ */ import { - DateIncrementFunction, - FormatFunction, - TimeFrequencyType, -} from "./types"; -import { - addYears, + addDays, + addHours, addMonths, addWeeks, - startOfWeek, + addYears, FirstWeekContainsDate, - addDays, - addHours, format, + startOfWeek, } from "date-fns"; import { t } from "i18next"; + +import { + DateIncrementFunction, + FormatFunction, + TimeFrequencyType, +} from "./types"; import { getLocale } from "./utils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/components/common/Matrix/shared/types.ts b/webapp/src/components/common/Matrix/shared/types.ts index 915602d0e1..ae29bd5e3a 100644 --- a/webapp/src/components/common/Matrix/shared/types.ts +++ b/webapp/src/components/common/Matrix/shared/types.ts @@ -17,6 +17,7 @@ import { EditableGridCell, Item, } from "@glideapps/glide-data-grid"; + import { Aggregate, Column, Operation, TimeFrequency } from "./constants"; // Derived types diff --git a/webapp/src/components/common/Matrix/shared/utils.ts b/webapp/src/components/common/Matrix/shared/utils.ts index de9b24277c..00b8087c1e 100644 --- a/webapp/src/components/common/Matrix/shared/utils.ts +++ b/webapp/src/components/common/Matrix/shared/utils.ts @@ -12,20 +12,22 @@ * This file is part of the Antares project. */ +import { Locale, parseISO } from "date-fns"; +import { enUS, fr } from "date-fns/locale"; + +import { getCurrentLanguage } from "@/utils/i18nUtils"; + +import { Aggregate, Column, TIME_FREQUENCY_CONFIG } from "./constants"; import { - type EnhancedGridColumn, - type TimeSeriesColumnOptions, - type CustomColumnOptions, - type MatrixAggregates, - type AggregateType, type AggregateConfig, + type AggregateType, + type CustomColumnOptions, type DateTimeMetadataDTO, + type EnhancedGridColumn, type FormatGridNumberOptions, + type MatrixAggregates, + type TimeSeriesColumnOptions, } from "./types"; -import { parseISO, Locale } from "date-fns"; -import { fr, enUS } from "date-fns/locale"; -import { getCurrentLanguage } from "@/utils/i18nUtils"; -import { Aggregate, Column, TIME_FREQUENCY_CONFIG } from "./constants"; /** * Formats a number for display in a grid cell by adding thousand separators and handling decimals. diff --git a/webapp/src/components/common/PropertiesView.tsx b/webapp/src/components/common/PropertiesView.tsx index 2e68e84997..f8c9dff113 100644 --- a/webapp/src/components/common/PropertiesView.tsx +++ b/webapp/src/components/common/PropertiesView.tsx @@ -13,11 +13,14 @@ */ import { ReactNode } from "react"; +import { useTranslation } from "react-i18next"; + +import { Add } from "@mui/icons-material"; import { Box, Button, SxProps, Theme } from "@mui/material"; -import SearchFE from "./fieldEditors/SearchFE"; + import { mergeSxProp } from "@/utils/muiUtils"; -import { Add } from "@mui/icons-material"; -import { useTranslation } from "react-i18next"; + +import SearchFE from "./fieldEditors/SearchFE"; interface PropsType { topContent?: ReactNode; diff --git a/webapp/src/components/common/SelectMulti.tsx b/webapp/src/components/common/SelectMulti.tsx index af56dcec90..1688f6f847 100644 --- a/webapp/src/components/common/SelectMulti.tsx +++ b/webapp/src/components/common/SelectMulti.tsx @@ -13,6 +13,7 @@ */ import * as React from "react"; + import { Box, Checkbox, @@ -26,6 +27,7 @@ import { SxProps, Theme, } from "@mui/material"; + import { GenericInfo } from "@/common/types"; import { mergeSxProp } from "@/utils/muiUtils"; diff --git a/webapp/src/components/common/SelectSingle.tsx b/webapp/src/components/common/SelectSingle.tsx index 7b9a26b64e..654f855d55 100644 --- a/webapp/src/components/common/SelectSingle.tsx +++ b/webapp/src/components/common/SelectSingle.tsx @@ -12,6 +12,8 @@ * This file is part of the Antares project. */ +import { useTranslation } from "react-i18next"; + import { FormControl, InputBaseProps, @@ -22,7 +24,7 @@ import { SxProps, Theme, } from "@mui/material"; -import { useTranslation } from "react-i18next"; + import { GenericInfo } from "@/common/types"; import { mergeSxProp } from "@/utils/muiUtils"; diff --git a/webapp/src/components/common/SnackErrorMessage.tsx b/webapp/src/components/common/SnackErrorMessage.tsx index ddc0fc87b7..482b58fe01 100644 --- a/webapp/src/components/common/SnackErrorMessage.tsx +++ b/webapp/src/components/common/SnackErrorMessage.tsx @@ -12,10 +12,14 @@ * This file is part of the Antares project. */ -import { useState, forwardRef, useCallback } from "react"; +import { forwardRef, useCallback, useState } from "react"; import * as React from "react"; -import { useSnackbar, SnackbarContent } from "notistack"; import axios from "axios"; +import { SnackbarContent, useSnackbar } from "notistack"; + +import CancelRoundedIcon from "@mui/icons-material/CancelRounded"; +import CloseRoundedIcon from "@mui/icons-material/CloseRounded"; +import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import { Box, Card, @@ -27,9 +31,6 @@ import { styled, Typography, } from "@mui/material"; -import CancelRoundedIcon from "@mui/icons-material/CancelRounded"; -import CloseRoundedIcon from "@mui/icons-material/CloseRounded"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; const Snackbar = styled(SnackbarContent)(({ theme }) => ({ [theme.breakpoints.up("sm")]: { diff --git a/webapp/src/components/common/SplitLayoutView.tsx b/webapp/src/components/common/SplitLayoutView.tsx index 4145a9e13d..c499f62df2 100644 --- a/webapp/src/components/common/SplitLayoutView.tsx +++ b/webapp/src/components/common/SplitLayoutView.tsx @@ -13,7 +13,8 @@ */ import { ReactNode } from "react"; -import { Divider, Box, SxProps, Theme } from "@mui/material"; + +import { Box, Divider, SxProps, Theme } from "@mui/material"; interface Props { left: ReactNode; diff --git a/webapp/src/components/common/SplitView/index.tsx b/webapp/src/components/common/SplitView/index.tsx index 4cc8b65c3a..41f525d5fa 100644 --- a/webapp/src/components/common/SplitView/index.tsx +++ b/webapp/src/components/common/SplitView/index.tsx @@ -14,8 +14,11 @@ import React, { useEffect, useState } from "react"; import Split, { SplitProps } from "react-split"; + import { Box } from "@mui/material"; + import storage from "@/services/utils/localStorage"; + import "./style.css"; export interface SplitViewProps { diff --git a/webapp/src/components/common/StarToggle.tsx b/webapp/src/components/common/StarToggle.tsx index 44698cbf96..720e1c11ed 100644 --- a/webapp/src/components/common/StarToggle.tsx +++ b/webapp/src/components/common/StarToggle.tsx @@ -12,9 +12,9 @@ * This file is part of the Antares project. */ -import { Tooltip } from "@mui/material"; -import StarPurple500OutlinedIcon from "@mui/icons-material/StarPurple500Outlined"; import StarOutlineOutlinedIcon from "@mui/icons-material/StarOutlineOutlined"; +import StarPurple500OutlinedIcon from "@mui/icons-material/StarPurple500Outlined"; +import { Tooltip } from "@mui/material"; interface Props { isActive: boolean; diff --git a/webapp/src/components/common/TableForm/Table.tsx b/webapp/src/components/common/TableForm/Table.tsx index 9d8f3b4dfb..d811a10e7c 100644 --- a/webapp/src/components/common/TableForm/Table.tsx +++ b/webapp/src/components/common/TableForm/Table.tsx @@ -12,11 +12,14 @@ * This file is part of the Antares project. */ +import { useMemo } from "react"; import HT from "handsontable"; import * as RA from "ramda-adjunct"; -import { useMemo } from "react"; -import type { IdType } from "@/common/types"; + import { HotTableClass } from "@handsontable/react"; + +import type { IdType } from "@/common/types"; + import { useFormContextPlus } from "../Form"; import Handsontable, { HandsontableProps } from "../Handsontable"; diff --git a/webapp/src/components/common/TableForm/index.tsx b/webapp/src/components/common/TableForm/index.tsx index f0d6022194..9032687095 100644 --- a/webapp/src/components/common/TableForm/index.tsx +++ b/webapp/src/components/common/TableForm/index.tsx @@ -12,20 +12,23 @@ * This file is part of the Antares project. */ -import * as RA from "ramda-adjunct"; +import { useMemo } from "react"; import HT from "handsontable"; import { startCase } from "lodash"; import * as R from "ramda"; -import { Box, type SxProps } from "@mui/material"; -import type { Theme } from "@mui/material"; -import { useMemo } from "react"; +import * as RA from "ramda-adjunct"; import { DefaultValues } from "react-hook-form"; + +import type { Theme } from "@mui/material"; +import { Box, type SxProps } from "@mui/material"; + import type { IdType } from "@/common/types"; import Form, { FormProps } from "@/components/common/Form"; +import useMemoLocked from "@/hooks/useMemoLocked"; +import { mergeSxProp } from "@/utils/muiUtils"; + import Table, { TableProps } from "./Table"; import { getCellType } from "./utils"; -import { mergeSxProp } from "@/utils/muiUtils"; -import useMemoLocked from "@/hooks/useMemoLocked"; type TableFieldValuesByRow = Record< IdType, diff --git a/webapp/src/components/common/TableMode.tsx b/webapp/src/components/common/TableMode.tsx index 7098cb5b34..cec3a11ecf 100644 --- a/webapp/src/components/common/TableMode.tsx +++ b/webapp/src/components/common/TableMode.tsx @@ -13,6 +13,10 @@ */ import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; + +import GridOffIcon from "@mui/icons-material/GridOff"; + import { StudyMetadata } from "@/common/types"; import usePromise from "@/hooks/usePromise"; import { getTableMode, setTableMode } from "@/services/api/studies/tableMode"; @@ -21,12 +25,11 @@ import { TableModeColumnsForType, TableModeType, } from "@/services/api/studies/tableMode/types"; + import { SubmitHandlerPlus } from "./Form/types"; -import TableForm from "./TableForm"; -import UsePromiseCond from "./utils/UsePromiseCond"; -import GridOffIcon from "@mui/icons-material/GridOff"; import EmptyView from "./page/SimpleContent"; -import { useTranslation } from "react-i18next"; +import UsePromiseCond from "./utils/UsePromiseCond"; +import TableForm from "./TableForm"; export interface TableModeProps { studyId: StudyMetadata["id"]; diff --git a/webapp/src/components/common/TabsView.tsx b/webapp/src/components/common/TabsView.tsx index cfee995bbf..373e10f553 100644 --- a/webapp/src/components/common/TabsView.tsx +++ b/webapp/src/components/common/TabsView.tsx @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ +import { useState } from "react"; + import { TabContext, TabList, TabListProps, TabPanel } from "@mui/lab"; import { Box, Tab } from "@mui/material"; -import { useState } from "react"; interface TabsViewProps { items: Array<{ diff --git a/webapp/src/components/common/TextSeparator.tsx b/webapp/src/components/common/TextSeparator.tsx index 1348627465..c22a827f41 100644 --- a/webapp/src/components/common/TextSeparator.tsx +++ b/webapp/src/components/common/TextSeparator.tsx @@ -12,7 +12,7 @@ * This file is part of the Antares project. */ -import { SxProps, Theme, Divider, Typography, Box } from "@mui/material"; +import { Box, Divider, SxProps, Theme, Typography } from "@mui/material"; interface Props { text: string; diff --git a/webapp/src/components/common/TreeItemEnhanced.tsx b/webapp/src/components/common/TreeItemEnhanced.tsx index 04aae97aa7..ff1ef60c82 100644 --- a/webapp/src/components/common/TreeItemEnhanced.tsx +++ b/webapp/src/components/common/TreeItemEnhanced.tsx @@ -12,9 +12,11 @@ * This file is part of the Antares project. */ +import * as R from "ramda"; + import { TreeItem, type TreeItemProps } from "@mui/x-tree-view/TreeItem"; + import { mergeSxProp } from "@/utils/muiUtils"; -import * as R from "ramda"; export type TreeItemEnhancedProps = TreeItemProps; diff --git a/webapp/src/components/common/buttons/DownloadButton.tsx b/webapp/src/components/common/buttons/DownloadButton.tsx index ffc5a5ebca..98f551c57b 100644 --- a/webapp/src/components/common/buttons/DownloadButton.tsx +++ b/webapp/src/components/common/buttons/DownloadButton.tsx @@ -12,14 +12,17 @@ * This file is part of the Antares project. */ -import FileUploadIcon from "@mui/icons-material/FileUpload"; -import SplitButton, { SplitButtonProps } from "./SplitButton"; import { useState } from "react"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { useTranslation } from "react-i18next"; -import type { PromiseAny } from "@/utils/tsUtils"; + +import FileUploadIcon from "@mui/icons-material/FileUpload"; import { LoadingButton } from "@mui/lab"; + +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { toError } from "@/utils/fnUtils"; +import type { PromiseAny } from "@/utils/tsUtils"; + +import SplitButton, { SplitButtonProps } from "./SplitButton"; export type DownloadButtonProps = { children?: React.ReactNode; diff --git a/webapp/src/components/common/buttons/DownloadMatrixButton.tsx b/webapp/src/components/common/buttons/DownloadMatrixButton.tsx index 0611689b3c..9dd5792df6 100644 --- a/webapp/src/components/common/buttons/DownloadMatrixButton.tsx +++ b/webapp/src/components/common/buttons/DownloadMatrixButton.tsx @@ -12,10 +12,12 @@ * This file is part of the Antares project. */ +import { useTranslation } from "react-i18next"; + +import { StudyMetadata } from "@/common/types"; import { downloadMatrix } from "@/services/api/studies/raw"; import { downloadFile } from "@/utils/fileUtils"; -import { StudyMetadata } from "@/common/types"; -import { useTranslation } from "react-i18next"; + import DownloadButton from "./DownloadButton"; export interface DownloadMatrixButtonProps { diff --git a/webapp/src/components/common/buttons/SplitButton.tsx b/webapp/src/components/common/buttons/SplitButton.tsx index 52bca20142..2d95d052fc 100644 --- a/webapp/src/components/common/buttons/SplitButton.tsx +++ b/webapp/src/components/common/buttons/SplitButton.tsx @@ -12,17 +12,18 @@ * This file is part of the Antares project. */ +import { useRef, useState } from "react"; + +import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; +import LoadingButton, { type LoadingButtonProps } from "@mui/lab/LoadingButton"; import Button from "@mui/material/Button"; import ButtonGroup, { ButtonGroupProps } from "@mui/material/ButtonGroup"; -import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; import ClickAwayListener from "@mui/material/ClickAwayListener"; import Grow from "@mui/material/Grow"; -import Paper from "@mui/material/Paper"; -import Popper from "@mui/material/Popper"; import MenuItem from "@mui/material/MenuItem"; import MenuList from "@mui/material/MenuList"; -import { useRef, useState } from "react"; -import LoadingButton, { type LoadingButtonProps } from "@mui/lab/LoadingButton"; +import Paper from "@mui/material/Paper"; +import Popper from "@mui/material/Popper"; interface OptionObj { value: Value; diff --git a/webapp/src/components/common/buttons/UploadFileButton.tsx b/webapp/src/components/common/buttons/UploadFileButton.tsx index d98f2c3911..53541e3e48 100644 --- a/webapp/src/components/common/buttons/UploadFileButton.tsx +++ b/webapp/src/components/common/buttons/UploadFileButton.tsx @@ -12,16 +12,18 @@ * This file is part of the Antares project. */ -import { LoadingButton } from "@mui/lab"; -import FileDownloadIcon from "@mui/icons-material/FileDownload"; import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import { toError } from "@/utils/fnUtils"; +import { useSnackbar } from "notistack"; import { Accept, useDropzone } from "react-dropzone"; +import { useTranslation } from "react-i18next"; + +import FileDownloadIcon from "@mui/icons-material/FileDownload"; +import { LoadingButton } from "@mui/lab"; + import { StudyMetadata } from "@/common/types"; -import { useSnackbar } from "notistack"; +import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { importFile } from "@/services/api/studies/raw"; +import { toError } from "@/utils/fnUtils"; type ValidateResult = boolean | null | undefined; type Validate = (file: File) => ValidateResult | Promise; diff --git a/webapp/src/components/common/dialogs/BasicDialog.tsx b/webapp/src/components/common/dialogs/BasicDialog.tsx index 348b2642b6..9877c716aa 100644 --- a/webapp/src/components/common/dialogs/BasicDialog.tsx +++ b/webapp/src/components/common/dialogs/BasicDialog.tsx @@ -12,19 +12,21 @@ * This file is part of the Antares project. */ +import * as R from "ramda"; +import * as RA from "ramda-adjunct"; + +import { SvgIconComponent } from "@mui/icons-material"; import { Dialog, DialogActions, DialogContent, + DialogContentProps, DialogContentText, DialogProps, DialogTitle, styled, - DialogContentProps, } from "@mui/material"; -import * as RA from "ramda-adjunct"; -import { SvgIconComponent } from "@mui/icons-material"; -import * as R from "ramda"; + import { mergeSxProp } from "@/utils/muiUtils"; enum Alert { diff --git a/webapp/src/components/common/dialogs/ConfirmationDialog.tsx b/webapp/src/components/common/dialogs/ConfirmationDialog.tsx index df8141906f..5b982b8478 100644 --- a/webapp/src/components/common/dialogs/ConfirmationDialog.tsx +++ b/webapp/src/components/common/dialogs/ConfirmationDialog.tsx @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { Button } from "@mui/material"; import { useTranslation } from "react-i18next"; + +import { Button } from "@mui/material"; + import BasicDialog, { BasicDialogProps } from "./BasicDialog"; export interface ConfirmationDialogProps diff --git a/webapp/src/components/common/dialogs/DataViewerDialog/index.tsx b/webapp/src/components/common/dialogs/DataViewerDialog/index.tsx index fa4d16c507..1dd58538fc 100644 --- a/webapp/src/components/common/dialogs/DataViewerDialog/index.tsx +++ b/webapp/src/components/common/dialogs/DataViewerDialog/index.tsx @@ -12,17 +12,21 @@ * This file is part of the Antares project. */ -import { useTranslation } from "react-i18next"; -import { Box, IconButton, Tooltip, Typography } from "@mui/material"; import { useSnackbar } from "notistack"; +import { useTranslation } from "react-i18next"; + import ContentCopyIcon from "@mui/icons-material/ContentCopy"; -import { Code } from "./styles"; +import { Box, IconButton, Tooltip, Typography } from "@mui/material"; + import { MatrixType } from "@/common/types"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import OkDialog from "@/OkDialog"; -import EditableMatrix from "@/EditableMatrix"; import { getStudyMatrixIndex } from "@/services/api/matrix"; -import SimpleLoader from "@/loaders/SimpleLoader"; + +import EditableMatrix from "../../EditableMatrix"; +import SimpleLoader from "../../loaders/SimpleLoader"; +import OkDialog from "../OkDialog"; + +import { Code } from "./styles"; type MatrixTypeWithId = MatrixType & { id?: string }; diff --git a/webapp/src/components/common/dialogs/DigestDialog.tsx b/webapp/src/components/common/dialogs/DigestDialog.tsx index 4da9083e2c..6db0856588 100644 --- a/webapp/src/components/common/dialogs/DigestDialog.tsx +++ b/webapp/src/components/common/dialogs/DigestDialog.tsx @@ -12,17 +12,21 @@ * This file is part of the Antares project. */ +import { AxiosError } from "axios"; +import { useTranslation } from "react-i18next"; + +import SearchOffIcon from "@mui/icons-material/SearchOff"; import { Skeleton } from "@mui/material"; -import OkDialog, { OkDialogProps } from "./OkDialog"; + import type { LaunchJob } from "@/common/types"; -import { getStudyData } from "@/services/api/study"; import usePromise from "@/hooks/usePromise"; -import { useTranslation } from "react-i18next"; -import { AxiosError } from "axios"; -import SearchOffIcon from "@mui/icons-material/SearchOff"; -import UsePromiseCond from "../utils/UsePromiseCond"; -import EmptyView from "../page/SimpleContent"; +import { getStudyData } from "@/services/api/study"; + import EditableMatrix from "../EditableMatrix"; +import EmptyView from "../page/SimpleContent"; +import UsePromiseCond from "../utils/UsePromiseCond"; + +import OkDialog, { OkDialogProps } from "./OkDialog"; // TODO: redesign DataViewerDialog to use path, then remove this component diff --git a/webapp/src/components/common/dialogs/FormDialog.tsx b/webapp/src/components/common/dialogs/FormDialog.tsx index 4980244f5d..c0f58a40d1 100644 --- a/webapp/src/components/common/dialogs/FormDialog.tsx +++ b/webapp/src/components/common/dialogs/FormDialog.tsx @@ -13,16 +13,19 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Button } from "@mui/material"; import { useId, useState } from "react"; +import * as RA from "ramda-adjunct"; import { FieldValues, FormState } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { LoadingButton } from "@mui/lab"; -import * as RA from "ramda-adjunct"; + import SaveIcon from "@mui/icons-material/Save"; -import BasicDialog, { BasicDialogProps } from "./BasicDialog"; +import { LoadingButton } from "@mui/lab"; +import { Button } from "@mui/material"; + import Form, { FormProps } from "../Form"; +import BasicDialog, { BasicDialogProps } from "./BasicDialog"; + type SuperType< TFieldValues extends FieldValues, TContext, diff --git a/webapp/src/components/common/dialogs/ImportDialog.tsx b/webapp/src/components/common/dialogs/ImportDialog.tsx index 71e96504d7..b63a277284 100644 --- a/webapp/src/components/common/dialogs/ImportDialog.tsx +++ b/webapp/src/components/common/dialogs/ImportDialog.tsx @@ -13,16 +13,19 @@ */ import { useEffect, useState } from "react"; -import { Box, Button, LinearProgress, Paper, Typography } from "@mui/material"; -import { FileRejection, useDropzone, type Accept } from "react-dropzone"; +import { enqueueSnackbar } from "notistack"; +import { type Accept, FileRejection, useDropzone } from "react-dropzone"; import { useTranslation } from "react-i18next"; -import BasicDialog, { BasicDialogProps } from "./BasicDialog"; + +import FileDownloadIcon from "@mui/icons-material/FileDownload"; +import { Box, Button, LinearProgress, Paper, Typography } from "@mui/material"; import { blue, grey } from "@mui/material/colors"; + import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; import { toError } from "@/utils/fnUtils"; -import { enqueueSnackbar } from "notistack"; import { PromiseAny } from "@/utils/tsUtils"; -import FileDownloadIcon from "@mui/icons-material/FileDownload"; + +import BasicDialog, { BasicDialogProps } from "./BasicDialog"; interface ImportDialogProps extends Omit { dropzoneText?: string; diff --git a/webapp/src/components/common/dialogs/OkDialog.tsx b/webapp/src/components/common/dialogs/OkDialog.tsx index c8245eb533..1601c1e81b 100644 --- a/webapp/src/components/common/dialogs/OkDialog.tsx +++ b/webapp/src/components/common/dialogs/OkDialog.tsx @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { Button, ButtonProps } from "@mui/material"; import { useTranslation } from "react-i18next"; + +import { Button, ButtonProps } from "@mui/material"; + import BasicDialog, { BasicDialogProps } from "./BasicDialog"; export interface OkDialogProps extends Omit { diff --git a/webapp/src/components/common/fieldEditors/BooleanFE.tsx b/webapp/src/components/common/fieldEditors/BooleanFE.tsx index d070e5c93f..a527b0a0d7 100644 --- a/webapp/src/components/common/fieldEditors/BooleanFE.tsx +++ b/webapp/src/components/common/fieldEditors/BooleanFE.tsx @@ -12,9 +12,12 @@ * This file is part of the Antares project. */ -import { SelectProps } from "@mui/material"; import * as RA from "ramda-adjunct"; + +import { SelectProps } from "@mui/material"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; + import SelectFE, { SelectFEProps } from "./SelectFE"; export interface BooleanFEProps diff --git a/webapp/src/components/common/fieldEditors/CheckBoxFE.tsx b/webapp/src/components/common/fieldEditors/CheckBoxFE.tsx index 36bf51a7b1..d65ec88522 100644 --- a/webapp/src/components/common/fieldEditors/CheckBoxFE.tsx +++ b/webapp/src/components/common/fieldEditors/CheckBoxFE.tsx @@ -20,6 +20,7 @@ import { FormControlLabelProps, FormHelperText, } from "@mui/material"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; export interface CheckBoxFEProps diff --git a/webapp/src/components/common/fieldEditors/CheckboxesTagsFE.tsx b/webapp/src/components/common/fieldEditors/CheckboxesTagsFE.tsx index 71c1fbf403..a90c66f3ad 100644 --- a/webapp/src/components/common/fieldEditors/CheckboxesTagsFE.tsx +++ b/webapp/src/components/common/fieldEditors/CheckboxesTagsFE.tsx @@ -12,6 +12,10 @@ * This file is part of the Antares project. */ +import { FieldPath, FieldValues } from "react-hook-form"; + +import CheckBoxIcon from "@mui/icons-material/CheckBox"; +import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank"; import { Autocomplete, AutocompleteProps, @@ -19,9 +23,7 @@ import { Checkbox, TextField, } from "@mui/material"; -import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank"; -import CheckBoxIcon from "@mui/icons-material/CheckBox"; -import { FieldPath, FieldValues } from "react-hook-form"; + import reactHookFormSupport, { ReactHookFormSupportProps, } from "@/hoc/reactHookFormSupport"; diff --git a/webapp/src/components/common/fieldEditors/ColorPickerFE/index.tsx b/webapp/src/components/common/fieldEditors/ColorPickerFE/index.tsx index b4641e235f..51eace1af1 100644 --- a/webapp/src/components/common/fieldEditors/ColorPickerFE/index.tsx +++ b/webapp/src/components/common/fieldEditors/ColorPickerFE/index.tsx @@ -12,15 +12,18 @@ * This file is part of the Antares project. */ -import { Box, TextField, TextFieldProps, InputAdornment } from "@mui/material"; import { ChangeEvent, useRef, useState } from "react"; import { ColorResult, SketchPicker } from "react-color"; -import SquareRoundedIcon from "@mui/icons-material/SquareRounded"; import { useClickAway, useKey, useUpdateEffect } from "react-use"; -import { rgbToString, stringToRGB } from "./utils"; + +import SquareRoundedIcon from "@mui/icons-material/SquareRounded"; +import { Box, InputAdornment, TextField, TextFieldProps } from "@mui/material"; + +import reactHookFormSupport from "@/hoc/reactHookFormSupport"; import { mergeSxProp } from "@/utils/muiUtils"; import { composeRefs } from "@/utils/reactUtils"; -import reactHookFormSupport from "@/hoc/reactHookFormSupport"; + +import { rgbToString, stringToRGB } from "./utils"; export type ColorPickerFEProps = Omit< TextFieldProps, diff --git a/webapp/src/components/common/fieldEditors/ListFE/index.tsx b/webapp/src/components/common/fieldEditors/ListFE/index.tsx index 05b236c260..5c37d37f35 100644 --- a/webapp/src/components/common/fieldEditors/ListFE/index.tsx +++ b/webapp/src/components/common/fieldEditors/ListFE/index.tsx @@ -12,6 +12,20 @@ * This file is part of the Antares project. */ +import { useEffect, useId, useState } from "react"; +import * as RA from "ramda-adjunct"; +import { + DragDropContext, + Draggable, + Droppable, + DropResult, +} from "react-beautiful-dnd"; +import { FieldPath, FieldValues } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { useUpdateEffect } from "react-use"; + +import DragHandleIcon from "@mui/icons-material/DragHandle"; +import RemoveCircleIcon from "@mui/icons-material/RemoveCircle"; import { Autocomplete, Box, @@ -28,19 +42,7 @@ import { setRef, Typography, } from "@mui/material"; -import { useTranslation } from "react-i18next"; -import RemoveCircleIcon from "@mui/icons-material/RemoveCircle"; -import { useEffect, useId, useState } from "react"; -import { - DragDropContext, - Droppable, - Draggable, - DropResult, -} from "react-beautiful-dnd"; -import DragHandleIcon from "@mui/icons-material/DragHandle"; -import * as RA from "ramda-adjunct"; -import { useUpdateEffect } from "react-use"; -import { FieldPath, FieldValues } from "react-hook-form"; + import reactHookFormSupport, { ReactHookFormSupportProps, } from "@/hoc/reactHookFormSupport"; @@ -52,9 +54,11 @@ import { FakeChangeEventHandler, InputObject, } from "@/utils/feUtils"; -import { makeLabel, makeListItems } from "./utils"; + import StringFE from "../StringFE"; +import { makeLabel, makeListItems } from "./utils"; + interface ListFEProps { defaultValue?: TItem[]; value?: TItem[]; diff --git a/webapp/src/components/common/fieldEditors/ListFE/utils.ts b/webapp/src/components/common/fieldEditors/ListFE/utils.ts index 0496f1f066..5de281250f 100644 --- a/webapp/src/components/common/fieldEditors/ListFE/utils.ts +++ b/webapp/src/components/common/fieldEditors/ListFE/utils.ts @@ -12,8 +12,8 @@ * This file is part of the Antares project. */ -import { v4 as uuidv4 } from "uuid"; import * as RA from "ramda-adjunct"; +import { v4 as uuidv4 } from "uuid"; export function makeListItems( value: readonly T[], diff --git a/webapp/src/components/common/fieldEditors/NumberFE.tsx b/webapp/src/components/common/fieldEditors/NumberFE.tsx index 0f83427bb9..f49c29f300 100644 --- a/webapp/src/components/common/fieldEditors/NumberFE.tsx +++ b/webapp/src/components/common/fieldEditors/NumberFE.tsx @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { TextField, TextFieldProps } from "@mui/material"; import * as RA from "ramda-adjunct"; + +import { TextField, TextFieldProps } from "@mui/material"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; export type NumberFEProps = { diff --git a/webapp/src/components/common/fieldEditors/PasswordFE.tsx b/webapp/src/components/common/fieldEditors/PasswordFE.tsx index 14b4fc423b..e9a91c8842 100644 --- a/webapp/src/components/common/fieldEditors/PasswordFE.tsx +++ b/webapp/src/components/common/fieldEditors/PasswordFE.tsx @@ -13,6 +13,7 @@ */ import { TextField, TextFieldProps } from "@mui/material"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; export type PasswordFEProps = { diff --git a/webapp/src/components/common/fieldEditors/SearchFE.tsx b/webapp/src/components/common/fieldEditors/SearchFE.tsx index 39b1e1d626..a684b09d1c 100644 --- a/webapp/src/components/common/fieldEditors/SearchFE.tsx +++ b/webapp/src/components/common/fieldEditors/SearchFE.tsx @@ -12,14 +12,16 @@ * This file is part of the Antares project. */ -import { IconButton, InputAdornment } from "@mui/material"; -import SearchIcon from "@mui/icons-material/Search"; -import ClearIcon from "@mui/icons-material/Clear"; -import { useTranslation } from "react-i18next"; -import clsx from "clsx"; import { useState } from "react"; -import { useUpdateEffect } from "react-use"; +import clsx from "clsx"; import * as RA from "ramda-adjunct"; +import { useTranslation } from "react-i18next"; +import { useUpdateEffect } from "react-use"; + +import ClearIcon from "@mui/icons-material/Clear"; +import SearchIcon from "@mui/icons-material/Search"; +import { IconButton, InputAdornment } from "@mui/material"; + import StringFE, { StringFEProps } from "./StringFE"; export interface SearchFE extends Omit { diff --git a/webapp/src/components/common/fieldEditors/SelectFE.tsx b/webapp/src/components/common/fieldEditors/SelectFE.tsx index 99022e463e..0bfc10057c 100644 --- a/webapp/src/components/common/fieldEditors/SelectFE.tsx +++ b/webapp/src/components/common/fieldEditors/SelectFE.tsx @@ -12,6 +12,12 @@ * This file is part of the Antares project. */ +import { useMemo, useRef } from "react"; +import { startCase } from "lodash"; +import * as RA from "ramda-adjunct"; +import { O } from "ts-toolbelt"; +import { v4 as uuidv4 } from "uuid"; + import { FormControl, FormHelperText, @@ -20,11 +26,7 @@ import { Select, SelectProps, } from "@mui/material"; -import { useMemo, useRef } from "react"; -import { v4 as uuidv4 } from "uuid"; -import * as RA from "ramda-adjunct"; -import { startCase } from "lodash"; -import { O } from "ts-toolbelt"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; type OptionObj = { diff --git a/webapp/src/components/common/fieldEditors/StringFE.tsx b/webapp/src/components/common/fieldEditors/StringFE.tsx index 87fd0f8051..2fe794ef63 100644 --- a/webapp/src/components/common/fieldEditors/StringFE.tsx +++ b/webapp/src/components/common/fieldEditors/StringFE.tsx @@ -13,6 +13,7 @@ */ import { TextField, TextFieldProps } from "@mui/material"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; export type StringFEProps = { diff --git a/webapp/src/components/common/fieldEditors/SwitchFE.tsx b/webapp/src/components/common/fieldEditors/SwitchFE.tsx index 7c76ff361f..8891ac23aa 100644 --- a/webapp/src/components/common/fieldEditors/SwitchFE.tsx +++ b/webapp/src/components/common/fieldEditors/SwitchFE.tsx @@ -20,6 +20,7 @@ import { Switch, SwitchProps, } from "@mui/material"; + import reactHookFormSupport from "@/hoc/reactHookFormSupport"; export interface SwitchFEProps diff --git a/webapp/src/components/common/loaders/AppLoader.tsx b/webapp/src/components/common/loaders/AppLoader.tsx index 64f5561efa..0b3edbeef0 100644 --- a/webapp/src/components/common/loaders/AppLoader.tsx +++ b/webapp/src/components/common/loaders/AppLoader.tsx @@ -14,7 +14,9 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; + import { Box, Typography } from "@mui/material"; + import logo from "@/assets/img/logo.png"; import topRightBackground from "@/assets/img/top-right-background.png"; diff --git a/webapp/src/components/common/loaders/GlobalPageLoadingError.tsx b/webapp/src/components/common/loaders/GlobalPageLoadingError.tsx index a5bbf26d40..3a0e1e0587 100644 --- a/webapp/src/components/common/loaders/GlobalPageLoadingError.tsx +++ b/webapp/src/components/common/loaders/GlobalPageLoadingError.tsx @@ -13,6 +13,7 @@ */ import { Box, Typography } from "@mui/material"; + import topRightBackground from "@/assets/img/top-right-background.png"; function GlobalPageLoadingError() { diff --git a/webapp/src/components/common/loaders/SimpleLoader.tsx b/webapp/src/components/common/loaders/SimpleLoader.tsx index 94efbf71c2..10d7c590da 100644 --- a/webapp/src/components/common/loaders/SimpleLoader.tsx +++ b/webapp/src/components/common/loaders/SimpleLoader.tsx @@ -13,6 +13,7 @@ */ import { useTranslation } from "react-i18next"; + import { Box, CircularProgress } from "@mui/material"; interface PropTypes { diff --git a/webapp/src/components/common/page/BasicPage.tsx b/webapp/src/components/common/page/BasicPage.tsx index ddf8d0576a..e49280ab39 100644 --- a/webapp/src/components/common/page/BasicPage.tsx +++ b/webapp/src/components/common/page/BasicPage.tsx @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { Box, Divider } from "@mui/material"; import { PropsWithChildren, ReactNode } from "react"; +import { Box, Divider } from "@mui/material"; + interface Props { header?: ReactNode; hideHeaderDivider?: boolean; diff --git a/webapp/src/components/common/page/RootPage.tsx b/webapp/src/components/common/page/RootPage.tsx index 7d759a6321..8eb6173d51 100644 --- a/webapp/src/components/common/page/RootPage.tsx +++ b/webapp/src/components/common/page/RootPage.tsx @@ -14,6 +14,7 @@ import { SvgIconComponent } from "@mui/icons-material"; import { Box, Typography } from "@mui/material"; + import BasicPage from "./BasicPage"; interface Props { diff --git a/webapp/src/components/common/page/SimpleContent.tsx b/webapp/src/components/common/page/SimpleContent.tsx index cd4804272c..ee65103fa8 100644 --- a/webapp/src/components/common/page/SimpleContent.tsx +++ b/webapp/src/components/common/page/SimpleContent.tsx @@ -13,9 +13,10 @@ */ import { useTranslation } from "react-i18next"; + +import { SvgIconComponent } from "@mui/icons-material"; import LiveHelpRoundedIcon from "@mui/icons-material/LiveHelpRounded"; import { Box } from "@mui/material"; -import { SvgIconComponent } from "@mui/icons-material"; export interface EmptyViewProps { title?: string; diff --git a/webapp/src/components/common/utils/UsePromiseCond.tsx b/webapp/src/components/common/utils/UsePromiseCond.tsx index ea48f67ded..e3b2c87dcf 100644 --- a/webapp/src/components/common/utils/UsePromiseCond.tsx +++ b/webapp/src/components/common/utils/UsePromiseCond.tsx @@ -13,7 +13,9 @@ */ import * as R from "ramda"; + import { PromiseStatus, UsePromiseResponse } from "@/hooks/usePromise"; + import SimpleLoader from "../loaders/SimpleLoader"; import EmptyView from "../page/SimpleContent"; diff --git a/webapp/src/components/wrappers/LoginWrapper.tsx b/webapp/src/components/wrappers/LoginWrapper.tsx index 92a0f87a0d..c90fb37407 100644 --- a/webapp/src/components/wrappers/LoginWrapper.tsx +++ b/webapp/src/components/wrappers/LoginWrapper.tsx @@ -12,25 +12,28 @@ * This file is part of the Antares project. */ -import { Box, Typography } from "@mui/material"; import { useTranslation } from "react-i18next"; + import LoginIcon from "@mui/icons-material/Login"; -import { login } from "@/redux/ducks/auth"; +import { Box, Typography } from "@mui/material"; + import logo from "@/assets/img/logo.png"; import topRightBackground from "@/assets/img/top-right-background.png"; -import GlobalPageLoadingError from "../common/loaders/GlobalPageLoadingError"; -import AppLoader from "../common/loaders/AppLoader"; -import { needAuth } from "@/services/api/auth"; -import { getAuthUser } from "@/redux/selectors"; import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError"; -import useAppSelector from "@/redux/hooks/useAppSelector"; +import { login } from "@/redux/ducks/auth"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getAuthUser } from "@/redux/selectors"; +import { needAuth } from "@/services/api/auth"; import storage, { StorageKey } from "@/services/utils/localStorage"; -import Form from "../common/Form"; -import StringFE from "../common/fieldEditors/StringFE"; + import PasswordFE from "../common/fieldEditors/PasswordFE"; -import UsePromiseCond from "../common/utils/UsePromiseCond"; +import StringFE from "../common/fieldEditors/StringFE"; +import Form from "../common/Form"; import { SubmitHandlerPlus } from "../common/Form/types"; +import AppLoader from "../common/loaders/AppLoader"; +import GlobalPageLoadingError from "../common/loaders/GlobalPageLoadingError"; +import UsePromiseCond from "../common/utils/UsePromiseCond"; interface FormValues { username: string; diff --git a/webapp/src/components/wrappers/MaintenanceWrapper/MessageInfoDialog.tsx b/webapp/src/components/wrappers/MaintenanceWrapper/MessageInfoDialog.tsx index 2343b31d6f..b937ad8511 100644 --- a/webapp/src/components/wrappers/MaintenanceWrapper/MessageInfoDialog.tsx +++ b/webapp/src/components/wrappers/MaintenanceWrapper/MessageInfoDialog.tsx @@ -13,17 +13,20 @@ */ import { useEffect, useState } from "react"; -import { Box, styled, Typography } from "@mui/material"; -import { useTranslation } from "react-i18next"; import { AxiosError } from "axios"; -import { isStringEmpty, isUserAdmin } from "@/services/utils"; -import { getMessageInfo as getMessageInfoAPI } from "@/services/api/maintenance"; +import { useTranslation } from "react-i18next"; + +import { Box, styled, Typography } from "@mui/material"; + import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar"; -import OkDialog from "../../common/dialogs/OkDialog"; import { setMessageInfo } from "@/redux/ducks/ui"; -import { getAuthUser, getMessageInfo } from "@/redux/selectors"; -import useAppSelector from "@/redux/hooks/useAppSelector"; import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { getAuthUser, getMessageInfo } from "@/redux/selectors"; +import { getMessageInfo as getMessageInfoAPI } from "@/services/api/maintenance"; +import { isStringEmpty, isUserAdmin } from "@/services/utils"; + +import OkDialog from "../../common/dialogs/OkDialog"; export const Main = styled(Box)(({ theme }) => ({ width: "600px", diff --git a/webapp/src/components/wrappers/MaintenanceWrapper/index.tsx b/webapp/src/components/wrappers/MaintenanceWrapper/index.tsx index 48e050c141..c4552cc20a 100644 --- a/webapp/src/components/wrappers/MaintenanceWrapper/index.tsx +++ b/webapp/src/components/wrappers/MaintenanceWrapper/index.tsx @@ -14,20 +14,23 @@ /* eslint-disable react-hooks/exhaustive-deps */ import { ReactNode, useEffect } from "react"; -import { useTranslation } from "react-i18next"; import debug from "debug"; -import { Box, Button, keyframes, styled, Typography } from "@mui/material"; +import { useTranslation } from "react-i18next"; import { useLocation, useNavigate } from "react-router-dom"; + import ErrorIcon from "@mui/icons-material/Error"; -import { isUserAdmin } from "@/services/utils"; -import { getConfig } from "@/services/config"; -import MessageInfoDialog from "./MessageInfoDialog"; -import Stars from "./Stars"; +import { Box, Button, keyframes, styled, Typography } from "@mui/material"; + import { setMaintenanceMode } from "@/redux/ducks/ui"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; import { getAuthUser, getMaintenanceMode } from "@/redux/selectors"; import { getMaintenanceMode as getMaintenanceModeAPI } from "@/services/api/maintenance"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import { getConfig } from "@/services/config"; +import { isUserAdmin } from "@/services/utils"; + +import MessageInfoDialog from "./MessageInfoDialog"; +import Stars from "./Stars"; const logError = debug("antares:maintenancewrapper:error"); diff --git a/webapp/src/components/wrappers/MenuWrapper/index.tsx b/webapp/src/components/wrappers/MenuWrapper/index.tsx index 9929f7de99..2d4f208446 100644 --- a/webapp/src/components/wrappers/MenuWrapper/index.tsx +++ b/webapp/src/components/wrappers/MenuWrapper/index.tsx @@ -15,23 +15,19 @@ import { FunctionComponent, ReactNode, useState } from "react"; import { useTranslation } from "react-i18next"; import { NavLink } from "react-router-dom"; -import Box from "@mui/material/Box"; -import CssBaseline from "@mui/material/CssBaseline"; -import Toolbar from "@mui/material/Toolbar"; -import List from "@mui/material/List"; -import Typography from "@mui/material/Typography"; -import Divider from "@mui/material/Divider"; -import TravelExploreOutlinedIcon from "@mui/icons-material/TravelExploreOutlined"; -import StorageIcon from "@mui/icons-material/Storage"; +import { useMount } from "react-use"; + +import ApiIcon from "@mui/icons-material/Api"; +import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos"; +import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; import AssignmentIcon from "@mui/icons-material/Assignment"; import CenterFocusStrongIcon from "@mui/icons-material/CenterFocusStrong"; -import ApiIcon from "@mui/icons-material/Api"; import ClassOutlinedIcon from "@mui/icons-material/ClassOutlined"; import GitHubIcon from "@mui/icons-material/GitHub"; import LogoutIcon from "@mui/icons-material/Logout"; import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined"; -import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; -import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos"; +import StorageIcon from "@mui/icons-material/Storage"; +import TravelExploreOutlinedIcon from "@mui/icons-material/TravelExploreOutlined"; import { keyframes, styled, @@ -39,35 +35,42 @@ import { Tooltip, useTheme, } from "@mui/material"; -import { useMount } from "react-use"; +import Box from "@mui/material/Box"; +import CssBaseline from "@mui/material/CssBaseline"; +import Divider from "@mui/material/Divider"; +import List from "@mui/material/List"; +import Toolbar from "@mui/material/Toolbar"; +import Typography from "@mui/material/Typography"; + import logo from "@/assets/img/logo.png"; +import topRightBackground from "@/assets/img/top-right-background.png"; +import NotificationBadge from "@/components/App/Tasks/NotificationBadge"; +import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; +import { logout } from "@/redux/ducks/auth"; +import { fetchGroups } from "@/redux/ducks/groups"; import { setMenuCollapse } from "@/redux/ducks/ui"; +import { fetchUsers } from "@/redux/ducks/users"; +import useAppDispatch from "@/redux/hooks/useAppDispatch"; +import useAppSelector from "@/redux/hooks/useAppSelector"; +import { + getCurrentStudyId, + getMenuExtended, + getWebSocketConnected, +} from "@/redux/selectors"; +import { getConfig } from "@/services/config"; + import { + LogoContainer, + MenuContainer, NavDrawer, - NavListItem, NavExternalLink, NavInternalLink, - NavListItemText, + NavListItem, NavListItemIcon, + NavListItemText, Root, TootlbarContent, - MenuContainer, - LogoContainer, } from "./styles"; -import { getConfig } from "@/services/config"; -import { - getCurrentStudyId, - getMenuExtended, - getWebSocketConnected, -} from "@/redux/selectors"; -import { logout } from "@/redux/ducks/auth"; -import useAppSelector from "@/redux/hooks/useAppSelector"; -import useAppDispatch from "@/redux/hooks/useAppDispatch"; -import { fetchUsers } from "@/redux/ducks/users"; -import { fetchGroups } from "@/redux/ducks/groups"; -import NotificationBadge from "@/components/App/Tasks/NotificationBadge"; -import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog"; -import topRightBackground from "@/assets/img/top-right-background.png"; const pulsatingAnimation = keyframes` 0% { diff --git a/webapp/src/components/wrappers/MenuWrapper/styles.ts b/webapp/src/components/wrappers/MenuWrapper/styles.ts index 907b9671da..c02bd91ffa 100644 --- a/webapp/src/components/wrappers/MenuWrapper/styles.ts +++ b/webapp/src/components/wrappers/MenuWrapper/styles.ts @@ -13,12 +13,13 @@ */ import { NavLink } from "react-router-dom"; + +import { Box, styled } from "@mui/material"; import Drawer from "@mui/material/Drawer"; import ListItem from "@mui/material/ListItem"; import ListItemIcon from "@mui/material/ListItemIcon"; import ListItemText from "@mui/material/ListItemText"; -import { Box, styled } from "@mui/material"; import { DRAWER_WIDTH, DRAWER_WIDTH_EXTENDED } from "@/theme"; export const Root = styled(Box)({ diff --git a/webapp/src/hoc/reactHookFormSupport.tsx b/webapp/src/hoc/reactHookFormSupport.tsx index 8761c1c0e2..fe0c45c064 100644 --- a/webapp/src/hoc/reactHookFormSupport.tsx +++ b/webapp/src/hoc/reactHookFormSupport.tsx @@ -13,8 +13,10 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import hoistNonReactStatics from "hoist-non-react-statics"; import React, { useContext, useMemo } from "react"; +import hoistNonReactStatics from "hoist-non-react-statics"; +import * as R from "ramda"; +import * as RA from "ramda-adjunct"; import { Controller, ControllerRenderProps, @@ -23,16 +25,16 @@ import { FieldValues, Validate, } from "react-hook-form"; -import * as R from "ramda"; -import * as RA from "ramda-adjunct"; + import { Skeleton } from "@mui/material"; -import { getComponentDisplayName } from "@/utils/reactUtils"; -import { FakeBlurEventHandler, FakeChangeEventHandler } from "@/utils/feUtils"; + +import FormContext from "@/components/common/Form/FormContext"; import { ControlPlus, RegisterOptionsPlus, } from "@/components/common/Form/types"; -import FormContext from "@/components/common/Form/FormContext"; +import { FakeBlurEventHandler, FakeChangeEventHandler } from "@/utils/feUtils"; +import { getComponentDisplayName } from "@/utils/reactUtils"; interface ReactHookFormSupport { defaultValue?: NonNullable | ((props: any) => NonNullable); diff --git a/webapp/src/hooks/useBlocker.ts b/webapp/src/hooks/useBlocker.ts index e4fce66307..acc7c6502e 100644 --- a/webapp/src/hooks/useBlocker.ts +++ b/webapp/src/hooks/useBlocker.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { History, Transition } from "history"; import { useContext, useEffect } from "react"; +import { History, Transition } from "history"; import { UNSAFE_NavigationContext as NavigationContext } from "react-router-dom"; + import useAutoUpdateRef from "./useAutoUpdateRef"; // * Workaround until it will be supported by react-router v6. diff --git a/webapp/src/hooks/useConfirm.ts b/webapp/src/hooks/useConfirm.ts index 4df7890c7f..83152058f8 100644 --- a/webapp/src/hooks/useConfirm.ts +++ b/webapp/src/hooks/useConfirm.ts @@ -13,6 +13,7 @@ */ import { useCallback, useRef, useState } from "react"; + import useAutoUpdateRef from "./useAutoUpdateRef"; function errorFunction() { diff --git a/webapp/src/hooks/useDebounce.ts b/webapp/src/hooks/useDebounce.ts index 231c4849a2..cfcce9425a 100644 --- a/webapp/src/hooks/useDebounce.ts +++ b/webapp/src/hooks/useDebounce.ts @@ -12,6 +12,7 @@ * This file is part of the Antares project. */ +import { useEffect, useMemo, useRef } from "react"; import { debounce, DebouncedFunc, @@ -21,7 +22,6 @@ import { } from "lodash"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; -import { useEffect, useMemo, useRef } from "react"; import { F } from "ts-toolbelt"; export interface UseDebounceParams extends DebounceSettings { diff --git a/webapp/src/hooks/useDebouncedEffect.ts b/webapp/src/hooks/useDebouncedEffect.ts index 90fdbdeb3d..a5684e6f2a 100644 --- a/webapp/src/hooks/useDebouncedEffect.ts +++ b/webapp/src/hooks/useDebouncedEffect.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ +import { useEffect } from "react"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; -import { useEffect } from "react"; + import useDebounce, { UseDebounceParams } from "./useDebounce"; export interface UseDebouncedEffectParams extends UseDebounceParams { diff --git a/webapp/src/hooks/useDebouncedState.ts b/webapp/src/hooks/useDebouncedState.ts index 470248a02d..697664e31d 100644 --- a/webapp/src/hooks/useDebouncedState.ts +++ b/webapp/src/hooks/useDebouncedState.ts @@ -12,12 +12,13 @@ * This file is part of the Antares project. */ +import { useState } from "react"; import { DebouncedFunc, DebouncedFuncLeading, DebounceSettingsLeading, } from "lodash"; -import { useState } from "react"; + import useDebounce, { UseDebounceParams } from "./useDebounce"; type WaitOrParams = number | UseDebounceParams; diff --git a/webapp/src/hooks/useEnqueueErrorSnackbar.tsx b/webapp/src/hooks/useEnqueueErrorSnackbar.tsx index 9d1b1ae332..71c4db464b 100644 --- a/webapp/src/hooks/useEnqueueErrorSnackbar.tsx +++ b/webapp/src/hooks/useEnqueueErrorSnackbar.tsx @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { ProviderContext, useSnackbar } from "notistack"; import { useCallback } from "react"; +import { ProviderContext, useSnackbar } from "notistack"; import { L } from "ts-toolbelt"; + import SnackErrorMessage from "@/components/common/SnackErrorMessage"; type EnqueueErrorType = ProviderContext["enqueueSnackbar"]; diff --git a/webapp/src/hooks/useNavigateOnCondition.ts b/webapp/src/hooks/useNavigateOnCondition.ts index 3608856916..c0d6c4f8ec 100644 --- a/webapp/src/hooks/useNavigateOnCondition.ts +++ b/webapp/src/hooks/useNavigateOnCondition.ts @@ -13,7 +13,7 @@ */ import { DependencyList } from "react"; -import { useNavigate, To } from "react-router-dom"; +import { To, useNavigate } from "react-router-dom"; import { useUpdateEffect } from "react-use"; interface UseNavigateOnConditionOptions { diff --git a/webapp/src/hooks/usePromise.ts b/webapp/src/hooks/usePromise.ts index 10b1ac55b6..745c01274a 100644 --- a/webapp/src/hooks/usePromise.ts +++ b/webapp/src/hooks/usePromise.ts @@ -14,6 +14,7 @@ import { useCallback, useEffect, useState } from "react"; import { usePromise as usePromiseWrapper } from "react-use"; + import { isDependencyList } from "@/utils/reactUtils"; export enum PromiseStatus { diff --git a/webapp/src/hooks/usePromiseWithSnackbarError.ts b/webapp/src/hooks/usePromiseWithSnackbarError.ts index 346d7568a6..f6117a737b 100644 --- a/webapp/src/hooks/usePromiseWithSnackbarError.ts +++ b/webapp/src/hooks/usePromiseWithSnackbarError.ts @@ -13,8 +13,9 @@ */ import { useEffect } from "react"; + import useEnqueueErrorSnackbar from "./useEnqueueErrorSnackbar"; -import usePromise, { UsePromiseResponse, UsePromiseParams } from "./usePromise"; +import usePromise, { UsePromiseParams, UsePromiseResponse } from "./usePromise"; export interface UsePromiseWithSnackbarErrorParams extends UsePromiseParams { errorMessage: string; diff --git a/webapp/src/i18n.ts b/webapp/src/i18n.ts index f2f144fe87..8592aa7eca 100644 --- a/webapp/src/i18n.ts +++ b/webapp/src/i18n.ts @@ -13,8 +13,8 @@ */ import i18n from "i18next"; -import Backend from "i18next-http-backend"; import LanguageDetector from "i18next-browser-languagedetector"; +import Backend from "i18next-http-backend"; import { initReactI18next } from "react-i18next"; i18n diff --git a/webapp/src/index.test.tsx b/webapp/src/index.test.tsx index e2c5ffa601..25523afe14 100644 --- a/webapp/src/index.test.tsx +++ b/webapp/src/index.test.tsx @@ -12,9 +12,11 @@ * This file is part of the Antares project. */ -import { render } from "@testing-library/react"; import { Provider } from "react-redux"; + import { StyledEngineProvider } from "@mui/material"; +import { render } from "@testing-library/react"; + import App from "./components/App"; import store from "./redux/store"; diff --git a/webapp/src/index.tsx b/webapp/src/index.tsx index 4a3d8d1d42..5dea3a07e8 100644 --- a/webapp/src/index.tsx +++ b/webapp/src/index.tsx @@ -14,12 +14,15 @@ import { createRoot } from "react-dom/client"; import { Provider } from "react-redux"; + import { StyledEngineProvider } from "@mui/material"; -import "./index.css"; + import App from "./components/App"; +import store from "./redux/store"; import { Config, initConfig } from "./services/config"; import storage, { StorageKey } from "./services/utils/localStorage"; -import store from "./redux/store"; + +import "./index.css"; initConfig((config: Config) => { const versionInstalled = storage.getItem(StorageKey.Version); diff --git a/webapp/src/redux/components/UseAsyncAppSelectorCond.tsx b/webapp/src/redux/components/UseAsyncAppSelectorCond.tsx index 9e62e3bddd..68720099e9 100644 --- a/webapp/src/redux/components/UseAsyncAppSelectorCond.tsx +++ b/webapp/src/redux/components/UseAsyncAppSelectorCond.tsx @@ -13,6 +13,7 @@ */ import * as R from "ramda"; + import { UseAsyncEntityStateResponse } from "../hooks/useAsyncAppSelector"; import { FetchStatus } from "../utils"; diff --git a/webapp/src/redux/ducks/auth.ts b/webapp/src/redux/ducks/auth.ts index 0612ea6b20..f617b70478 100644 --- a/webapp/src/redux/ducks/auth.ts +++ b/webapp/src/redux/ducks/auth.ts @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { createAsyncThunk, createReducer, isAnyOf } from "@reduxjs/toolkit"; import { jwtDecode, type JwtPayload } from "jwt-decode"; + +import { createAsyncThunk, createReducer, isAnyOf } from "@reduxjs/toolkit"; + import { UserInfo } from "@/common/types"; import * as authApi from "@/services/api/auth"; import * as clientApi from "@/services/api/client"; @@ -23,6 +25,7 @@ import { initWebSocket, reloadWebSocket, } from "@/services/webSockets"; + import { getAuthUser } from "../selectors"; import { AppAsyncThunkConfig } from "../store"; import { createThunk, makeActionName } from "../utils"; diff --git a/webapp/src/redux/ducks/groups.ts b/webapp/src/redux/ducks/groups.ts index 488720a486..066eb9252f 100644 --- a/webapp/src/redux/ducks/groups.ts +++ b/webapp/src/redux/ducks/groups.ts @@ -17,10 +17,12 @@ import { createEntityAdapter, createReducer, } from "@reduxjs/toolkit"; + import { GroupDetailsDTO } from "@/common/types"; -import { AsyncEntityState, FetchStatus, makeActionName } from "../utils"; import * as api from "@/services/api/user"; + import { AppAsyncThunkConfig } from "../store"; +import { AsyncEntityState, FetchStatus, makeActionName } from "../utils"; const groupsAdapter = createEntityAdapter(); diff --git a/webapp/src/redux/ducks/index.ts b/webapp/src/redux/ducks/index.ts index 7fe58f0a35..0aa2d34ca4 100644 --- a/webapp/src/redux/ducks/index.ts +++ b/webapp/src/redux/ducks/index.ts @@ -14,13 +14,14 @@ import { Action, combineReducers } from "redux"; import { L } from "ts-toolbelt"; -import studies from "./studies"; -import users from "./users"; -import groups from "./groups"; + import auth, { logout } from "./auth"; -import ui from "./ui"; -import studySyntheses from "./studySyntheses"; +import groups from "./groups"; +import studies from "./studies"; import studyMaps from "./studyMaps"; +import studySyntheses from "./studySyntheses"; +import ui from "./ui"; +import users from "./users"; const appReducer = combineReducers({ studies, diff --git a/webapp/src/redux/ducks/studies.ts b/webapp/src/redux/ducks/studies.ts index db4e98e445..735e795251 100644 --- a/webapp/src/redux/ducks/studies.ts +++ b/webapp/src/redux/ducks/studies.ts @@ -12,14 +12,16 @@ * This file is part of the Antares project. */ +import * as R from "ramda"; +import { O } from "ts-toolbelt"; + import { createAction, createAsyncThunk, createEntityAdapter, createReducer, } from "@reduxjs/toolkit"; -import * as R from "ramda"; -import { O } from "ts-toolbelt"; + import { GroupDTO, StudyMetadata, @@ -29,14 +31,16 @@ import { WSMessage, } from "@/common/types"; import * as api from "@/services/api/study"; + import { getFavoriteStudyIds, getStudyVersions } from "../selectors"; import { AppAsyncThunkConfig, AppThunk } from "../store"; import { - makeActionName, - FetchStatus, AsyncEntityState, createThunk, + FetchStatus, + makeActionName, } from "../utils"; + import { setDefaultAreaLinkSelection } from "./studySyntheses"; const studiesAdapter = createEntityAdapter(); diff --git a/webapp/src/redux/ducks/studyMaps.ts b/webapp/src/redux/ducks/studyMaps.ts index c8f5f38b33..c8e8aaca33 100644 --- a/webapp/src/redux/ducks/studyMaps.ts +++ b/webapp/src/redux/ducks/studyMaps.ts @@ -12,6 +12,8 @@ * This file is part of the Antares project. */ +import * as R from "ramda"; + import { createAction, createAsyncThunk, @@ -19,7 +21,7 @@ import { createReducer, EntityState, } from "@reduxjs/toolkit"; -import * as R from "ramda"; + import { Area, AreaLayerColor, @@ -29,16 +31,14 @@ import { StudyMetadata, UpdateAreaUi, } from "@/common/types"; - -import { AppAsyncThunkConfig, AppDispatch } from "../store"; -import { makeActionName, makeLinkId, parseLinkId } from "../utils"; -import * as studyApi from "@/services/api/study"; import { getNodeWidth, NODE_COLOR, NODE_HEIGHT, } from "@/components/App/Singlestudy/explore/Modelization/Map/utils"; -import { AppState } from "."; +import * as studyApi from "@/services/api/study"; +import * as studyDataApi from "@/services/api/studydata"; + import { getArea, getCurrentLayer, @@ -46,12 +46,15 @@ import { getStudyMapLayersById, getStudySynthesis, } from "../selectors"; -import * as studyDataApi from "@/services/api/studydata"; +import { AppAsyncThunkConfig, AppDispatch } from "../store"; +import { makeActionName, makeLinkId, parseLinkId } from "../utils"; + import { createStudyLink, deleteStudyLink, setCurrentArea, } from "./studySyntheses"; +import { AppState } from "."; export interface StudyMapNode { id: string; diff --git a/webapp/src/redux/ducks/studySyntheses.ts b/webapp/src/redux/ducks/studySyntheses.ts index ad0cb1d30c..ae73f30486 100644 --- a/webapp/src/redux/ducks/studySyntheses.ts +++ b/webapp/src/redux/ducks/studySyntheses.ts @@ -12,13 +12,15 @@ * This file is part of the Antares project. */ +import * as RA from "ramda-adjunct"; + import { createAction, createAsyncThunk, createEntityAdapter, createReducer, } from "@reduxjs/toolkit"; -import * as RA from "ramda-adjunct"; + import { FileStudyTreeConfigDTO, GenericInfo, @@ -28,6 +30,7 @@ import { WSMessage, } from "@/common/types"; import * as api from "@/services/api/study"; + import { getStudyMapsIds, getStudySynthesis, @@ -35,6 +38,7 @@ import { } from "../selectors"; import { AppAsyncThunkConfig, AppDispatch, AppThunk } from "../store"; import { makeActionName } from "../utils"; + import { setStudyMap } from "./studyMaps"; export const studySynthesesAdapter = diff --git a/webapp/src/redux/ducks/ui.ts b/webapp/src/redux/ducks/ui.ts index 18d4886b55..03be0cfac3 100644 --- a/webapp/src/redux/ducks/ui.ts +++ b/webapp/src/redux/ducks/ui.ts @@ -13,6 +13,7 @@ */ import { createAction, createReducer } from "@reduxjs/toolkit"; + import { makeActionName } from "../utils"; export interface UIState { diff --git a/webapp/src/redux/ducks/users.ts b/webapp/src/redux/ducks/users.ts index 17b79f0712..89d8f462f3 100644 --- a/webapp/src/redux/ducks/users.ts +++ b/webapp/src/redux/ducks/users.ts @@ -17,10 +17,12 @@ import { createEntityAdapter, createReducer, } from "@reduxjs/toolkit"; + import { UserDetailsDTO } from "@/common/types"; -import { AsyncEntityState, FetchStatus, makeActionName } from "../utils"; import * as api from "@/services/api/user"; + import { AppAsyncThunkConfig } from "../store"; +import { AsyncEntityState, FetchStatus, makeActionName } from "../utils"; const usersAdapter = createEntityAdapter(); diff --git a/webapp/src/redux/hooks/useAppDispatch.ts b/webapp/src/redux/hooks/useAppDispatch.ts index 62c5305391..0d606cd0d7 100644 --- a/webapp/src/redux/hooks/useAppDispatch.ts +++ b/webapp/src/redux/hooks/useAppDispatch.ts @@ -13,6 +13,7 @@ */ import { useDispatch } from "react-redux"; + import { AppDispatch } from "../store"; const useAppDispatch = () => useDispatch(); diff --git a/webapp/src/redux/hooks/useAppSelector.ts b/webapp/src/redux/hooks/useAppSelector.ts index 54a95cf219..386ebed408 100644 --- a/webapp/src/redux/hooks/useAppSelector.ts +++ b/webapp/src/redux/hooks/useAppSelector.ts @@ -13,6 +13,7 @@ */ import { TypedUseSelectorHook, useSelector } from "react-redux"; + import { AppState } from "../ducks"; const useAppSelector: TypedUseSelectorHook = useSelector; diff --git a/webapp/src/redux/hooks/useAsyncAppSelector.ts b/webapp/src/redux/hooks/useAsyncAppSelector.ts index 2d01ab895a..01fbc65fb9 100644 --- a/webapp/src/redux/hooks/useAsyncAppSelector.ts +++ b/webapp/src/redux/hooks/useAsyncAppSelector.ts @@ -12,11 +12,14 @@ * This file is part of the Antares project. */ -import { AsyncThunk } from "@reduxjs/toolkit"; import { useEffect } from "react"; + +import { AsyncThunk } from "@reduxjs/toolkit"; + import { AppState } from "../ducks"; import { AppAsyncThunkConfig } from "../store"; import { AsyncEntityState, FetchStatus } from "../utils"; + import useAppDispatch from "./useAppDispatch"; import useAppSelector from "./useAppSelector"; diff --git a/webapp/src/redux/hooks/useStudyMaps.ts b/webapp/src/redux/hooks/useStudyMaps.ts index da95d71af1..4925d2666a 100644 --- a/webapp/src/redux/hooks/useStudyMaps.ts +++ b/webapp/src/redux/hooks/useStudyMaps.ts @@ -13,19 +13,22 @@ */ import { useState } from "react"; + import { StudyMetadata } from "@/common/types"; +import { Response } from "@/components/common/utils/UsePromiseCond"; +import usePromise, { PromiseStatus } from "@/hooks/usePromise"; + import { AppState } from "../ducks"; -import useAppDispatch from "./useAppDispatch"; -import useAppSelector from "./useAppSelector"; -import { getStudyMap } from "../selectors"; import { createStudyMap, - fetchStudyMapLayers, fetchStudyMapDistricts, + fetchStudyMapLayers, } from "../ducks/studyMaps"; +import { getStudyMap } from "../selectors"; + +import useAppDispatch from "./useAppDispatch"; +import useAppSelector from "./useAppSelector"; import useStudySynthesis from "./useStudySynthesis"; -import { Response } from "@/components/common/utils/UsePromiseCond"; -import usePromise, { PromiseStatus } from "@/hooks/usePromise"; interface Props { studyId: StudyMetadata["id"]; diff --git a/webapp/src/redux/hooks/useStudySynthesis.ts b/webapp/src/redux/hooks/useStudySynthesis.ts index 5062aef841..30c806406a 100644 --- a/webapp/src/redux/hooks/useStudySynthesis.ts +++ b/webapp/src/redux/hooks/useStudySynthesis.ts @@ -14,14 +14,17 @@ import { useState } from "react"; import { useAsync } from "react-use"; + import { StudyMetadata } from "@/common/types"; +import { Response } from "@/components/common/utils/UsePromiseCond"; +import { PromiseStatus } from "@/hooks/usePromise"; + import { AppState } from "../ducks"; import { createStudySynthesis } from "../ducks/studySyntheses"; +import { getStudySynthesis } from "../selectors"; + import useAppDispatch from "./useAppDispatch"; import useAppSelector from "./useAppSelector"; -import { getStudySynthesis } from "../selectors"; -import { PromiseStatus } from "@/hooks/usePromise"; -import { Response } from "@/components/common/utils/UsePromiseCond"; export interface UseStudySynthesisProps { studyId: StudyMetadata["id"]; diff --git a/webapp/src/redux/middlewares/localStorageMiddleware.ts b/webapp/src/redux/middlewares/localStorageMiddleware.ts index 475a46d303..23b4cee8d0 100644 --- a/webapp/src/redux/middlewares/localStorageMiddleware.ts +++ b/webapp/src/redux/middlewares/localStorageMiddleware.ts @@ -13,13 +13,15 @@ */ import { createListenerMiddleware, isAnyOf } from "@reduxjs/toolkit"; + import { UserInfo } from "@/common/types"; import storage, { StorageKey } from "@/services/utils/localStorage"; + import { AppState } from "../ducks"; -import { login, refresh, logout } from "../ducks/auth"; +import { login, logout, refresh } from "../ducks/auth"; import { - updateStudiesFromLocalStorage, setFavoriteStudies, + updateStudiesFromLocalStorage, updateStudiesSortConf, } from "../ducks/studies"; import { setMenuCollapse } from "../ducks/ui"; diff --git a/webapp/src/redux/selectors.ts b/webapp/src/redux/selectors.ts index b63b68dcd5..a262bc5f16 100644 --- a/webapp/src/redux/selectors.ts +++ b/webapp/src/redux/selectors.ts @@ -12,8 +12,10 @@ * This file is part of the Antares project. */ -import { createEntityAdapter, createSelector } from "@reduxjs/toolkit"; import { last } from "ramda"; + +import { createEntityAdapter, createSelector } from "@reduxjs/toolkit"; + import { AllClustersAndLinks, Area, @@ -24,24 +26,25 @@ import { UserDetailsDTO, } from "@/common/types"; import { buildStudyTree } from "@/components/App/Studies/utils"; -import { filterStudies, sortStudies } from "@/utils/studiesUtils"; import { convertVersions, isGroupAdmin, isUserAdmin } from "@/services/utils"; -import { AppState } from "./ducks"; +import { filterStudies, sortStudies } from "@/utils/studiesUtils"; + import { AuthState } from "./ducks/auth"; import { GroupsState } from "./ducks/groups"; import { StudiesSortConf, StudiesState, StudyFilters } from "./ducks/studies"; +import { + StudyMapLink, + StudyMapNode, + studyMapsAdapter, + StudyMapsState, +} from "./ducks/studyMaps"; import { studySynthesesAdapter, StudySynthesesState, } from "./ducks/studySyntheses"; import { UIState } from "./ducks/ui"; import { UsersState } from "./ducks/users"; -import { - StudyMapNode, - StudyMapLink, - studyMapsAdapter, - StudyMapsState, -} from "./ducks/studyMaps"; +import { AppState } from "./ducks"; import { makeLinkId } from "./utils"; // TODO resultEqualityCheck diff --git a/webapp/src/redux/store.ts b/webapp/src/redux/store.ts index 35c9296570..609c0e9f6b 100644 --- a/webapp/src/redux/store.ts +++ b/webapp/src/redux/store.ts @@ -12,11 +12,13 @@ * This file is part of the Antares project. */ -import { configureStore } from "@reduxjs/toolkit"; -import { ThunkAction } from "redux-thunk"; import { AnyAction } from "redux"; -import rootReducer, { AppState } from "./ducks"; +import { ThunkAction } from "redux-thunk"; + +import { configureStore } from "@reduxjs/toolkit"; + import localStorageMiddleware from "./middlewares/localStorageMiddleware"; +import rootReducer, { AppState } from "./ducks"; const store = configureStore({ reducer: rootReducer, diff --git a/webapp/src/redux/utils.ts b/webapp/src/redux/utils.ts index 64919bda47..f1ea2d851b 100644 --- a/webapp/src/redux/utils.ts +++ b/webapp/src/redux/utils.ts @@ -12,16 +12,19 @@ * This file is part of the Antares project. */ +import * as R from "ramda"; + import { - createAction, ActionCreatorWithPayload, + createAction, EntityState, } from "@reduxjs/toolkit"; -import * as R from "ramda"; + +import { APP_NAME } from "@/common/contants"; +import { LinkElement } from "@/common/types"; + import { AppState } from "./ducks"; import { AppDispatch, AppThunk } from "./store"; -import { LinkElement } from "@/common/types"; -import { APP_NAME } from "@/common/contants"; export enum FetchStatus { Idle = "idle", diff --git a/webapp/src/services/api/auth.ts b/webapp/src/services/api/auth.ts index f74ee624cb..37fdc59e9d 100644 --- a/webapp/src/services/api/auth.ts +++ b/webapp/src/services/api/auth.ts @@ -13,10 +13,13 @@ */ import axios from "axios"; -import client from "./client"; + import { RefreshDTO as UserTokensDTO } from "@/common/types"; + import { Config } from "../config"; +import client from "./client"; + // instance sans crédentials et hooks pour l'authent const rawAxiosInstance = axios.create(); diff --git a/webapp/src/services/api/client.ts b/webapp/src/services/api/client.ts index b6f9a1de27..e48cdb711d 100644 --- a/webapp/src/services/api/client.ts +++ b/webapp/src/services/api/client.ts @@ -16,9 +16,11 @@ import axios from "axios"; import debug from "debug"; import Cookies from "js-cookie"; import * as R from "ramda"; -import { Config } from "../config"; -import store from "@/redux/store"; + import { logout, refresh } from "@/redux/ducks/auth"; +import store from "@/redux/store"; + +import { Config } from "../config"; const logError = debug("antares:client:error"); const logInfo = debug("antares:client:info"); diff --git a/webapp/src/services/api/downloads.ts b/webapp/src/services/api/downloads.ts index 452df236a0..2329617872 100644 --- a/webapp/src/services/api/downloads.ts +++ b/webapp/src/services/api/downloads.ts @@ -13,6 +13,7 @@ */ import { getConfig } from "../config"; + import client from "./client"; export interface FileDownloadDTO { diff --git a/webapp/src/services/api/matrix.ts b/webapp/src/services/api/matrix.ts index 61c444a33d..9bcc18e599 100644 --- a/webapp/src/services/api/matrix.ts +++ b/webapp/src/services/api/matrix.ts @@ -13,19 +13,22 @@ */ import { AxiosRequestConfig } from "axios"; -import client from "./client"; + import { - MatrixDTO, MatrixDataSetDTO, - MatrixInfoDTO, MatrixDataSetUpdateDTO, - MatrixIndex, + MatrixDTO, MatrixEditDTO, + MatrixIndex, + MatrixInfoDTO, } from "@/common/types"; -import { FileDownloadTask } from "./downloads"; -import { getConfig } from "../config"; import { MatrixUpdateDTO } from "@/components/common/Matrix/shared/types"; +import { getConfig } from "../config"; + +import client from "./client"; +import { FileDownloadTask } from "./downloads"; + export const getMatrixList = async ( name = "", filterOwn = false, diff --git a/webapp/src/services/api/studies/config/thematicTrimming/index.ts b/webapp/src/services/api/studies/config/thematicTrimming/index.ts index fed05340e5..450af22a22 100644 --- a/webapp/src/services/api/studies/config/thematicTrimming/index.ts +++ b/webapp/src/services/api/studies/config/thematicTrimming/index.ts @@ -13,12 +13,13 @@ */ import client from "@/services/api/client"; +import { format } from "@/utils/stringUtils"; + import type { GetThematicTrimmingConfigParams, SetThematicTrimmingConfigParams, ThematicTrimmingConfig, } from "./types"; -import { format } from "@/utils/stringUtils"; const URL = "/v1/studies/{studyId}/config/thematictrimming/form"; diff --git a/webapp/src/services/api/studies/raw/index.ts b/webapp/src/services/api/studies/raw/index.ts index 832e0ca53b..2eb3b0432c 100644 --- a/webapp/src/services/api/studies/raw/index.ts +++ b/webapp/src/services/api/studies/raw/index.ts @@ -13,6 +13,7 @@ */ import client from "@/services/api/client"; + import type { DeleteFileParams, DownloadMatrixParams, diff --git a/webapp/src/services/api/studies/raw/types.ts b/webapp/src/services/api/studies/raw/types.ts index 22535ea51b..b363653467 100644 --- a/webapp/src/services/api/studies/raw/types.ts +++ b/webapp/src/services/api/studies/raw/types.ts @@ -13,6 +13,7 @@ */ import type { AxiosRequestConfig } from "axios"; + import type { StudyMetadata } from "@/common/types"; export interface DownloadMatrixParams { diff --git a/webapp/src/services/api/studies/tableMode/index.ts b/webapp/src/services/api/studies/tableMode/index.ts index 2014232b72..44bc4565c0 100644 --- a/webapp/src/services/api/studies/tableMode/index.ts +++ b/webapp/src/services/api/studies/tableMode/index.ts @@ -14,6 +14,7 @@ import client from "@/services/api/client"; import { format } from "@/utils/stringUtils"; + import type { GetTableModeParams, SetTableModeParams, diff --git a/webapp/src/services/api/studies/tableMode/types.ts b/webapp/src/services/api/studies/tableMode/types.ts index d2615d25a9..af021ae556 100644 --- a/webapp/src/services/api/studies/tableMode/types.ts +++ b/webapp/src/services/api/studies/tableMode/types.ts @@ -13,7 +13,9 @@ */ import { DeepPartial } from "react-hook-form"; + import type { StudyMetadata } from "@/common/types"; + import { TABLE_MODE_COLUMNS_BY_TYPE, TABLE_MODE_TYPES } from "./constants"; export type TableModeType = (typeof TABLE_MODE_TYPES)[number]; diff --git a/webapp/src/services/api/study.ts b/webapp/src/services/api/study.ts index 67c54679db..80cfcb94b3 100644 --- a/webapp/src/services/api/study.ts +++ b/webapp/src/services/api/study.ts @@ -14,26 +14,29 @@ import { AxiosRequestConfig } from "axios"; import { isBoolean, trimCharsStart } from "ramda-adjunct"; -import client from "./client"; + import { + AreasConfig, FileStudyTreeConfigDTO, LaunchJob, + LaunchJobDTO, + LaunchOptions, MatrixAggregationResult, - StudyOutputDownloadDTO, + StudyLayer, StudyMetadata, StudyMetadataDTO, + StudyMetadataPatchDTO, StudyOutput, + StudyOutputDownloadDTO, StudyPublicMode, - AreasConfig, - LaunchJobDTO, - StudyMetadataPatchDTO, - LaunchOptions, - StudyLayer, } from "@/common/types"; +import { StudyMapDistrict } from "@/redux/ducks/studyMaps"; + import { getConfig } from "../config"; import { convertStudyDtoToMetadata } from "../utils"; + +import client from "./client"; import { FileDownloadTask } from "./downloads"; -import { StudyMapDistrict } from "@/redux/ducks/studyMaps"; const getStudiesRaw = async (): Promise> => { const res = await client.get(`/v1/studies`); diff --git a/webapp/src/services/api/studydata.ts b/webapp/src/services/api/studydata.ts index 79e1acadb8..cd63d9e07e 100644 --- a/webapp/src/services/api/studydata.ts +++ b/webapp/src/services/api/studydata.ts @@ -19,10 +19,11 @@ import { } from "@/common/types"; import { BindingConstraint, - ConstraintTerm, bindingConstraintModelAdapter, + ConstraintTerm, } from "@/components/App/Singlestudy/explore/Modelization/BindingConstraints/BindingConstView/utils"; import { StudyMapNode } from "@/redux/ducks/studyMaps"; + import client from "./client"; export const createArea = async ( diff --git a/webapp/src/services/api/tasks.ts b/webapp/src/services/api/tasks.ts index c701744954..a81f6fa29b 100644 --- a/webapp/src/services/api/tasks.ts +++ b/webapp/src/services/api/tasks.ts @@ -13,6 +13,7 @@ */ import { TaskDTO, TaskStatus } from "@/common/types"; + import client from "./client"; export const getStudyRunningTasks = async (sid: string): Promise => { diff --git a/webapp/src/services/api/user.ts b/webapp/src/services/api/user.ts index 5bef37c7aa..b2476c66aa 100644 --- a/webapp/src/services/api/user.ts +++ b/webapp/src/services/api/user.ts @@ -13,20 +13,22 @@ */ import * as RA from "ramda-adjunct"; -import client from "./client"; + import { - UserDTO, - GroupDTO, - RoleCreationDTO, - UserToken, - GroupDetailsDTO, BotCreateDTO, BotDetailsDTO, BotDTO, + GroupDetailsDTO, + GroupDTO, + RoleCreationDTO, RoleDetailsDTO, UserDetailsDTO, + UserDTO, + UserToken, } from "@/common/types"; +import client from "./client"; + //////////////////////////////////////////////////////////////// // Users //////////////////////////////////////////////////////////////// diff --git a/webapp/src/services/api/variant.ts b/webapp/src/services/api/variant.ts index 20d389103b..9921d2189e 100644 --- a/webapp/src/services/api/variant.ts +++ b/webapp/src/services/api/variant.ts @@ -12,7 +12,6 @@ * This file is part of the Antares project. */ -import client from "./client"; import { CommandDTO, FileStudyTreeConfigDTO, @@ -21,7 +20,10 @@ import { TaskDTO, VariantTree, } from "@/common/types"; + import { convertStudyDtoToMetadata, convertVariantTreeDTO } from "../utils"; + +import client from "./client"; import { FileDownloadTask } from "./downloads"; export const getVariantChildren = async (id: string): Promise => { diff --git a/webapp/src/services/api/xpansion.ts b/webapp/src/services/api/xpansion.ts index 30e2b3ff57..0a4ed670e0 100644 --- a/webapp/src/services/api/xpansion.ts +++ b/webapp/src/services/api/xpansion.ts @@ -13,11 +13,13 @@ */ import { AxiosRequestConfig } from "axios"; + import { MatrixType } from "@/common/types"; import { XpansionCandidate, XpansionSettings, } from "@/components/App/Singlestudy/explore/Xpansion/types"; + import client from "./client"; export const createXpansionConfiguration = async ( diff --git a/webapp/src/services/config.ts b/webapp/src/services/config.ts index 2eed7bff46..7c7f923eec 100644 --- a/webapp/src/services/config.ts +++ b/webapp/src/services/config.ts @@ -12,11 +12,12 @@ * This file is part of the Antares project. */ -import debug from "debug"; import axios from "axios"; +import debug from "debug"; import moment from "moment"; -import { initAxiosClient } from "./api/client"; + import { initRawAxiosClient } from "./api/auth"; +import { initAxiosClient } from "./api/client"; import { APIVersion, getVersion } from "./api/misc"; const info = debug("antares:config:info"); diff --git a/webapp/src/services/utils/index.ts b/webapp/src/services/utils/index.ts index f73adca639..9991cba4f8 100644 --- a/webapp/src/services/utils/index.ts +++ b/webapp/src/services/utils/index.ts @@ -12,20 +12,22 @@ * This file is part of the Antares project. */ -import moment from "moment"; import debug from "debug"; import i18n, { TFunction } from "i18next"; +import moment from "moment"; import * as R from "ramda"; + import { - StudyMetadataDTO, - StudyMetadata, + GenericInfo, JWTGroup, - UserInfo, RoleType, - VariantTreeDTO, + StudyMetadata, + StudyMetadataDTO, + UserInfo, VariantTree, - GenericInfo, + VariantTreeDTO, } from "@/common/types"; + import { getMaintenanceMode, getMessageInfo } from "../api/maintenance"; import { getConfig } from "../config"; diff --git a/webapp/src/services/utils/localStorage.ts b/webapp/src/services/utils/localStorage.ts index 14f44d1ba3..0c97a73325 100644 --- a/webapp/src/services/utils/localStorage.ts +++ b/webapp/src/services/utils/localStorage.ts @@ -13,12 +13,14 @@ */ import * as RA from "ramda-adjunct"; + +import { APP_NAME } from "@/common/contants"; import { UserInfo } from "@/common/types"; import { TableTemplate } from "@/components/App/Singlestudy/explore/TableModeList/utils"; import { StudiesSortConf, StudiesState } from "@/redux/ducks/studies"; import { UIState } from "@/redux/ducks/ui"; + import { TABLE_MODE_TYPES_ALIASES } from "../api/studies/tableMode/constants"; -import { APP_NAME } from "@/common/contants"; export const StorageKey = { Version: "version", diff --git a/webapp/src/services/webSockets.ts b/webapp/src/services/webSockets.ts index 39191aec51..bfe27a50b3 100644 --- a/webapp/src/services/webSockets.ts +++ b/webapp/src/services/webSockets.ts @@ -14,6 +14,7 @@ import debug from "debug"; import * as RA from "ramda-adjunct"; + import { GenericInfo, LaunchJobDTO, @@ -22,17 +23,18 @@ import { WSEvent, WSMessage, } from "@/common/types"; -import { getConfig } from "./config"; -import { isStringEmpty, isUserExpired } from "./utils"; -import { AppDispatch } from "@/redux/store"; import { refresh as refreshUser } from "@/redux/ducks/auth"; import { deleteStudy, setStudy } from "@/redux/ducks/studies"; +import { refreshStudySynthesis } from "@/redux/ducks/studySyntheses"; import { setMaintenanceMode, setMessageInfo, setWebSocketConnected, } from "@/redux/ducks/ui"; -import { refreshStudySynthesis } from "@/redux/ducks/studySyntheses"; +import { AppDispatch } from "@/redux/store"; + +import { getConfig } from "./config"; +import { isStringEmpty, isUserExpired } from "./utils"; const logInfo = debug("antares:websocket:info"); const logError = debug("antares:websocket:error"); diff --git a/webapp/src/tests/setup.ts b/webapp/src/tests/setup.ts index 5512f0a058..276b7ca66a 100644 --- a/webapp/src/tests/setup.ts +++ b/webapp/src/tests/setup.ts @@ -12,10 +12,12 @@ * This file is part of the Antares project. */ -import "@testing-library/jest-dom/vitest"; -import { expect, afterEach } from "vitest"; -import { cleanup } from "@testing-library/react"; +import { afterEach, expect } from "vitest"; + import * as matchers from "@testing-library/jest-dom/matchers"; +import { cleanup } from "@testing-library/react"; + +import "@testing-library/jest-dom/vitest"; import "./mocks/mockResizeObserver"; // Extend Vitest's expect function with jest-dom matchers for enhanced DOM assertions. diff --git a/webapp/src/theme.ts b/webapp/src/theme.ts index 6776e32e6e..152a50bd5d 100644 --- a/webapp/src/theme.ts +++ b/webapp/src/theme.ts @@ -13,6 +13,7 @@ */ import * as React from "react"; + import { createTheme } from "@mui/material/styles"; export const DRAWER_WIDTH = 60; diff --git a/webapp/src/utils/studiesUtils.ts b/webapp/src/utils/studiesUtils.ts index 1b6af5c03a..5826def230 100644 --- a/webapp/src/utils/studiesUtils.ts +++ b/webapp/src/utils/studiesUtils.ts @@ -15,8 +15,10 @@ import moment from "moment"; import * as R from "ramda"; import * as RA from "ramda-adjunct"; + import { StudyMetadata, StudyType } from "@/common/types"; import { StudiesSortConf, StudyFilters } from "@/redux/ducks/studies"; + import { isSearchMatching } from "./stringUtils"; //////////////////////////////////////////////////////////////// diff --git a/webapp/src/utils/validation/array.ts b/webapp/src/utils/validation/array.ts index d0edd43a15..051eaee53d 100644 --- a/webapp/src/utils/validation/array.ts +++ b/webapp/src/utils/validation/array.ts @@ -12,10 +12,11 @@ * This file is part of the Antares project. */ -import { ValidationReturn } from "@/common/types"; import { t } from "i18next"; import * as R from "ramda"; +import { ValidationReturn } from "@/common/types"; + interface ArrayValidationOptions { allowEmpty?: boolean; allowDuplicate?: boolean; diff --git a/webapp/src/utils/validation/number.ts b/webapp/src/utils/validation/number.ts index fd96c1502e..a027ea8fc3 100644 --- a/webapp/src/utils/validation/number.ts +++ b/webapp/src/utils/validation/number.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { ValidationReturn } from "@/common/types"; import { t } from "i18next"; +import { ValidationReturn } from "@/common/types"; + interface NumberValidationOptions { min?: number; max?: number; diff --git a/webapp/src/utils/validation/string.ts b/webapp/src/utils/validation/string.ts index bd9bdef1e8..d083c7800c 100644 --- a/webapp/src/utils/validation/string.ts +++ b/webapp/src/utils/validation/string.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ -import { ValidationReturn } from "@/common/types"; import { t } from "i18next"; +import { ValidationReturn } from "@/common/types"; + interface StringValidationOptions { existingValues?: string[]; excludedValues?: string[]; diff --git a/webapp/vite.config.ts b/webapp/vite.config.ts index ba4fe1e0f4..22fb176d2e 100644 --- a/webapp/vite.config.ts +++ b/webapp/vite.config.ts @@ -12,9 +12,10 @@ * This file is part of the Antares project. */ +import path from "path"; import { defineConfig } from "vite"; + import react from "@vitejs/plugin-react-swc"; -import path from "path"; const SERVER_URL = "http://localhost:8080";