Commit 88289aac authored by chenshouchao's avatar chenshouchao

feat: 除下载外联调完成

parent c5517fd8
......@@ -18,8 +18,11 @@ const RESTAPI = {
API_PROJECT_GET: `${BACKEND_API_URI_PREFIX}/cpp/project/get`, //获取项目信息
API_CPCE_HPCZONE: `${BACKEND_API_URI_PREFIX}/cpp/cpce/hpczone`, //获取计算区列表
API_DATA_FILETOKEN: `${BACKEND_API_URI_PREFIX}/cpp/data/filetoken`, //获取项目目录的filetoken
API_USER_PERMISSION_LIST: `${BACKEND_API_URI_PREFIX}/uaa/routes/privilege/list`,//获取用户包含的权限列表
}
API_DATA_FIND: `${BACKEND_API_URI_PREFIX}/cpp/data/find`, //查询某路径下数据集
API_DATA_SEARCH: `${BACKEND_API_URI_PREFIX}/cpp/data/search`, //搜索项目中某路径下的数据集
API_DATA_MOVE: `${BACKEND_API_URI_PREFIX}/cpp/data/move`, //移动到
API_DATA_DEL: `${BACKEND_API_URI_PREFIX}/cpp/data/del`, //删除项目中的数据集
API_USER_PERMISSION_LIST: `${BACKEND_API_URI_PREFIX}/uaa/routes/privilege/list`, //获取用户包含的权限列表
};
export default RESTAPI;
......@@ -99,6 +99,74 @@ const getDataFileToken = (params: getDataFileTokenParams) => {
});
};
type getDataFindParams = {
projectId: string;
path: string;
};
// 查询某路径下数据集
const getDataFind = (params: getDataFindParams) => {
return request({
url: Api.API_DATA_FIND,
method: "get",
params,
});
};
type getDataFileSearchParams = {
projectId: string;
name: string;
path?: string;
};
// 搜索项目中某路径下的数据集
const getDataFileSearch = (params: getDataFileSearchParams) => {
return request({
url: Api.API_DATA_SEARCH,
method: "get",
params,
});
};
type getDataFileMoveParams = {
projectId: string;
names: string;
spath?: string; // 原路径
dpath?: string; // 目标路径
};
// Content-Type application/x-www-form-urlencoded
// 移动到
const getDataFileMove = (params: getDataFileMoveParams) => {
return request({
url: Api.API_DATA_MOVE,
method: "put",
data: params,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
type getDataFileDelParams = {
projectId: string;
names: string;
path?: string;
};
// Content-Type application/x-www-form-urlencoded
// 删除项目中的数据集
const getDataFileDel = (params: getDataFileDelParams) => {
return request({
url: Api.API_DATA_DEL,
method: "delete",
params,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
export {
current,
menu,
......@@ -109,4 +177,8 @@ export {
updateProject,
deleteProject,
getDataFileToken,
getDataFind,
getDataFileSearch,
getDataFileMove,
getDataFileDel,
};
......@@ -15,6 +15,7 @@ import EnhancedTableHeadComponent from "./Table/EnhancedTableHead"
import { getComparator, stableSort, useStyles } from "./Table/function";
import ActionsComponent from "./Table/ActionsComponent"
import { useEffect } from "react";
import { useImperativeHandle } from "react";
export default function EnhancedTable(props) {
const classes = useStyles;
......@@ -27,6 +28,17 @@ export default function EnhancedTable(props) {
// const [spin, setSpin] = React.useState(false)
const [onRow, setOnRow] = React.useState('')
// 重置复选框选中选项
const initSelectedFunc = (e) => {
setSelected(e)
}
useImperativeHandle(props.onRef, () => {
return {
initSelectedFunc: initSelectedFunc,
};
});
useEffect(() => {
setOnRow(defaultRow)
}, [defaultRow])
......
......@@ -10,6 +10,9 @@
justify-content: flex-start;
align-items: center;
}
.rootTitleActive {
background-color: rgba(25, 118, 210, 0.2);
}
.bigFolderIcon {
margin: 0 9px;
}
......
import React, {
useState,
useImperativeHandle,
useCallback,
} from "react";
import React, { useState, useImperativeHandle, useCallback } from "react";
import style from "./index.module.css";
import MyDialog from "@/components/mui/MyDialog";
......@@ -11,11 +7,31 @@ import bigFolderIcon from "@/assets/project/bigFolderIcon.svg";
import { useMessage } from "@/components/MySnackbar";
import MyTreeView from "@/components/mui/MyTreeView";
import CloudEController from "@/api/fileserver/CloudEController";
import { getDataFileMove } from "@/api/project_api";
import useMyRequest from "@/hooks/useMyRequest";
import classNames from "classnames";
const MoveFile = (props: any) => {
const { path, projectId, fileToken, currentOperateFile, selectIds, refresh } = props;
const {
path,
projectId,
fileToken,
currentOperateFile,
selectIds,
refresh,
activeTab,
showList,
} = props;
const Message = useMessage();
const [newPath, setNewPath] = useState("");
const { run: getDataFileMoveRun } = useMyRequest(getDataFileMove, {
onSuccess: (res: any) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
},
});
const [newPath, setNewPath] = useState("/");
const [rootActive, setRootActive] = useState(true);
const [treeData, setTreeData] = useState<any>([]);
......@@ -53,36 +69,86 @@ const MoveFile = (props: any) => {
if (newPath) {
if (!currentOperateFile) {
// 批量移动
const oldPaths = selectIds.map((name: any) => {
return `${path}${path === "/" ? "" : "/"}${name}`;
});
CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
Message.success('移动成功!')
refresh()
});
if (activeTab === 1) {
const oldPaths = selectIds.map((name: any) => {
return `${path}${path === "/" ? "" : "/"}${name}`;
});
CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
});
} else {
const datSetMoveList = showList.filter((item: any) => {
return (
selectIds.indexOf(item.name) !== -1 && item.type === "dataSet"
);
});
const otherMoveList = showList.filter((item: any) => {
return (
selectIds.indexOf(item.name) !== -1 && item.type !== "dataSet"
);
});
if (datSetMoveList.length > 0) {
const oldPaths = `${path}${path === "/" ? "" : "/"}`;
getDataFileMoveRun({
projectId: projectId as string,
names: datSetMoveList.map((item: any) => item.name).join(","),
spath: oldPaths,
dpath: newPath === "/" ? "/" : `${newPath}/`,
});
}
if (otherMoveList.length > 0) {
const oldPaths = otherMoveList.map((item: any) => {
return `${path}${path === "/" ? "" : "/"}${item.name}`;
});
CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
});
}
}
} else {
const oldPath = `${path}${path === "/" ? "" : "/"}${
currentOperateFile.name
}`;
if (oldPath === newPath) {
Message.info("当前目录和目标目录一致,请重新选择目标目录");
return;
if (currentOperateFile.type === "dataSet") {
const oldPaths = `${path}${path === "/" ? "" : "/"}`;
getDataFileMoveRun({
projectId: projectId as string,
names: currentOperateFile.name,
spath: oldPaths,
dpath: newPath === "/" ? "/" : `${newPath}/`,
});
} else {
const oldPath = `${path}${path === "/" ? "" : "/"}${
currentOperateFile.name
}`;
if (oldPath === newPath) {
Message.info("当前目录和目标目录一致,请重新选择目标目录");
return;
}
CloudEController.JobFileMove(
newPath,
oldPath,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
});
}
CloudEController.JobFileMove(
newPath,
oldPath,
"",
fileToken,
projectId
)?.then((res) => {
console.log(res);
});
}
} else {
Message.error("请选择移动到哪个目录");
......@@ -99,8 +165,13 @@ const MoveFile = (props: any) => {
};
const onNodeSelect = (a: any, b: any) => {
console.log("onNodeSelect", a, b);
setNewPath(b);
setRootActive(false);
};
const handleRoot = () => {
setNewPath("/");
setRootActive(true);
};
const moveFileSubmitloading = false;
......@@ -116,7 +187,13 @@ const MoveFile = (props: any) => {
title="移动至"
submitloading={moveFileSubmitloading}
>
<div className={style.rootTitle}>
<div
className={classNames({
[style.rootTitle]: true,
[style.rootTitleActive]: rootActive,
})}
onClick={handleRoot}
>
<img className={style.bigFolderIcon} src={bigFolderIcon} alt="" />
ProjectData
</div>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment