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) => { ...@@ -25,7 +25,7 @@ const UseTusUpload = (uploadInfoStore: any) => {
let json = { let json = {
name: file.name, name: file.name,
bytesUploaded: 0, bytesUploaded: 0,
bytesTotal: 0, bytesTotal: file?.size,
percentage: 0, percentage: 0,
startTime: new Date().getTime(), startTime: new Date().getTime(),
endTime: new Date().getTime() + 1000, endTime: new Date().getTime() + 1000,
......
...@@ -29,6 +29,7 @@ const FileItem = observer((props: IProps) => { ...@@ -29,6 +29,7 @@ const FileItem = observer((props: IProps) => {
const itemInfo = toJS(fileItemInfo)?.info; const itemInfo = toJS(fileItemInfo)?.info;
const { statusMsg = "" } = itemInfo || {}; const { statusMsg = "" } = itemInfo || {};
const uploadInfoStore = toJS(useGlobalStore("fileListStore")); const uploadInfoStore = toJS(useGlobalStore("fileListStore"));
const currentProjectStore = toJS(useGlobalStore("currentProjectStore"));
const Message = useMessage(); const Message = useMessage();
const navigate = useNavigate(); const navigate = useNavigate();
...@@ -98,17 +99,26 @@ const FileItem = observer((props: IProps) => { ...@@ -98,17 +99,26 @@ const FileItem = observer((props: IProps) => {
</span> </span>
)} )}
</div> </div>
<LinearProgress {statusMsg !== "上传成功" ? (
sx={{ width: 300, borderRadius: 2, margin: "6px 0", color: "red" }} <LinearProgress
variant="determinate" sx={{
value={itemInfo?.percentage} width: 300,
/> borderRadius: 2,
margin: "6px 0",
color: "red",
}}
variant="determinate"
value={itemInfo?.percentage}
/>
) : null}
<div style={{ fontSize: 12 }}> <div style={{ fontSize: 12 }}>
{statusMsg === "上传成功" ? ( {statusMsg === "上传成功" ? (
<> <>
<span style={{ color: "#8A9099" }}>已上传至</span> <span style={{ color: "#8A9099" }}>已上传至</span>
<span style={{ color: "#565C66", marginLeft: 12 }}> <span style={{ color: "#565C66", marginLeft: 12 }}>
{fileItemInfo?.path} {`CADD - ${
currentProjectStore?.currentProjectInfo?.name || ""
}`}
</span> </span>
</> </>
) : ( ) : (
......
...@@ -138,7 +138,9 @@ const MoveFile = (props: any) => { ...@@ -138,7 +138,9 @@ const MoveFile = (props: any) => {
foldersMove(folderMoveList); foldersMove(folderMoveList);
} }
if (fileMoveList.length > 0) { if (fileMoveList.length > 0) {
filesMove(fileMoveList); filesMove(fileMoveList)?.then((res) => {
successMove();
});
} }
} else { } else {
if (currentOperateFile.type === "dataSet") { if (currentOperateFile.type === "dataSet") {
...@@ -146,7 +148,9 @@ const MoveFile = (props: any) => { ...@@ -146,7 +148,9 @@ const MoveFile = (props: any) => {
} else if (currentOperateFile.type === "directory") { } else if (currentOperateFile.type === "directory") {
folerMove(); folerMove();
} else { } else {
fileMove(); fileMove()?.then((res) => {
successMove();
});
} }
} }
} }
...@@ -155,15 +159,13 @@ const MoveFile = (props: any) => { ...@@ -155,15 +159,13 @@ const MoveFile = (props: any) => {
// 单文件移动 // 单文件移动
const fileMove = () => { const fileMove = () => {
const oldPathToFileServer = `${oldPathProvidedToFileServer}${currentOperateFile.name}`; const oldPathToFileServer = `${oldPathProvidedToFileServer}${currentOperateFile.name}`;
CloudEController.JobFileMove( return CloudEController.JobFileMove(
newPath, newPath,
oldPathToFileServer, oldPathToFileServer,
"", "",
fileToken, fileToken,
projectId projectId
)?.then((res) => { );
successMove();
});
}; };
// 多文件移动 // 多文件移动
...@@ -171,22 +173,28 @@ const MoveFile = (props: any) => { ...@@ -171,22 +173,28 @@ const MoveFile = (props: any) => {
const oldPaths = fileMoveList.map((item: any) => { const oldPaths = fileMoveList.map((item: any) => {
return `${oldPathProvidedToFileServer}${item.name}`; return `${oldPathProvidedToFileServer}${item.name}`;
}); });
CloudEController.JobFileBatchMove( return CloudEController.JobFileBatchMove(
newPath, newPath,
oldPaths, oldPaths,
"", "",
fileToken, fileToken,
projectId projectId
)?.then((res) => { );
successMove();
});
}; };
// 单文件夹移动 // 单文件夹移动
const folerMove = () => { const folerMove = () => {
fileMove(); fileMove()
const names = currentOperateFile.name; ?.then((res) => {
dataSetInFolerMove(names); 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) => { ...@@ -201,9 +209,17 @@ const MoveFile = (props: any) => {
// 多文件夹移动 // 多文件夹移动
const foldersMove = (folderMoveList: Array<any>) => { const foldersMove = (folderMoveList: Array<any>) => {
filesMove(folderMoveList); filesMove(folderMoveList)
const names = folderMoveList.map((item: any) => item.name).join(","); ?.then((res) => {
dataSetInFolerMove(names); 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(() => { ...@@ -88,13 +88,22 @@ const ProjectData = observer(() => {
useEffect(() => { useEffect(() => {
const locationInfo: any = location?.state; const locationInfo: any = location?.state;
setPath(locationInfo?.pathName || ""); setPath(locationInfo?.pathName || "");
handleRefresh();
}, [location]); }, [location]);
// 列表展示的数据 // 列表展示的数据
const showList = useMemo(() => { const showList = useMemo(() => {
if (activeTab === 1) { 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 { } else {
const folderList = list.filter((item: any) => { const folderList = list.filter((item: any) => {
return item.type === "directory"; return item.type === "directory";
......
...@@ -50,6 +50,7 @@ const BaseInfo = observer(() => { ...@@ -50,6 +50,7 @@ const BaseInfo = observer(() => {
const currentUserName = JSON.parse( const currentUserName = JSON.parse(
localStorage.getItem("userInfo") || "{}" localStorage.getItem("userInfo") || "{}"
).name; ).name;
// 是否拥有编辑权限
const hasEditAuth = useMemo(() => { const hasEditAuth = useMemo(() => {
if (!currentUserName) { if (!currentUserName) {
return false; return false;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13 * @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @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 * @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -65,7 +65,7 @@ const ProjectMembers = observer(() => { ...@@ -65,7 +65,7 @@ const ProjectMembers = observer(() => {
label: "操作", label: "操作",
width: 160, width: 160,
render: (item: any, row: any) => { render: (item: any, row: any) => {
return item.projectRole === "OWNER" ? null : ( return item?.projectRole === "OWNER" ? null : (
<> <>
<span <span
style={{ color: "#1370FF", cursor: "pointer" }} 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