Commit 029dbe41 authored by wuyongsheng's avatar wuyongsheng

Merge branch 'feat-20220608-projectdata' into 'release'

Feat 20220608 projectdata

See merge request sunyihao/bkunyun!47
parents 34c8a931 53f3ef04
......@@ -25,7 +25,7 @@ const UseTusUpload = (uploadInfoStore: any) => {
let json = {
name: file.name,
bytesUploaded: 0,
bytesTotal: 0,
bytesTotal: file?.size,
percentage: 0,
startTime: new Date().getTime(),
endTime: new Date().getTime() + 1000,
......
......@@ -29,6 +29,7 @@ const FileItem = observer((props: IProps) => {
const itemInfo = toJS(fileItemInfo)?.info;
const { statusMsg = "" } = itemInfo || {};
const uploadInfoStore = toJS(useGlobalStore("fileListStore"));
const currentProjectStore = toJS(useGlobalStore("currentProjectStore"));
const Message = useMessage();
const navigate = useNavigate();
......@@ -98,17 +99,26 @@ const FileItem = observer((props: IProps) => {
</span>
)}
</div>
<LinearProgress
sx={{ width: 300, borderRadius: 2, margin: "6px 0", color: "red" }}
variant="determinate"
value={itemInfo?.percentage}
/>
{statusMsg !== "上传成功" ? (
<LinearProgress
sx={{
width: 300,
borderRadius: 2,
margin: "6px 0",
color: "red",
}}
variant="determinate"
value={itemInfo?.percentage}
/>
) : null}
<div style={{ fontSize: 12 }}>
{statusMsg === "上传成功" ? (
<>
<span style={{ color: "#8A9099" }}>已上传至</span>
<span style={{ color: "#565C66", marginLeft: 12 }}>
{fileItemInfo?.path}
{`CADD - ${
currentProjectStore?.currentProjectInfo?.name || ""
}`}
</span>
</>
) : (
......
......@@ -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();
const names = currentOperateFile.name;
dataSetInFolerMove(names);
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);
const names = folderMoveList.map((item: any) => item.name).join(",");
dataSetInFolerMove(names);
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";
......
......@@ -50,6 +50,7 @@ const BaseInfo = observer(() => {
const currentUserName = JSON.parse(
localStorage.getItem("userInfo") || "{}"
).name;
// 是否拥有编辑权限
const hasEditAuth = useMemo(() => {
if (!currentUserName) {
return false;
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-16 17:26:40
* @LastEditTime: 2022-06-16 18:17:04
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -65,7 +65,7 @@ const ProjectMembers = observer(() => {
label: "操作",
width: 160,
render: (item: any, row: any) => {
return item.projectRole === "OWNER" ? null : (
return item?.projectRole === "OWNER" ? null : (
<>
<span
style={{ color: "#1370FF", cursor: "pointer" }}
......
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