Skip to content

Commit

Permalink
refactor hook export/import
Browse files Browse the repository at this point in the history
Signed-off-by: ruiyi.jiang <[email protected]>
  • Loading branch information
shanghaikid committed Aug 6, 2023
1 parent 146fdb7 commit 8113a49
Show file tree
Hide file tree
Showing 33 changed files with 59 additions and 199 deletions.
4 changes: 2 additions & 2 deletions client/src/components/customInput/Types.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
7 changes: 7 additions & 0 deletions client/src/hooks/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion client/src/pages/collections/Collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 1 addition & 2 deletions client/src/pages/collections/Collections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/connect/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/database/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/database/Database.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
140 changes: 0 additions & 140 deletions client/src/pages/database/Update.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion client/src/pages/dialogs/CreateAliasDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/dialogs/CreateCollectionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/dialogs/CreatePartitionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/dialogs/LoadCollectionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/dialogs/RenameCollectionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/overview/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
7 changes: 3 additions & 4 deletions client/src/pages/partitions/Partitions.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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: {
Expand Down
10 changes: 3 additions & 7 deletions client/src/pages/preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions client/src/pages/query/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/schema/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/schema/Schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/search/SearchParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
10 changes: 6 additions & 4 deletions client/src/pages/search/VectorSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/system/NodeListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading

0 comments on commit 8113a49

Please sign in to comment.