Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
f8d48b43
Commit
f8d48b43
authored
Jun 16, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 文件夹在文件前面显示 文件移动错误提示优化
parent
654a32de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
18 deletions
+43
-18
index.tsx
src/views/Project/ProjectData/MoveFile/index.tsx
+32
-16
index.tsx
src/views/Project/ProjectData/index.tsx
+11
-2
No files found.
src/views/Project/ProjectData/MoveFile/index.tsx
View file @
f8d48b43
...
...
@@ -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
(
"因目标路径存在同名文件,数据移动失败。"
);
}
});
};
// 单数据集移动
...
...
src/views/Project/ProjectData/index.tsx
View file @
f8d48b43
...
...
@@ -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"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment