Commit f8d48b43 authored by chenshouchao's avatar chenshouchao

feat: 文件夹在文件前面显示 文件移动错误提示优化

parent 654a32de
......@@ -138,7 +138,9 @@ const MoveFile = (props: any) => {
foldersMove(folderMoveList);
}
if (fileMoveList.length > 0) {
filesMove(fileMoveList);
filesMove(fileMoveList)?.then((res) => {
successMove();
});
}
} else {
if (currentOperateFile.type === "dataSet") {
......@@ -146,7 +148,9 @@ const MoveFile = (props: any) => {
} else if (currentOperateFile.type === "directory") {
folerMove();
} else {
fileMove();
fileMove()?.then((res) => {
successMove();
});
}
}
}
......@@ -155,15 +159,13 @@ const MoveFile = (props: any) => {
// 单文件移动
const fileMove = () => {
const oldPathToFileServer = `${oldPathProvidedToFileServer}${currentOperateFile.name}`;
CloudEController.JobFileMove(
return CloudEController.JobFileMove(
newPath,
oldPathToFileServer,
"",
fileToken,
projectId
)?.then((res) => {
successMove();
});
);
};
// 多文件移动
......@@ -171,22 +173,28 @@ const MoveFile = (props: any) => {
const oldPaths = fileMoveList.map((item: any) => {
return `${oldPathProvidedToFileServer}${item.name}`;
});
CloudEController.JobFileBatchMove(
return CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
successMove();
});
);
};
// 单文件夹移动
const folerMove = () => {
fileMove();
fileMove()
?.then((res) => {
const names = currentOperateFile.name;
dataSetInFolerMove(names);
})
.catch((error) => {
console.log(error);
if (error?.response?.status === 405) {
Message.error("因目标路径存在同名文件,数据移动失败。");
}
});
};
// 移动文件夹中的数据集
......@@ -201,9 +209,17 @@ const MoveFile = (props: any) => {
// 多文件夹移动
const foldersMove = (folderMoveList: Array<any>) => {
filesMove(folderMoveList);
filesMove(folderMoveList)
?.then((res) => {
const names = folderMoveList.map((item: any) => item.name).join(",");
dataSetInFolerMove(names);
})
.catch((error) => {
console.log(error);
if (error?.response?.status === 405) {
Message.error("因目标路径存在同名文件,数据移动失败。");
}
});
};
// 单数据集移动
......
......@@ -88,13 +88,22 @@ const ProjectData = observer(() => {
useEffect(() => {
const locationInfo: any = location?.state;
setPath(locationInfo?.pathName || "");
handleRefresh();
}, [location]);
// 列表展示的数据
const showList = useMemo(() => {
if (activeTab === 1) {
return list;
// 做排序 文件夹在前
let folderList: any = [];
let fileList: any = [];
list.forEach((item: any) => {
if (item.type === "directory") {
folderList.push(item);
} else {
fileList.push(item);
}
});
return [...folderList, ...fileList];
} else {
const folderList = list.filter((item: any) => {
return item.type === "directory";
......
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