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
sunyihao
bkunyun
Commits
88289aac
Commit
88289aac
authored
Jun 14, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 除下载外联调完成
parent
c5517fd8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
207 additions
and
40 deletions
+207
-40
api_manager.ts
src/api/api_manager.ts
+6
-3
project_api.ts
src/api/project_api.ts
+72
-0
Table.jsx
src/components/Material.Ui/Table.jsx
+12
-0
index.module.css
src/views/Project/ProjectData/MoveFile/index.module.css
+3
-0
index.tsx
src/views/Project/ProjectData/MoveFile/index.tsx
+114
-37
index.tsx
src/views/Project/ProjectData/index.tsx
+0
-0
No files found.
src/api/api_manager.ts
View file @
88289aac
...
...
@@ -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
;
src/api/project_api.ts
View file @
88289aac
...
...
@@ -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
,
};
src/components/Material.Ui/Table.jsx
View file @
88289aac
...
...
@@ -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
])
...
...
src/views/Project/ProjectData/MoveFile/index.module.css
View file @
88289aac
...
...
@@ -10,6 +10,9 @@
justify-content
:
flex-start
;
align-items
:
center
;
}
.rootTitleActive
{
background-color
:
rgba
(
25
,
118
,
210
,
0.2
);
}
.bigFolderIcon
{
margin
:
0
9px
;
}
...
...
src/views/Project/ProjectData/MoveFile/index.tsx
View file @
88289aac
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
>
...
...
src/views/Project/ProjectData/index.tsx
View file @
88289aac
This diff is collapsed.
Click to expand it.
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