Skip to content

Commit

Permalink
refactor(ui-imports): migrate to absolute imports from src directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia committed Nov 4, 2024
1 parent 3c590c5 commit d0337e6
Show file tree
Hide file tree
Showing 302 changed files with 1,321 additions and 1,468 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
* This file is part of the Antares project.
*/

import * as RA from "ramda-adjunct";
import { RoleType } from "../../../common/types";
import { RoleType } from "./types";

export const APP_NAME = "antares-web";
export const RESERVED_USER_NAMES = ["admin"];
export const RESERVED_GROUP_NAMES = ["admin"];

export const ROLE_TYPE_KEYS = Object.values(RoleType).filter(
RA.isString,
) as Array<keyof typeof RoleType>;
(value): value is keyof typeof RoleType => typeof value === "string",
);
2 changes: 1 addition & 1 deletion webapp/src/components/App/Api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import { Box } from "@mui/material";
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
import { getConfig } from "../../services/config";
import { getConfig } from "@/services/config";

function Api() {
return (
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/App/Data/DataListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Typography, Box, styled } from "@mui/material";
import AutoSizer from "react-virtualized-auto-sizer";
import { FixedSizeList, areEqual, ListChildComponentProps } from "react-window";
import ArrowRightIcon from "@mui/icons-material/ArrowRight";
import { MatrixDataSetDTO } from "../../../common/types";
import { MatrixDataSetDTO } from "@/common/types";

const ROW_ITEM_SIZE = 45;
const BUTTONS_SIZE = 40;
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/App/Data/DataPropsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/

import { useState } from "react";
import { MatrixDataSetDTO, MatrixInfoDTO } from "../../../common/types";
import PropertiesView from "../../common/PropertiesView";
import { MatrixDataSetDTO, MatrixInfoDTO } from "@/common/types";
import DataListing from "./DataListing";
import { StyledListingBox } from "./styles";
import PropertiesView from "@/components/common/PropertiesView";

interface PropTypes {
dataset: MatrixDataSetDTO[];
Expand All @@ -39,7 +39,7 @@ function DataPropsView(props: PropTypes) {
);
};

const onChange = async (currentName: string) => {
const onChange = (currentName: string) => {
if (currentName !== "") {
const f = filter(currentName);
setFilteredDatas(f);
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/components/App/Data/DatasetCreationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import { useSnackbar } from "notistack";
import { useTranslation } from "react-i18next";
import axios, { AxiosError } from "axios";
import HelpIcon from "@mui/icons-material/Help";
import { getGroups } from "../../../services/api/user";
import { GroupDTO, MatrixDataSetDTO } from "../../../common/types";
import { getGroups } from "@/services/api/user";
import { GroupDTO, MatrixDataSetDTO } from "@/common/types";
import { saveMatrix } from "./utils";
import useEnqueueErrorSnackbar from "../../../hooks/useEnqueueErrorSnackbar";
import SimpleLoader from "../../common/loaders/SimpleLoader";
import BasicDialog from "../../common/dialogs/BasicDialog";
import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar";
import { BoxParamHeader, BoxParam, ParamTitle } from "./styles";
import BasicDialog from "@/components/common/dialogs/BasicDialog";
import SimpleLoader from "@/components/common/loaders/SimpleLoader";

interface PropTypes {
open: boolean;
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/components/App/Data/MatrixDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import { useState, useEffect } from "react";
import { AxiosError } from "axios";
import { useTranslation } from "react-i18next";
import { MatrixInfoDTO, MatrixType } from "../../../common/types";
import { getMatrix } from "../../../services/api/matrix";
import useEnqueueErrorSnackbar from "../../../hooks/useEnqueueErrorSnackbar";
import DataViewerDialog from "../../common/dialogs/DataViewerDialog";
import { MatrixInfoDTO, MatrixType } from "@/common/types";
import { getMatrix } from "@/services/api/matrix";
import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar";
import DataViewerDialog from "@/components/common/dialogs/DataViewerDialog";

interface PropTypes {
matrixInfo: MatrixInfoDTO;
Expand Down
20 changes: 10 additions & 10 deletions webapp/src/components/App/Data/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ import {
exportMatrixDataset,
getMatrixList,
getExportMatrixUrl,
} from "../../../services/api/matrix";
import { MatrixInfoDTO, MatrixDataSetDTO } from "../../../common/types";
} from "@/services/api/matrix";
import { MatrixInfoDTO, MatrixDataSetDTO } from "@/common/types";
import DatasetCreationDialog from "./DatasetCreationDialog";
import ConfirmationDialog from "../../common/dialogs/ConfirmationDialog";
import RootPage from "../../common/page/RootPage";
import MatrixDialog from "./MatrixDialog";
import useEnqueueErrorSnackbar from "../../../hooks/useEnqueueErrorSnackbar";
import SimpleLoader from "../../common/loaders/SimpleLoader";
import FileTable from "../../common/FileTable";
import { getAuthUser } from "../../../redux/selectors";
import useAppSelector from "../../../redux/hooks/useAppSelector";
import SplitView from "../../common/SplitView";
import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar";
import { getAuthUser } from "@/redux/selectors";
import useAppSelector from "@/redux/hooks/useAppSelector";
import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog";
import FileTable from "@/components/common/FileTable";
import SimpleLoader from "@/components/common/loaders/SimpleLoader";
import RootPage from "@/components/common/page/RootPage";
import SplitView from "@/components/common/SplitView";

function Data() {
const [t] = useTranslation();
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/App/Data/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {
MatrixDataSetDTO,
MatrixDataSetUpdateDTO,
MatrixInfoDTO,
} from "../../../common/types";
} from "@/common/types";
import {
createMatrixByImportation,
updateDataSet,
createDataSet,
} from "../../../services/api/matrix";
} from "@/services/api/matrix";

const updateMatrix = async (
data: MatrixDataSetDTO,
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/components/App/Settings/Groups/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { Box, Button } from "@mui/material";
import GroupAddIcon from "@mui/icons-material/GroupAdd";
import { useTranslation } from "react-i18next";
import { useState } from "react";
import { GroupDetailsDTO } from "../../../../common/types";
import { GroupDetailsDTO } from "@/common/types";
import CreateGroupDialog from "./dialog/CreateGroupDialog";
import { isAuthUserAdmin } from "../../../../redux/selectors";
import useAppSelector from "../../../../redux/hooks/useAppSelector";
import SearchFE from "../../../common/fieldEditors/SearchFE";
import { isAuthUserAdmin } from "@/redux/selectors";
import useAppSelector from "@/redux/hooks/useAppSelector";
import SearchFE from "@/components/common/fieldEditors/SearchFE";

interface Props {
setSearchValue: (v: string) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import {
GroupDTO,
RoleDetailsDTO,
UserDTO,
} from "../../../../../common/types";
import useEnqueueErrorSnackbar from "../../../../../hooks/useEnqueueErrorSnackbar";
import { createGroup, createRole } from "../../../../../services/api/user";
import { SubmitHandlerPlus } from "../../../../common/Form/types";
} from "@/common/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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ 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 "../../../utils";
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 { UseFormReturnPlus } from "../../../../../common/Form/types";
import { validateString } from "@/utils/validation/string";
} from "@/common/contants";

function GroupForm(props: UseFormReturnPlus) {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import FormDialog, {
FormDialogProps,
} from "../../../../../common/dialogs/FormDialog";
import { RoleType, UserDTO } from "../../../../../../common/types";
} from "@/components/common/dialogs/FormDialog";
import { RoleType, UserDTO } from "@/common/types";
import GroupForm from "./GroupForm";

export interface GroupFormDialogProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ import { useTranslation } from "react-i18next";
import { usePromise as usePromiseWrapper } from "react-use";
import { useSnackbar } from "notistack";
import * as R from "ramda";
import { GroupDetailsDTO } from "../../../../../common/types";
import { GroupDetailsDTO } from "@/common/types";
import {
createRole,
deleteUserRole,
getRolesForGroup,
updateGroup,
} from "../../../../../services/api/user";
import useEnqueueErrorSnackbar from "../../../../../hooks/useEnqueueErrorSnackbar";
} from "@/services/api/user";
import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar";
import GroupFormDialog, { GroupFormDialogProps } from "./GroupFormDialog";
import { GroupEdit } from "..";
import { SubmitHandlerPlus } from "../../../../common/Form/types";
import { SubmitHandlerPlus } from "@/components/common/Form/types";

type InheritPropsToOmit =
| "title"
Expand Down
20 changes: 10 additions & 10 deletions webapp/src/components/App/Settings/Groups/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ import EditIcon from "@mui/icons-material/Edit";
import * as R from "ramda";
import GroupIcon from "@mui/icons-material/Group";
import { useSnackbar } from "notistack";
import { GroupDetailsDTO } from "../../../../common/types";
import usePromiseWithSnackbarError from "../../../../hooks/usePromiseWithSnackbarError";
import { deleteGroup, getGroups } from "../../../../services/api/user";
import { sortByName } from "../../../../services/utils";
import ConfirmationDialog from "../../../common/dialogs/ConfirmationDialog";
import useEnqueueErrorSnackbar from "../../../../hooks/useEnqueueErrorSnackbar";
import { RESERVED_GROUP_NAMES } from "../utils";
import { GroupDetailsDTO } from "@/common/types";
import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError";
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 { 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";

enum GroupActionKind {
ADD = "ADD",
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/components/App/Settings/Maintenance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import { useState } from "react";
import { Controller, FieldValues, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { useUpdateEffect } from "react-use";
import useEnqueueErrorSnackbar from "../../../../hooks/useEnqueueErrorSnackbar";
import usePromiseWithSnackbarError from "../../../../hooks/usePromiseWithSnackbarError";
import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar";
import usePromiseWithSnackbarError from "@/hooks/usePromiseWithSnackbarError";
import {
getMaintenanceMode,
getMessageInfo,
updateMaintenanceMode,
updateMessageInfo,
} from "../../../../services/api/maintenance";
import ConfirmationDialog from "../../../common/dialogs/ConfirmationDialog";
} from "@/services/api/maintenance";
import ConfirmationDialog from "@/components/common/dialogs/ConfirmationDialog";

function Maintenance() {
const { t } = useTranslation();
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/App/Settings/Tokens/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { Box, Button } from "@mui/material";
import TokenIcon from "@mui/icons-material/Token";
import { useTranslation } from "react-i18next";
import { useState } from "react";
import { BotDTO } from "../../../../common/types";
import { BotDTO } from "@/common/types";
import CreateTokenDialog from "./dialog/CreateTokenDialog";
import SearchFE from "../../../common/fieldEditors/SearchFE";
import SearchFE from "@/components/common/fieldEditors/SearchFE";

interface Props {
setSearchValue: (v: string) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,12 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import { usePromise as usePromiseWrapper } from "react-use";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import {
BotCreateDTO,
BotDTO,
GroupDTO,
RoleType,
} from "../../../../../common/types";
import useEnqueueErrorSnackbar from "../../../../../hooks/useEnqueueErrorSnackbar";
import { createBot } from "../../../../../services/api/user";
import OkDialog from "../../../../common/dialogs/OkDialog";
import { BotCreateDTO, BotDTO, GroupDTO, RoleType } from "@/common/types";
import useEnqueueErrorSnackbar from "@/hooks/useEnqueueErrorSnackbar";
import { createBot } from "@/services/api/user";
import TokenFormDialog, { TokenFormDialogProps } from "./TokenFormDialog";
import { SubmitHandlerPlus } from "../../../../common/Form/types";
import OkDialog from "@/components/common/dialogs/OkDialog";
import { SubmitHandlerPlus } from "@/components/common/Form/types";

type InheritPropsToOmit = "title" | "titleIcon" | "onSubmit" | "onCancel";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,13 @@ import { v4 as uuidv4 } from "uuid";
import DeleteIcon from "@mui/icons-material/Delete";
import GroupIcon from "@mui/icons-material/Group";
import { TokenFormDialogProps } from ".";
import { GroupDTO, RoleType } from "../../../../../../common/types";
import usePromise from "../../../../../../hooks/usePromise";
import { getGroups } from "../../../../../../services/api/user";
import { roleToString, sortByName } from "../../../../../../services/utils";
import { RESERVED_GROUP_NAMES, ROLE_TYPE_KEYS } from "../../../utils";
import {
getAuthUser,
isAuthUserAdmin,
} from "../../../../../../redux/selectors";
import useAppSelector from "../../../../../../redux/hooks/useAppSelector";
import { GroupDTO, RoleType } from "@/common/types";
import usePromise from "@/hooks/usePromise";
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";

interface Props extends UseFormReturn {
onlyPermissions?: TokenFormDialogProps["onlyPermissions"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import FormDialog, {
FormDialogProps,
} from "../../../../../common/dialogs/FormDialog";
} from "@/components/common/dialogs/FormDialog";
import TokenForm from "./TokenForm";

export interface TokenFormDialogProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
* 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 { useTranslation } from "react-i18next";
import InfoIcon from "@mui/icons-material/Info";
import { useMemo } from "react";
import { FieldValues } from "react-hook-form";
import { BotDetailsDTO } from "../../../../../common/types";
import OkDialog, { OkDialogProps } from "../../../../common/dialogs/OkDialog";
import { useTranslation } from "react-i18next";
import TokenForm from "./TokenFormDialog/TokenForm";
import Form from "../../../../common/Form";
import Form from "@/components/common/Form";
import { Info } from "@mui/icons-material";

interface Props extends Omit<OkDialogProps, "title" | "titleIcon"> {
token: BotDetailsDTO;
Expand Down Expand Up @@ -52,7 +52,7 @@ function TokenInfoDialog(props: Props) {
fullWidth
{...dialogProps}
title={t("global.permissions")}
titleIcon={InfoIcon}
titleIcon={Info}
>
<DialogContentText>
{t("settings.currentToken", { 0: token.name })}
Expand Down
Loading

0 comments on commit d0337e6

Please sign in to comment.