From 8113a499592effeeef58a16a8a702706573e60c4 Mon Sep 17 00:00:00 2001 From: "ruiyi.jiang" Date: Mon, 7 Aug 2023 07:55:34 +0800 Subject: [PATCH] refactor hook export/import Signed-off-by: ruiyi.jiang --- client/src/components/customInput/Types.ts | 4 +- client/src/hooks/index.tsx | 7 + client/src/pages/collections/Collection.tsx | 2 +- client/src/pages/collections/Collections.tsx | 3 +- client/src/pages/connect/AuthForm.tsx | 2 +- client/src/pages/database/Create.tsx | 2 +- client/src/pages/database/Database.tsx | 2 +- client/src/pages/database/Update.tsx | 140 ------------------ .../src/pages/dialogs/CreateAliasDialog.tsx | 2 +- .../pages/dialogs/CreateCollectionDialog.tsx | 2 +- .../pages/dialogs/CreatePartitionDialog.tsx | 2 +- .../pages/dialogs/LoadCollectionDialog.tsx | 2 +- .../pages/dialogs/RenameCollectionDialog.tsx | 2 +- client/src/pages/overview/Overview.tsx | 2 +- client/src/pages/partitions/Partitions.tsx | 7 +- client/src/pages/preview/Preview.tsx | 10 +- client/src/pages/query/Query.tsx | 7 +- client/src/pages/schema/Create.tsx | 2 +- client/src/pages/schema/Schema.tsx | 2 +- client/src/pages/search/SearchParams.tsx | 4 +- client/src/pages/search/VectorSearch.tsx | 10 +- client/src/pages/system/NodeListView.tsx | 2 +- client/src/pages/system/SystemView.tsx | 3 +- .../pages/systemHealthy/SystemHealthyView.tsx | 11 +- .../pages/systemHealthy/ThresholdSetting.tsx | 2 +- client/src/pages/user/CreateUser.tsx | 2 +- client/src/pages/user/Roles.tsx | 2 +- client/src/pages/user/Update.tsx | 2 +- client/src/pages/user/UpdateRoleDialog.tsx | 2 +- client/src/pages/user/User.tsx | 2 +- client/src/pages/user/Users.tsx | 2 +- client/src/types/Common.ts | 2 +- client/src/utils/Form.ts | 10 +- 33 files changed, 59 insertions(+), 199 deletions(-) create mode 100644 client/src/hooks/index.tsx delete mode 100644 client/src/pages/database/Update.tsx diff --git a/client/src/components/customInput/Types.ts b/client/src/components/customInput/Types.ts index 8205d909..5692f6a2 100644 --- a/client/src/components/customInput/Types.ts +++ b/client/src/components/customInput/Types.ts @@ -1,7 +1,7 @@ import { ReactElement } from 'react'; import { InputLabelProps } from '@material-ui/core'; -import { IValidationItem } from '../../hooks/Form'; -import { IExtraParam, ValidType } from '../../utils/Validation'; +import { IValidationItem } from '@/hooks'; +import { IExtraParam, ValidType } from '@/utils/Validation'; export type InputType = 'icon' | 'adornment' | 'text' | undefined; export type VariantType = 'filled' | 'outlined' | 'standard'; diff --git a/client/src/hooks/index.tsx b/client/src/hooks/index.tsx new file mode 100644 index 00000000..90b1f0fc --- /dev/null +++ b/client/src/hooks/index.tsx @@ -0,0 +1,7 @@ +export * from './Dialog'; +export * from './Form'; +export * from './Navigation'; +export * from './Pagination'; +export * from './Result'; +export * from './SystemView'; +export * from './TimeTravel'; diff --git a/client/src/pages/collections/Collection.tsx b/client/src/pages/collections/Collection.tsx index c340fa3d..f22524a8 100644 --- a/client/src/pages/collections/Collection.tsx +++ b/client/src/pages/collections/Collection.tsx @@ -3,7 +3,7 @@ import { useNavigate, useLocation, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { makeStyles, Theme } from '@material-ui/core'; import { authContext } from '@/context'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import CustomTabList from '@/components/customTabList/CustomTabList'; import { ITab } from '@/components/customTabList/Types'; diff --git a/client/src/pages/collections/Collections.tsx b/client/src/pages/collections/Collections.tsx index f0612b2c..f82fce4b 100644 --- a/client/src/pages/collections/Collections.tsx +++ b/client/src/pages/collections/Collections.tsx @@ -9,13 +9,12 @@ import { databaseContext, webSocketContext, } from '@/context'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook, usePaginationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import AttuGrid from '@/components/grid/Grid'; import CustomToolBar from '@/components/grid/ToolBar'; import { CollectionView, InsertDataParam } from './Types'; import { ColDefinitionsType, ToolBarConfig } from '@/components/grid/Types'; -import { usePaginationHook } from '@/hooks/Pagination'; import icons from '@/components/icons/Icons'; import EmptyCard from '@/components/cards/EmptyCard'; import Status from '@/components/status/Status'; diff --git a/client/src/pages/connect/AuthForm.tsx b/client/src/pages/connect/AuthForm.tsx index ed6eeae9..1e46241e 100644 --- a/client/src/pages/connect/AuthForm.tsx +++ b/client/src/pages/connect/AuthForm.tsx @@ -5,7 +5,7 @@ import CustomButton from '@/components/customButton/CustomButton'; import CustomInput from '@/components/customInput/CustomInput'; import icons from '@/components/icons/Icons'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { MilvusHttp } from '@/http/Milvus'; import { useNavigate } from 'react-router-dom'; diff --git a/client/src/pages/database/Create.tsx b/client/src/pages/database/Create.tsx index 6c886b87..754d86ff 100644 --- a/client/src/pages/database/Create.tsx +++ b/client/src/pages/database/Create.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { CreateDatabaseProps, CreateDatabaseParams } from './Types'; diff --git a/client/src/pages/database/Database.tsx b/client/src/pages/database/Database.tsx index f78e28ca..c47993a3 100644 --- a/client/src/pages/database/Database.tsx +++ b/client/src/pages/database/Database.tsx @@ -10,7 +10,7 @@ import { } from './Types'; import DeleteTemplate from '@/components/customDialog/DeleteDialogTemplate'; import { rootContext } from '@/context'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import CreateUser from './Create'; diff --git a/client/src/pages/database/Update.tsx b/client/src/pages/database/Update.tsx deleted file mode 100644 index 5aa8b2a8..00000000 --- a/client/src/pages/database/Update.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import { makeStyles, Theme } from '@material-ui/core'; -import { FC, useMemo, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import DialogTemplate from '@/components/customDialog/DialogTemplate'; -import CustomInput from '@/components/customInput/CustomInput'; -import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; -import { formatForm } from '@/utils/Form'; -import { UpdateUserParams, UpdateUserProps } from './Types'; - -const useStyles = makeStyles((theme: Theme) => ({ - input: { - margin: theme.spacing(3, 0, 0.5), - }, -})); - -const UpdateUser: FC = ({ - handleClose, - handleUpdate, - username, -}) => { - const { t: userTrans } = useTranslation('user'); - const { t: btnTrans } = useTranslation('btn'); - const { t: warningTrans } = useTranslation('warning'); - - const [form, setForm] = useState< - Omit & { confirmPassword: string } - >({ - oldPassword: '', - newPassword: '', - confirmPassword: '', - }); - const checkedForm = useMemo(() => { - const { oldPassword, newPassword } = form; - return formatForm({ oldPassword, newPassword }); - }, [form]); - const { validation, checkIsValid, disabled } = useFormValidation(checkedForm); - - const classes = useStyles(); - - const handleInputChange = ( - key: 'oldPassword' | 'newPassword' | 'confirmPassword', - value: string - ) => { - setForm(v => ({ ...v, [key]: value })); - }; - - const createConfigs: ITextfieldConfig[] = [ - { - label: userTrans('oldPassword'), - key: 'oldPassword', - onChange: (value: string) => handleInputChange('oldPassword', value), - variant: 'filled', - className: classes.input, - placeholder: userTrans('oldPassword'), - fullWidth: true, - validations: [ - { - rule: 'require', - errorText: warningTrans('required', { - name: userTrans('oldPassword'), - }), - }, - ], - type: 'password', - defaultValue: form.oldPassword, - }, - { - label: userTrans('newPassword'), - key: 'newPassword', - onChange: (value: string) => handleInputChange('newPassword', value), - variant: 'filled', - className: classes.input, - placeholder: userTrans('newPassword'), - fullWidth: true, - validations: [ - { - rule: 'require', - errorText: warningTrans('required', { - name: userTrans('newPassword'), - }), - }, - ], - type: 'password', - defaultValue: form.newPassword, - }, - { - label: userTrans('confirmPassword'), - key: 'confirmPassword', - onChange: (value: string) => handleInputChange('confirmPassword', value), - variant: 'filled', - className: classes.input, - placeholder: userTrans('confirmPassword'), - fullWidth: true, - validations: [ - { - rule: 'confirm', - extraParam: { - compareValue: form.newPassword, - }, - errorText: userTrans('isNotSame'), - }, - ], - type: 'password', - defaultValue: form.confirmPassword, - }, - ]; - - const handleUpdateUser = () => { - handleUpdate({ - username, - newPassword: form.newPassword, - oldPassword: form.oldPassword, - }); - }; - - return ( - - <> - {createConfigs.map(v => ( - - ))} - - - ); -}; - -export default UpdateUser; diff --git a/client/src/pages/dialogs/CreateAliasDialog.tsx b/client/src/pages/dialogs/CreateAliasDialog.tsx index 8497cd0d..8d2007e6 100644 --- a/client/src/pages/dialogs/CreateAliasDialog.tsx +++ b/client/src/pages/dialogs/CreateAliasDialog.tsx @@ -5,7 +5,7 @@ import { rootContext } from '@/context'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { formatForm } from '@/utils/Form'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { ITextfieldConfig } from '@/components/customInput/Types'; import { CollectionHttp } from '@/http/Collection'; import { CreateAliasProps } from './Types'; diff --git a/client/src/pages/dialogs/CreateCollectionDialog.tsx b/client/src/pages/dialogs/CreateCollectionDialog.tsx index 1abe325a..d98d7aeb 100644 --- a/client/src/pages/dialogs/CreateCollectionDialog.tsx +++ b/client/src/pages/dialogs/CreateCollectionDialog.tsx @@ -6,7 +6,7 @@ import CustomInput from '@/components/customInput/CustomInput'; import CustomSelector from '@/components/customSelector/CustomSelector'; import { ITextfieldConfig } from '@/components/customInput/Types'; import { rootContext } from '@/context'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { TypeEnum } from '@/utils/Validation'; import CreateFields from '../collections/CreateFields'; diff --git a/client/src/pages/dialogs/CreatePartitionDialog.tsx b/client/src/pages/dialogs/CreatePartitionDialog.tsx index e6dc4e0f..659331fb 100644 --- a/client/src/pages/dialogs/CreatePartitionDialog.tsx +++ b/client/src/pages/dialogs/CreatePartitionDialog.tsx @@ -5,7 +5,7 @@ import { rootContext } from '@/context'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { PartitionCreateProps } from './Types'; import { PartitionManageParam } from '../partitions/Types'; diff --git a/client/src/pages/dialogs/LoadCollectionDialog.tsx b/client/src/pages/dialogs/LoadCollectionDialog.tsx index 881eaca0..3e8bf5e4 100644 --- a/client/src/pages/dialogs/LoadCollectionDialog.tsx +++ b/client/src/pages/dialogs/LoadCollectionDialog.tsx @@ -9,7 +9,7 @@ import { import { useTranslation } from 'react-i18next'; import { authContext, rootContext } from '@/context'; import { CollectionHttp } from '@/http/Collection'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { parseJson, getNode } from '@/utils/Metric'; import CustomInput from '@/components/customInput/CustomInput'; diff --git a/client/src/pages/dialogs/RenameCollectionDialog.tsx b/client/src/pages/dialogs/RenameCollectionDialog.tsx index 2a842dac..d864ad86 100644 --- a/client/src/pages/dialogs/RenameCollectionDialog.tsx +++ b/client/src/pages/dialogs/RenameCollectionDialog.tsx @@ -5,7 +5,7 @@ import { rootContext } from '@/context'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { formatForm } from '@/utils/Form'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { ITextfieldConfig } from '@/components/customInput/Types'; import { CollectionHttp } from '@/http/Collection'; import { RenameCollectionProps } from './Types'; diff --git a/client/src/pages/overview/Overview.tsx b/client/src/pages/overview/Overview.tsx index 35b404bc..cffd0c9d 100644 --- a/client/src/pages/overview/Overview.tsx +++ b/client/src/pages/overview/Overview.tsx @@ -6,7 +6,7 @@ import EmptyCard from '@/components/cards/EmptyCard'; import icons from '@/components/icons/Icons'; import { WS_EVENTS, WS_EVENTS_TYPE } from '@/consts/Http'; import { LOADING_STATE } from '@/consts/Milvus'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { CollectionHttp } from '@/http/Collection'; import { MilvusHttp } from '@/http/Milvus'; import { ALL_ROUTER_TYPES } from '@/router/Types'; diff --git a/client/src/pages/partitions/Partitions.tsx b/client/src/pages/partitions/Partitions.tsx index 915d06b8..b951739e 100644 --- a/client/src/pages/partitions/Partitions.tsx +++ b/client/src/pages/partitions/Partitions.tsx @@ -1,17 +1,15 @@ import { makeStyles, Theme } from '@material-ui/core'; import { FC, useContext, useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; -import { PartitionView } from './Types'; +import Highlighter from 'react-highlight-words'; import AttuGrid from '@/components/grid/Grid'; import { ColDefinitionsType, ToolBarConfig } from '@/components/grid/Types'; import { useTranslation } from 'react-i18next'; -import { usePaginationHook } from '@/hooks/Pagination'; +import { usePaginationHook, useInsertDialogHook } from '@/hooks'; import icons from '@/components/icons/Icons'; import CustomToolTip from '@/components/customToolTip/CustomToolTip'; import { rootContext } from '@/context'; import { PartitionHttp } from '@/http/Partition'; -import Highlighter from 'react-highlight-words'; -import { useInsertDialogHook } from '@/hooks/Dialog'; import InsertContainer from '../dialogs/insert/Dialog'; import { CollectionHttp } from '@/http/Collection'; import { FieldHttp } from '@/http/Field'; @@ -20,6 +18,7 @@ import { InsertDataParam } from '../collections/Types'; import { MilvusHttp } from '@/http/Milvus'; import CreatePartitionDialog from '../dialogs/CreatePartitionDialog'; import DropPartitionDialog from '../dialogs/DropPartitionDialog'; +import { PartitionView } from './Types'; const useStyles = makeStyles((theme: Theme) => ({ wrapper: { diff --git a/client/src/pages/preview/Preview.tsx b/client/src/pages/preview/Preview.tsx index a109c89d..33da821c 100644 --- a/client/src/pages/preview/Preview.tsx +++ b/client/src/pages/preview/Preview.tsx @@ -5,16 +5,12 @@ import { getQueryStyles } from '../query/Styles'; import { CollectionHttp } from '@/http/Collection'; import { FieldHttp } from '@/http/Field'; import { IndexHttp } from '@/http/Index'; -import { usePaginationHook } from '@/hooks/Pagination'; +import { usePaginationHook, useSearchResult } from '@/hooks'; import { ToolBarConfig } from '@/components/grid/Types'; import CustomToolBar from '@/components/grid/ToolBar'; import { generateVector } from '@/utils/Common'; -import { DataTypeEnum } from '../../pages/collections/Types'; -import { useSearchResult } from '@/hooks/Result'; -import { - INDEX_CONFIG, - DEFAULT_SEARCH_PARAM_VALUE_MAP, -} from '../../consts/Milvus'; +import { DataTypeEnum } from '@/pages/collections/Types'; +import { INDEX_CONFIG, DEFAULT_SEARCH_PARAM_VALUE_MAP } from '@/consts/Milvus'; const Preview: FC<{ collectionName: string; diff --git a/client/src/pages/query/Query.tsx b/client/src/pages/query/Query.tsx index 6e35ef95..aef24bce 100644 --- a/client/src/pages/query/Query.tsx +++ b/client/src/pages/query/Query.tsx @@ -8,19 +8,18 @@ import icons from '@/components/icons/Icons'; import CustomButton from '@/components/customButton/CustomButton'; import AttuGrid from '@/components/grid/Grid'; import { ToolBarConfig } from '@/components/grid/Types'; +import { saveAs } from 'file-saver'; import { getQueryStyles } from './Styles'; import Filter from '@/components/advancedSearch'; import { CollectionHttp } from '@/http/Collection'; import { FieldHttp } from '@/http/Field'; -import { usePaginationHook } from '@/hooks/Pagination'; -// import { useTimeTravelHook } from '@/hooks/TimeTravel'; +import { usePaginationHook, useSearchResult } from '@/hooks'; +// import { useTimeTravelHook } from '@/hooks'; import DeleteTemplate from '@/components/customDialog/DeleteDialogTemplate'; import CustomToolBar from '@/components/grid/ToolBar'; // import { CustomDatePicker } from '@/components/customDatePicker/CustomDatePicker'; -import { saveAs } from 'file-saver'; import { DataTypeStringEnum } from '../collections/Types'; import { getLabelDisplayedRows } from '../search/Utils'; -import { useSearchResult } from '@/hooks/Result'; const Query: FC<{ collectionName: string; diff --git a/client/src/pages/schema/Create.tsx b/client/src/pages/schema/Create.tsx index 4c316e1d..93cd6408 100644 --- a/client/src/pages/schema/Create.tsx +++ b/client/src/pages/schema/Create.tsx @@ -10,7 +10,7 @@ import { INDEX_OPTIONS_MAP, METRIC_TYPES_VALUES, } from '../../consts/Milvus'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { getCreateIndexJSCode } from '@/utils/code/Js'; import { getCreateIndexPYCode } from '@/utils/code/Py'; import { getCreateIndexJavaCode } from '@/utils/code/Java'; diff --git a/client/src/pages/schema/Schema.tsx b/client/src/pages/schema/Schema.tsx index 22b44c64..028e8e76 100644 --- a/client/src/pages/schema/Schema.tsx +++ b/client/src/pages/schema/Schema.tsx @@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react'; import AttuGrid from '@/components/grid/Grid'; import { ColDefinitionsType } from '@/components/grid/Types'; import { useTranslation } from 'react-i18next'; -import { usePaginationHook } from '@/hooks/Pagination'; +import { usePaginationHook } from '@/hooks'; import icons from '@/components/icons/Icons'; import { FieldHttp } from '@/http/Field'; import { FieldView } from './Types'; diff --git a/client/src/pages/search/SearchParams.tsx b/client/src/pages/search/SearchParams.tsx index 241fb7a4..5ab0d27d 100644 --- a/client/src/pages/search/SearchParams.tsx +++ b/client/src/pages/search/SearchParams.tsx @@ -11,9 +11,9 @@ import { INDEX_CONFIG, METRIC_OPTIONS_MAP, searchKeywordsType, -} from '../../consts/Milvus'; +} from '@/consts/Milvus'; import { rootContext } from '@/context'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { SearchParamInputConfig, SearchParamsProps } from './Types'; diff --git a/client/src/pages/search/VectorSearch.tsx b/client/src/pages/search/VectorSearch.tsx index d1c907d7..dca46093 100644 --- a/client/src/pages/search/VectorSearch.tsx +++ b/client/src/pages/search/VectorSearch.tsx @@ -3,10 +3,12 @@ import { TextField, Typography, Button } from '@material-ui/core'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; import { ALL_ROUTER_TYPES } from '@/router/Types'; -import { useNavigationHook } from '@/hooks/Navigation'; -import { useSearchResult } from '@/hooks/Result'; -import { usePaginationHook } from '@/hooks/Pagination'; -import { useTimeTravelHook } from '@/hooks/TimeTravel'; +import { + useNavigationHook, + useSearchResult, + usePaginationHook, + useTimeTravelHook, +} from '@/hooks'; import { databaseContext } from '@/context'; import CustomSelector from '@/components/customSelector/CustomSelector'; import { ColDefinitionsType } from '@/components/grid/Types'; diff --git a/client/src/pages/system/NodeListView.tsx b/client/src/pages/system/NodeListView.tsx index 87bd485e..a5983a80 100644 --- a/client/src/pages/system/NodeListView.tsx +++ b/client/src/pages/system/NodeListView.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import { makeStyles, Theme } from '@material-ui/core'; import KeyboardArrowDown from '@material-ui/icons/KeyboardArrowDown'; import { DataGrid } from '@mui/x-data-grid'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import MiniTopo from './MiniTopology'; import { getByteString, formatByteSize } from '@/utils/Format'; diff --git a/client/src/pages/system/SystemView.tsx b/client/src/pages/system/SystemView.tsx index c51732a2..c630677b 100644 --- a/client/src/pages/system/SystemView.tsx +++ b/client/src/pages/system/SystemView.tsx @@ -2,10 +2,9 @@ import { useState, useEffect, useRef } from 'react'; // import { useTranslation } from 'react-i18next'; import { makeStyles, Theme } from '@material-ui/core'; import clsx from 'clsx'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook, useInterval } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import { MilvusHttp } from '@/http/Milvus'; -import { useInterval } from '@/hooks/SystemView'; import Topo from './Topology'; import NodeListView from './NodeListView'; // import LineChartCard from './LineChartCard'; diff --git a/client/src/pages/systemHealthy/SystemHealthyView.tsx b/client/src/pages/systemHealthy/SystemHealthyView.tsx index be7082fe..b7789cb3 100644 --- a/client/src/pages/systemHealthy/SystemHealthyView.tsx +++ b/client/src/pages/systemHealthy/SystemHealthyView.tsx @@ -1,7 +1,7 @@ -import { makeStyles, Theme } from '@material-ui/core'; import { useEffect, useMemo, useState } from 'react'; -import { useNavigationHook } from '@/hooks/Navigation'; -import { useInterval } from '@/hooks/SystemView'; +import { makeStyles, Theme } from '@material-ui/core'; +import { useTranslation } from 'react-i18next'; +import { useNavigationHook, useInterval } from '@/hooks'; import { PrometheusHttp } from '@/http/Prometheus'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import { @@ -19,12 +19,11 @@ import { timeRangeOptions } from './consts'; import { LAST_TIME_HEALTHY_THRESHOLD_CPU, LAST_TIME_HEALTHY_THRESHOLD_MEMORY, -} from '../../consts/Localstorage'; +} from '@/consts/Localstorage'; import { DEFAULT_HEALTHY_THRESHOLD_CPU, DEFAULT_HEALTHY_THRESHOLD_MEMORY, -} from '../../consts/Prometheus'; -import { useTranslation } from 'react-i18next'; +} from '@/consts/Prometheus'; const getStyles = makeStyles((theme: Theme) => ({ root: { diff --git a/client/src/pages/systemHealthy/ThresholdSetting.tsx b/client/src/pages/systemHealthy/ThresholdSetting.tsx index bd61f27d..8368dd0f 100644 --- a/client/src/pages/systemHealthy/ThresholdSetting.tsx +++ b/client/src/pages/systemHealthy/ThresholdSetting.tsx @@ -12,7 +12,7 @@ import { import { Dispatch, SetStateAction, useMemo, useState } from 'react'; import CustomInput from '@/components/customInput/CustomInput'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { HEALTHY_STATUS_COLORS } from './consts'; import { EHealthyStatus, IThreshold } from './Types'; diff --git a/client/src/pages/user/CreateUser.tsx b/client/src/pages/user/CreateUser.tsx index 2324cc1e..74e1172f 100644 --- a/client/src/pages/user/CreateUser.tsx +++ b/client/src/pages/user/CreateUser.tsx @@ -11,7 +11,7 @@ import { useTranslation } from 'react-i18next'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { CreateUserProps, CreateUserParams } from './Types'; import { Option as RoleOption } from '@/components/customSelector/Types'; diff --git a/client/src/pages/user/Roles.tsx b/client/src/pages/user/Roles.tsx index 1b91d488..4b392739 100644 --- a/client/src/pages/user/Roles.tsx +++ b/client/src/pages/user/Roles.tsx @@ -7,7 +7,7 @@ import { ColDefinitionsType, ToolBarConfig } from '@/components/grid/Types'; import { DeleteRoleParams, RoleData } from './Types'; import DeleteTemplate from '@/components/customDialog/DeleteDialogTemplate'; import { rootContext } from '@/context'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import UpdateRoleDialog from './UpdateRoleDialog'; diff --git a/client/src/pages/user/Update.tsx b/client/src/pages/user/Update.tsx index 1a7b1c3f..f194c130 100644 --- a/client/src/pages/user/Update.tsx +++ b/client/src/pages/user/Update.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { UpdateUserParams, UpdateUserProps } from './Types'; diff --git a/client/src/pages/user/UpdateRoleDialog.tsx b/client/src/pages/user/UpdateRoleDialog.tsx index f5c35e32..ebf7f173 100644 --- a/client/src/pages/user/UpdateRoleDialog.tsx +++ b/client/src/pages/user/UpdateRoleDialog.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import DialogTemplate from '@/components/customDialog/DialogTemplate'; import CustomInput from '@/components/customInput/CustomInput'; import { ITextfieldConfig } from '@/components/customInput/Types'; -import { useFormValidation } from '@/hooks/Form'; +import { useFormValidation } from '@/hooks'; import { formatForm } from '@/utils/Form'; import { UserHttp } from '@/http/User'; import { diff --git a/client/src/pages/user/User.tsx b/client/src/pages/user/User.tsx index b0e03d15..14560f3b 100644 --- a/client/src/pages/user/User.tsx +++ b/client/src/pages/user/User.tsx @@ -13,7 +13,7 @@ import { } from './Types'; import DeleteTemplate from '@/components/customDialog/DeleteDialogTemplate'; import { rootContext } from '@/context'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import CreateUser from './CreateUser'; import UpdateUserRole from './UpdateUserRole'; diff --git a/client/src/pages/user/Users.tsx b/client/src/pages/user/Users.tsx index 2fb2222b..4d4f1850 100644 --- a/client/src/pages/user/Users.tsx +++ b/client/src/pages/user/Users.tsx @@ -2,7 +2,7 @@ import { useMemo } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { makeStyles, Theme } from '@material-ui/core'; -import { useNavigationHook } from '@/hooks/Navigation'; +import { useNavigationHook } from '@/hooks'; import { ALL_ROUTER_TYPES } from '@/router/Types'; import CustomTabList from '@/components/customTabList/CustomTabList'; import { ITab } from '@/components/customTabList/Types'; diff --git a/client/src/types/Common.ts b/client/src/types/Common.ts index 650f19d0..769c7414 100644 --- a/client/src/types/Common.ts +++ b/client/src/types/Common.ts @@ -1,4 +1,4 @@ -import { IValidationItem } from '../hooks/Form'; +import { IValidationItem } from '@/hooks'; export interface KeyValuePair { label: string; diff --git a/client/src/utils/Form.ts b/client/src/utils/Form.ts index c2fd78b9..c103ac32 100644 --- a/client/src/utils/Form.ts +++ b/client/src/utils/Form.ts @@ -1,8 +1,8 @@ -import { Option } from '../components/customSelector/Types'; -import { METRIC_TYPES_VALUES } from '../consts/Milvus'; -import { IForm } from '../hooks/Form'; -import { DataTypeStringEnum } from '../pages/collections/Types'; -import { IndexType } from '../pages/schema/Types'; +import { Option } from '@/components/customSelector/Types'; +import { METRIC_TYPES_VALUES } from '@/consts/Milvus'; +import { IForm } from '@/hooks'; +import { DataTypeStringEnum } from '@/pages/collections/Types'; +import { IndexType } from '@/pages/schema/Types'; interface IInfo { [key: string]: any;