|
@@ -1,6 +1,10 @@
|
|
|
import { makeStyles, Theme } from '@material-ui/core';
|
|
|
import { FC, useContext, useEffect, useState } from 'react';
|
|
|
-import { PartitionManageParam, PartitionParam, PartitionView } from './Types';
|
|
|
+import {
|
|
|
+ PartitionManageParam,
|
|
|
+ // PartitionParam,
|
|
|
+ PartitionView,
|
|
|
+} from './Types';
|
|
|
import MilvusGrid from '../../components/grid';
|
|
|
import { ColDefinitionsType, ToolBarConfig } from '../../components/grid/Types';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
@@ -12,8 +16,8 @@ import CreatePartition from './Create';
|
|
|
import { PartitionHttp } from '../../http/Partition';
|
|
|
import Status from '../../components/status/Status';
|
|
|
import { ManageRequestMethods } from '../../types/Common';
|
|
|
-import { StatusEnum } from '../../components/status/Types';
|
|
|
-import { useDialogHook } from '../../hooks/Dialog';
|
|
|
+// import { StatusEnum } from '../../components/status/Types';
|
|
|
+// import { useDialogHook } from '../../hooks/Dialog';
|
|
|
import DeleteTemplate from '../../components/customDialog/DeleteDialogTemplate';
|
|
|
|
|
|
const useStyles = makeStyles((theme: Theme) => ({
|
|
@@ -35,10 +39,10 @@ const Partitions: FC<{
|
|
|
const { t: btnTrans } = useTranslation('btn');
|
|
|
const { t: dialogTrans } = useTranslation('dialog');
|
|
|
const InfoIcon = icons.info;
|
|
|
- const LoadIcon = icons.load;
|
|
|
- const ReleaseIcon = icons.release;
|
|
|
+ // const LoadIcon = icons.load;
|
|
|
+ // const ReleaseIcon = icons.release;
|
|
|
|
|
|
- const { handleAction } = useDialogHook({ type: 'partition' });
|
|
|
+ // const { handleAction } = useDialogHook({ type: 'partition' });
|
|
|
const [selectedPartitions, setSelectedPartitions] = useState<PartitionView[]>(
|
|
|
[]
|
|
|
);
|
|
@@ -88,27 +92,27 @@ const Partitions: FC<{
|
|
|
handleCloseDialog();
|
|
|
};
|
|
|
|
|
|
- const handleRelease = async (data: PartitionView) => {
|
|
|
- const param: PartitionParam = {
|
|
|
- collectionName,
|
|
|
- partitionNames: [data._name],
|
|
|
- };
|
|
|
- const res = await PartitionHttp.releasePartition(param);
|
|
|
- openSnackBar(successTrans('release', { name: t('partition') }));
|
|
|
- fetchPartitions(collectionName);
|
|
|
- return res;
|
|
|
- };
|
|
|
+ // const handleRelease = async (data: PartitionView) => {
|
|
|
+ // const param: PartitionParam = {
|
|
|
+ // collectionName,
|
|
|
+ // partitionNames: [data._name],
|
|
|
+ // };
|
|
|
+ // const res = await PartitionHttp.releasePartition(param);
|
|
|
+ // openSnackBar(successTrans('release', { name: t('partition') }));
|
|
|
+ // fetchPartitions(collectionName);
|
|
|
+ // return res;
|
|
|
+ // };
|
|
|
|
|
|
- const handleLoad = async (data: PartitionView) => {
|
|
|
- const param: PartitionParam = {
|
|
|
- collectionName,
|
|
|
- partitionNames: [data._name!],
|
|
|
- };
|
|
|
- const res = await PartitionHttp.loadPartition(param);
|
|
|
- openSnackBar(successTrans('load', { name: t('partition') }));
|
|
|
- fetchPartitions(collectionName);
|
|
|
- return res;
|
|
|
- };
|
|
|
+ // const handleLoad = async (data: PartitionView) => {
|
|
|
+ // const param: PartitionParam = {
|
|
|
+ // collectionName,
|
|
|
+ // partitionNames: [data._name!],
|
|
|
+ // };
|
|
|
+ // const res = await PartitionHttp.loadPartition(param);
|
|
|
+ // openSnackBar(successTrans('load', { name: t('partition') }));
|
|
|
+ // fetchPartitions(collectionName);
|
|
|
+ // return res;
|
|
|
+ // };
|
|
|
|
|
|
const toolbarConfigs: ToolBarConfig[] = [
|
|
|
{
|
|
@@ -191,30 +195,30 @@ const Partitions: FC<{
|
|
|
</span>
|
|
|
),
|
|
|
},
|
|
|
- {
|
|
|
- id: 'action',
|
|
|
- align: 'center',
|
|
|
- disablePadding: false,
|
|
|
- label: '',
|
|
|
- showActionCell: true,
|
|
|
- isHoverAction: true,
|
|
|
- actionBarConfigs: [
|
|
|
- {
|
|
|
- onClick: (e: React.MouseEvent, row: PartitionView) => {
|
|
|
- const cb =
|
|
|
- row._status === StatusEnum.unloaded ? handleLoad : handleRelease;
|
|
|
- handleAction(row, cb);
|
|
|
- },
|
|
|
- icon: 'load',
|
|
|
- label: 'load',
|
|
|
- showIconMethod: 'renderFn',
|
|
|
- getLabel: (row: PartitionView) =>
|
|
|
- row._status === StatusEnum.loaded ? 'release' : 'load',
|
|
|
- renderIconFn: (row: PartitionView) =>
|
|
|
- row._status === StatusEnum.loaded ? <ReleaseIcon /> : <LoadIcon />,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // id: 'action',
|
|
|
+ // align: 'center',
|
|
|
+ // disablePadding: false,
|
|
|
+ // label: '',
|
|
|
+ // showActionCell: true,
|
|
|
+ // isHoverAction: true,
|
|
|
+ // actionBarConfigs: [
|
|
|
+ // {
|
|
|
+ // onClick: (e: React.MouseEvent, row: PartitionView) => {
|
|
|
+ // const cb =
|
|
|
+ // row._status === StatusEnum.unloaded ? handleLoad : handleRelease;
|
|
|
+ // handleAction(row, cb);
|
|
|
+ // },
|
|
|
+ // icon: 'load',
|
|
|
+ // label: 'load',
|
|
|
+ // showIconMethod: 'renderFn',
|
|
|
+ // getLabel: (row: PartitionView) =>
|
|
|
+ // row._status === StatusEnum.loaded ? 'release' : 'load',
|
|
|
+ // renderIconFn: (row: PartitionView) =>
|
|
|
+ // row._status === StatusEnum.loaded ? <ReleaseIcon /> : <LoadIcon />,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // },
|
|
|
];
|
|
|
|
|
|
const handleSelectChange = (value: PartitionView[]) => {
|