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
9bbf7fae
Commit
9bbf7fae
authored
Jun 16, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-20220608-projectdata' into 'release'
Feat 20220608 projectdata See merge request
!43
parents
b053f4c5
3cb7850c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
433 additions
and
291 deletions
+433
-291
api_manager.ts
src/api/api_manager.ts
+7
-5
transformParams.ts
src/api/fileserver/transformParams.ts
+3
-0
project_api.ts
src/api/project_api.ts
+39
-2
util.ts
src/utils/util.ts
+4
-4
index.tsx
src/views/Project/ProjectData/DeleteDialog/index.tsx
+183
-0
index.tsx
src/views/Project/ProjectData/MoveFile/index.tsx
+160
-89
index.tsx
src/views/Project/ProjectData/UpLoaderFile/index.tsx
+6
-1
index.tsx
src/views/Project/ProjectData/index.tsx
+25
-187
index.tsx
src/views/Project/ProjectSetting/BaseInfo/index.tsx
+1
-0
AddMember.tsx
...ct/ProjectSetting/ProjectMembers/components/AddMember.tsx
+5
-3
No files found.
src/api/api_manager.ts
View file @
9bbf7fae
...
...
@@ -21,12 +21,14 @@ const RESTAPI = {
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_MOVE_PACKAGE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/move/package`
,
//移动文件夹中的数据集
API_DATA_DEL
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/del`
,
//删除项目中的数据集
API_DATA_DEL_PACKAGE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/del/package`
,
//删除文件夹中的数据集
API_USER_PERMISSION_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/uaa/routes/privilege/list`
,
//获取用户包含的权限列表
API_WORKBENCH_TEMPLATE_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//查询项目下工作流模板列表
API_WORKBENCH_DELETE_TEMPLATE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//项目管理员-删除工作流模板
API_WORKBENCH_ADD_TEMPLATE_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/product/workflowspec`
,
//项目管理员-添加工作流模板-模板列表
API_WORKBENCH_ADD_TEMPLATE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//项目管理员-添加工作流模板-提交
}
API_WORKBENCH_TEMPLATE_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//查询项目下工作流模板列表
API_WORKBENCH_DELETE_TEMPLATE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//项目管理员-删除工作流模板
API_WORKBENCH_ADD_TEMPLATE_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/product/workflowspec`
,
//项目管理员-添加工作流模板-模板列表
API_WORKBENCH_ADD_TEMPLATE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//项目管理员-添加工作流模板-提交
}
;
export
default
RESTAPI
;
src/api/fileserver/transformParams.ts
0 → 100644
View file @
9bbf7fae
export
const
a
=
()
=>
{
return
"a"
;
};
src/api/project_api.ts
View file @
9bbf7fae
...
...
@@ -135,7 +135,6 @@ type getDataFileMoveParams = {
dpath
?:
string
;
// 目标路径
};
// Content-Type application/x-www-form-urlencoded
// 移动到
const
getDataFileMove
=
(
params
:
getDataFileMoveParams
)
=>
{
return
request
({
...
...
@@ -148,13 +147,31 @@ const getDataFileMove = (params: getDataFileMoveParams) => {
});
};
type
getDataFileMovePackageParams
=
{
projectId
:
string
;
names
:
string
;
// 包名
spath
?:
string
;
// 原路径
dpath
?:
string
;
// 目标路径
};
// 移动文件夹中的数据集
const
getDataFileMovePackage
=
(
params
:
getDataFileMovePackageParams
)
=>
{
return
request
({
url
:
Api
.
API_DATA_MOVE_PACKAGE
,
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
({
...
...
@@ -167,6 +184,24 @@ const getDataFileDel = (params: getDataFileDelParams) => {
});
};
type
getDataFileDelPackageParams
=
{
projectId
:
string
;
names
:
string
;
path
?:
string
;
};
// 删除项目中的数据集
const
getDataFileDelPackage
=
(
params
:
getDataFileDelPackageParams
)
=>
{
return
request
({
url
:
Api
.
API_DATA_DEL_PACKAGE
,
method
:
"delete"
,
params
,
headers
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
},
});
};
export
{
current
,
menu
,
...
...
@@ -180,5 +215,7 @@ export {
getDataFind
,
getDataFileSearch
,
getDataFileMove
,
getDataFileMovePackage
,
getDataFileDel
,
getDataFileDelPackage
,
};
src/utils/util.ts
View file @
9bbf7fae
...
...
@@ -33,14 +33,14 @@ export const uuid = () => {
* params: item: 毫秒的时间戳
*/
export
const
formatTime
=
(
time
:
number
)
=>
{
const
newTime
=
Math
.
floor
(
time
/
1000
)
;
const
newTime
=
Math
.
floor
(
time
/
1000
)
;
const
hours
=
Math
.
floor
(
newTime
/
3600
);
const
minutes
=
Math
.
floor
((
newTime
%
3600
)
/
60
);
const
seconds
=
newTime
%
60
;
const
hoursString
=
hours
?
`
${
hours
}
小时`
:
''
;
const
minutesString
=
minutes
?
`
${
minutes
}
分钟`
:
''
;
const
secondsString
=
seconds
?
`
${
seconds
}
秒`
:
''
;
const
hoursString
=
hours
?
`
${
hours
}
小时`
:
""
;
const
minutesString
=
minutes
?
`
${
minutes
}
分钟`
:
""
;
const
secondsString
=
seconds
?
`
${
seconds
}
秒`
:
""
;
return
`
${
hoursString
}${
minutesString
}${
secondsString
}
`
;
};
...
...
src/views/Project/ProjectData/DeleteDialog/index.tsx
0 → 100644
View file @
9bbf7fae
import
React
,
{
useState
,
useImperativeHandle
,
useMemo
}
from
"react"
;
import
MyDialog
from
"@/components/mui/MyDialog"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
CloudEController
from
"@/api/fileserver/CloudEController"
;
import
{
getDataFileDel
,
getDataFileDelPackage
}
from
"@/api/project_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
const
DeleteDialog
=
(
props
:
any
)
=>
{
const
{
path
,
projectId
,
fileToken
,
currentOperateFile
,
selectIds
,
refresh
,
showList
,
}
=
props
;
const
Message
=
useMessage
();
let
deleteFileDialogRef
:
any
=
React
.
createRef
();
const
showDialog
=
()
=>
{
deleteFileDialogRef
.
current
.
handleClickOpen
();
};
useImperativeHandle
(
props
.
onRef
,
()
=>
{
return
{
showDialog
:
showDialog
,
};
});
const
{
run
:
getDataFileDelRun
}
=
useMyRequest
(
getDataFileDel
,
{
onSuccess
:
(
res
:
any
)
=>
{
successDelete
();
},
});
const
{
run
:
getDataFileDelPackageRun
}
=
useMyRequest
(
getDataFileDelPackage
,
{
onSuccess
:
(
res
:
any
)
=>
{
successDelete
();
},
}
);
const
successDelete
=
()
=>
{
Message
.
success
(
"删除成功!"
);
deleteFileDialogRef
?.
current
?.
handleClose
();
refresh
();
};
const
deletePathProvidedToDataSet
=
useMemo
(()
=>
{
return
path
===
"/"
?
"/"
:
`
${
path
}
/`
;
},
[
path
]);
const
deletePathProvidedFileServer
=
useMemo
(()
=>
{
return
path
===
"/"
?
`
${
path
}
`
:
`
${
path
}
/`
;
},
[
path
]);
// 删除
const
handleSubmit
=
()
=>
{
if
(
!
currentOperateFile
)
{
// 批量删除
// 要删除的数据集
const
datSetDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"dataSet"
;
});
// 要删除的文件夹
const
folderDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"directory"
;
});
// 要删除的文件
const
fileDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
(
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
!==
"dataSet"
&&
item
.
type
!==
"directory"
);
});
if
(
datSetDeleteList
.
length
>
0
)
{
dataSetsDelete
(
datSetDeleteList
);
}
if
(
folderDeleteList
.
length
>
0
)
{
foldersDelete
(
folderDeleteList
);
}
if
(
fileDeleteList
.
length
>
0
)
{
filesDelete
(
fileDeleteList
);
}
}
else
{
if
(
currentOperateFile
.
type
===
"dataSet"
)
{
dataSetDelete
();
}
else
if
(
currentOperateFile
.
type
===
"directory"
)
{
folerDelete
();
}
else
{
fileDelete
();
}
}
};
// 删除单个数据集
const
dataSetDelete
=
()
=>
{
getDataFileDelRun
({
projectId
:
projectId
as
string
,
names
:
currentOperateFile
.
name
,
path
:
deletePathProvidedToDataSet
,
});
};
// 删除单个文件夹
const
folerDelete
=
()
=>
{
fileDelete
();
const
names
=
currentOperateFile
.
name
;
dataSetInFolerDelete
(
names
);
};
// 删除文件夹中的数据集
const
dataSetInFolerDelete
=
(
names
:
string
)
=>
{
getDataFileDelPackageRun
({
projectId
:
projectId
as
string
,
names
,
path
:
deletePathProvidedToDataSet
,
});
};
// 删除单个文件
const
fileDelete
=
()
=>
{
CloudEController
.
JobOutFileDel
(
`
${
deletePathProvidedFileServer
}${
currentOperateFile
.
name
}
`
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
successDelete
();
});
};
// 删除多个数据集
const
dataSetsDelete
=
(
datSetDeleteList
:
Array
<
any
>
)
=>
{
getDataFileDelRun
({
projectId
:
projectId
as
string
,
names
:
datSetDeleteList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
),
path
:
deletePathProvidedToDataSet
,
});
};
// 删除多个文件夹
const
foldersDelete
=
(
folderDeleteList
:
Array
<
any
>
)
=>
{
filesDelete
(
folderDeleteList
);
const
names
=
folderDeleteList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
);
dataSetInFolerDelete
(
names
);
};
// 删除多个文件
const
filesDelete
=
(
fileDeleteList
:
Array
<
any
>
)
=>
{
const
deletePath
=
fileDeleteList
.
map
((
item
:
any
)
=>
{
return
`
${
deletePathProvidedFileServer
}${
item
.
name
}
`
;
})
.
join
(
" "
);
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
successDelete
();
});
};
const
submitloading
=
false
;
return
(
<
MyDialog
handleSubmit=
{
handleSubmit
}
onRef=
{
deleteFileDialogRef
}
title=
"提示"
submitloading=
{
submitloading
}
>
{
currentOperateFile
?
"确认删除该数据吗?"
:
`确认删除这${selectIds.length}条数据吗?`
}
</
MyDialog
>
);
};
export
default
DeleteDialog
;
src/views/Project/ProjectData/MoveFile/index.tsx
View file @
9bbf7fae
import
React
,
{
useState
,
useImperativeHandle
,
useCallback
}
from
"react"
;
import
React
,
{
useState
,
useImperativeHandle
,
useCallback
,
useMemo
,
}
from
"react"
;
import
style
from
"./index.module.css"
;
import
MyDialog
from
"@/components/mui/MyDialog"
;
...
...
@@ -7,7 +12,7 @@ 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
{
getDataFileMove
,
getDataFileMovePackage
}
from
"@/api/project_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
classNames
from
"classnames"
;
...
...
@@ -19,17 +24,24 @@ const MoveFile = (props: any) => {
currentOperateFile
,
selectIds
,
refresh
,
activeTab
,
showList
,
}
=
props
;
const
Message
=
useMessage
();
const
{
run
:
getDataFileMoveRun
}
=
useMyRequest
(
getDataFileMove
,
{
onSuccess
:
(
res
:
any
)
=>
{
Message
.
success
(
"移动成功!"
);
moveFileDialogRef
.
current
.
handleClose
();
refresh
();
successMove
();
},
});
const
{
run
:
getDataFileMovePackageRun
}
=
useMyRequest
(
getDataFileMovePackage
,
{
onSuccess
:
(
res
:
any
)
=>
{
successMove
();
},
}
);
const
[
newPath
,
setNewPath
]
=
useState
(
"/"
);
const
[
rootActive
,
setRootActive
]
=
useState
(
true
);
...
...
@@ -65,97 +77,155 @@ const MoveFile = (props: any) => {
};
});
// 提供给fileserver相关接口的newpath 直接用newPath就可以了
// const newPathProvidedToFileServer = useMemo(() => {
// return newPath
// }, [newPath])
// 提供给数据集相关接口的newpath
const
newPathProvidedToDataSet
=
useMemo
(()
=>
{
return
newPath
===
"/"
?
"/"
:
`
${
newPath
}
/`
;
},
[
newPath
]);
// 提供给fileserver相关接口的oldpath
const
oldPathProvidedToFileServer
=
useMemo
(()
=>
{
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}
`
;
},
[
path
]);
// 提供给数据集相关接口的oldpath
const
oldPathProvidedToDataSet
=
useMemo
(()
=>
{
return
path
===
"/"
?
"/"
:
`
${
path
}
/`
;
},
[
path
]);
// 移动成功后的操作
const
successMove
=
()
=>
{
Message
.
success
(
"移动成功!"
);
moveFileDialogRef
?.
current
?.
handleClose
();
refresh
();
};
// 移动
const
handleMoveFileSubmit
=
()
=>
{
if
(
newPath
)
{
if
(
!
newPath
)
{
Message
.
error
(
"请选择移动到哪个目录"
);
}
else
if
(
newPath
===
path
)
{
Message
.
error
(
"指定的目标路径为数据原路径,无需移动。"
);
}
else
{
if
(
!
currentOperateFile
)
{
// 批量移动
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
();
});
}
// 要移动的数据集
const
datSetMoveList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"dataSet"
;
});
// 要移动的文件夹
const
folderMoveList
=
showList
.
filter
((
item
:
any
)
=>
{
return
(
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"directory"
);
});
// 要移动的文件
const
fileMoveList
=
showList
.
filter
((
item
:
any
)
=>
{
return
(
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
!==
"dataSet"
&&
item
.
type
!==
"directory"
);
});
if
(
datSetMoveList
.
length
>
0
)
{
dataSetsMove
(
datSetMoveList
);
}
if
(
folderMoveList
.
length
>
0
)
{
foldersMove
(
folderMoveList
);
}
if
(
fileMoveList
.
length
>
0
)
{
filesMove
(
fileMoveList
);
}
}
else
{
if
(
currentOperateFile
.
type
===
"dataSet"
)
{
const
oldPaths
=
`
${
path
}${
path
===
"/"
?
""
:
"/"
}
`
;
getDataFileMoveRun
({
projectId
:
projectId
as
string
,
names
:
currentOperateFile
.
name
,
spath
:
oldPaths
,
dpath
:
newPath
===
"/"
?
"/"
:
`
${
newPath
}
/`
,
});
dataSetMove
();
}
else
if
(
currentOperateFile
.
type
===
"directory"
)
{
folerMove
();
}
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
();
refresh
();
});
fileMove
();
}
}
}
else
{
Message
.
error
(
"请选择移动到哪个目录"
);
}
};
// 单文件移动
const
fileMove
=
()
=>
{
const
oldPathToFileServer
=
`
${
oldPathProvidedToFileServer
}${
currentOperateFile
.
name
}
`
;
CloudEController
.
JobFileMove
(
newPath
,
oldPathToFileServer
,
""
,
fileToken
,
projectId
)?.
then
((
res
)
=>
{
successMove
();
});
};
// 多文件移动
const
filesMove
=
(
fileMoveList
:
Array
<
any
>
)
=>
{
const
oldPaths
=
fileMoveList
.
map
((
item
:
any
)
=>
{
return
`
${
oldPathProvidedToFileServer
}${
item
.
name
}
`
;
});
CloudEController
.
JobFileBatchMove
(
newPath
,
oldPaths
,
""
,
fileToken
,
projectId
)?.
then
((
res
)
=>
{
successMove
();
});
};
// 单文件夹移动
const
folerMove
=
()
=>
{
fileMove
();
const
names
=
currentOperateFile
.
name
;
dataSetInFolerMove
(
names
);
};
// 移动文件夹中的数据集
const
dataSetInFolerMove
=
(
names
:
string
)
=>
{
getDataFileMovePackageRun
({
projectId
:
projectId
as
string
,
names
,
spath
:
oldPathProvidedToDataSet
,
dpath
:
newPathProvidedToDataSet
,
});
};
// 多文件夹移动
const
foldersMove
=
(
folderMoveList
:
Array
<
any
>
)
=>
{
filesMove
(
folderMoveList
);
const
names
=
folderMoveList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
);
dataSetInFolerMove
(
names
);
};
// 单数据集移动
const
dataSetMove
=
()
=>
{
getDataFileMoveRun
({
projectId
:
projectId
as
string
,
names
:
currentOperateFile
.
name
,
spath
:
oldPathProvidedToDataSet
,
dpath
:
newPathProvidedToDataSet
,
});
};
// 多数据集移动
const
dataSetsMove
=
(
datSetMoveList
:
Array
<
any
>
)
=>
{
getDataFileMoveRun
({
projectId
:
projectId
as
string
,
names
:
datSetMoveList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
),
spath
:
oldPathProvidedToFileServer
,
dpath
:
newPath
===
"/"
?
"/"
:
`
${
newPath
}
/`
,
});
};
const
renderLabel
=
(
labelNmae
:
string
)
=>
{
return
(
<
span
className=
{
style
.
treeLabel
}
>
...
...
@@ -170,6 +240,11 @@ const MoveFile = (props: any) => {
setRootActive
(
false
);
};
// 给路径去掉第一个'/'然后结尾加上文件名 方便后面直接使用
const
idFunc
=
(
item
:
any
)
=>
{
return
`
${
item
.
dir
.
substr
(
1
)}${
item
.
name
}
`
;
};
const
handleRoot
=
()
=>
{
setNewPath
(
"/"
);
setRootActive
(
true
);
...
...
@@ -177,10 +252,6 @@ const MoveFile = (props: any) => {
const
moveFileSubmitloading
=
false
;
const
idFunc
=
(
item
:
any
)
=>
{
return
`
${
item
.
dir
.
substr
(
1
)}${
item
.
name
}
`
;
};
return
(
<
MyDialog
handleSubmit=
{
handleMoveFileSubmit
}
...
...
src/views/Project/ProjectData/UpLoaderFile/index.tsx
View file @
9bbf7fae
...
...
@@ -67,7 +67,6 @@ const UpLoaderFile = observer((props: any) => {
};
const
repeatAndUploaderFileList
=
getRepeatFileAndGetUploderFileList
(
acceptedFiles
);
console
.
log
(
repeatAndUploaderFileList
);
if
(
repeatAndUploaderFileList
.
repeatFileList
.
length
>
0
)
{
message
.
error
(
`“
${
repeatAndUploaderFileList
.
repeatFileList
...
...
@@ -78,6 +77,12 @@ const UpLoaderFile = observer((props: any) => {
// 插入新的文件列表
const
popLength
=
10
-
fileList
.
length
;
if
(
fileList
.
length
+
repeatAndUploaderFileList
.
uploderFileList
.
length
>
10
)
{
message
.
error
(
"最大支持同时上传10个文件"
);
}
let
newFileList
=
[
...
repeatAndUploaderFileList
.
uploderFileList
.
slice
(
0
,
popLength
),
...
fileList
,
...
...
src/views/Project/ProjectData/index.tsx
View file @
9bbf7fae
...
...
@@ -3,7 +3,6 @@ import React, { useState, useCallback, useEffect, useMemo } from "react";
import
style
from
"./index.module.css"
;
import
classnames
from
"classnames"
;
import
{
Button
,
InputBase
,
IconButton
}
from
"@mui/material"
;
import
LoadingButton
from
"@mui/lab/LoadingButton"
;
import
{
createTheme
,
ThemeProvider
}
from
"@mui/material/styles"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
RefreshIcon
from
"@mui/icons-material/Refresh"
;
...
...
@@ -12,9 +11,9 @@ import dataSetIcon from "@/assets/project/dataSetIcon.svg";
import
fileIcon
from
"@/assets/project/fileIcon.svg"
;
import
folderIcon
from
"@/assets/project/folderIcon.svg"
;
import
noFile
from
"@/assets/project/noFile.svg"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
AddFolder
from
"./AddFolder"
;
import
MoveFile
from
"./MoveFile"
;
import
DeleteDialog
from
"./DeleteDialog"
;
import
UpLoaderFile
from
"./UpLoaderFile"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
observer
}
from
"mobx-react-lite"
;
...
...
@@ -22,20 +21,11 @@ import { useStores } from "@/store";
import
CloudEController
from
"@/api/fileserver/CloudEController"
;
import
{
toJS
}
from
"mobx"
;
import
moment
from
"moment"
;
import
Dialog
from
"@mui/material/Dialog"
;
import
DialogActions
from
"@mui/material/DialogActions"
;
import
DialogContent
from
"@mui/material/DialogContent"
;
import
DialogContentText
from
"@mui/material/DialogContentText"
;
import
DialogTitle
from
"@mui/material/DialogTitle"
;
import
NoProject
from
"@/components/NoProject"
;
import
usePass
from
"@/hooks/usePass"
;
import
{
storageUnitFromB
}
from
"@/utils/util"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
{
getDataFind
,
getDataFileSearch
,
getDataFileDel
,
}
from
"@/api/project_api"
;
import
{
getDataFind
,
getDataFileSearch
}
from
"@/api/project_api"
;
const
theme
=
createTheme
({
palette
:
{
...
...
@@ -63,18 +53,11 @@ declare module "@mui/material/Button" {
const
ProjectData
=
observer
(()
=>
{
const
isPass
=
usePass
();
const
Message
=
useMessage
();
const
{
currentProjectStore
}
=
useStores
();
// const [fileToken, setFileToken] = useState("");
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
// const projectId = useMemo(() => {
// console.log(
// toJS(currentProjectStore.currentProjectInfo.id),
// "toJS(currentProjectStore.currentProjectInfo.id)"
// );
// return toJS(currentProjectStore.currentProjectInfo.id);
// }, [currentProjectStore]);
console
.
log
(
fileToken
);
console
.
log
(
projectId
);
/** 路由信息 */
const
location
=
useLocation
();
// 当前文件路径
...
...
@@ -82,10 +65,8 @@ const ProjectData = observer(() => {
const
[
tableLoadding
,
setTableLoadding
]
=
useState
(
false
);
// 防止用户连续点击文件夹造成路径显示错误
const
[
debounce
,
setDebounce
]
=
useState
(
false
);
const
[
deleteDialogOpen
,
setDeleteDialogOpen
]
=
useState
(
false
);
// 点击操作列中的按钮 会设置当前点击的文件
const
[
currentOperateFile
,
setCurrentOperateFile
]
=
useState
<
any
>
(
null
);
const
[
deleteloading
,
setDeleteloading
]
=
useState
(
false
);
// 1文件 2数据集
const
[
activeTab
,
setActiveTab
]
=
useState
(
1
);
// 复选框选中的文件名称数组
...
...
@@ -128,13 +109,6 @@ const ProjectData = observer(() => {
return
[...
list
,
...
dataSetList
];
},
[
list
,
dataSetList
]);
// 获取文件token
// const { run: getDataFileTokenRun } = useMyRequest(getDataFileToken, {
// onSuccess: (res: any) => {
// setFileToken(res.data);
// },
// });
// 全局搜索数据集
const
{
run
:
getDataFileSearchRun
}
=
useMyRequest
(
getDataFileSearch
,
{
onSuccess
:
(
res
:
any
)
=>
{
...
...
@@ -169,9 +143,9 @@ const ProjectData = observer(() => {
// 获取某路径下的数据集
const
getDataSetList
=
useCallback
(()
=>
{
if
(
keyWord
&&
projectId
)
{
if
(
keyWord
)
{
return
;
}
else
{
}
else
if
(
projectId
)
{
return
getDataFindRun
({
projectId
:
projectId
as
string
,
path
:
path
===
"/"
?
"/"
:
`
${
path
}
/`
,
...
...
@@ -265,13 +239,6 @@ const ProjectData = observer(() => {
}
};
// 项目切换时重新获取文件token
// useEffect(() => {
// getDataFileTokenRun({
// id: currentProjectStore.currentProjectInfo.id as string,
// });
// }, [getDataFileTokenRun, currentProjectStore]);
// 搜索值改变
const
handleKeyWordChange
=
(
e
:
any
)
=>
{
if
(
e
.
target
.
value
.
length
>
30
)
{
...
...
@@ -327,12 +294,6 @@ const ProjectData = observer(() => {
}
};
// 显示删除确认框
const
hanleDeleteFile
=
(
item
:
any
)
=>
{
setCurrentOperateFile
(
item
);
setDeleteDialogOpen
(
true
);
};
// table配置
const
renderName
=
(
item
:
any
)
=>
{
if
(
item
.
type
===
"directory"
)
{
...
...
@@ -423,7 +384,7 @@ const ProjectData = observer(() => {
variant=
"text"
size=
"small"
color=
"error"
onClick=
{
()
=>
hanle
DeleteFile
(
item
)
}
onClick=
{
()
=>
hanle
ShowDeleteDialogRef
(
item
)
}
disabled=
{
selectIds
.
length
>
0
||
!
isPass
(
"PROJECT_DATA_DELETE"
,
"USER"
)
}
...
...
@@ -455,109 +416,11 @@ const ProjectData = observer(() => {
moveFileRef
.
current
.
showDialog
();
};
// 删除文件
const
handleDeleteDialogClose
=
(
event
:
any
=
{},
reason
:
any
=
"other"
)
=>
{
// 点击弹窗外不关闭弹窗
if
(
reason
===
"backdropClick"
)
{
return
;
}
setDeleteDialogOpen
(
false
);
};
// 删除数据集请求
const
{
run
:
getDataFileDelRun
}
=
useMyRequest
(
getDataFileDel
,
{
onSuccess
:
(
res
:
any
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
},
});
// 删除流程判断待优化
const
handleDelete
=
()
=>
{
let
deletePath
=
""
;
if
(
currentOperateFile
)
{
deletePath
=
path
===
"/"
?
`
${
path
}${
currentOperateFile
.
name
}
`
:
`
${
path
}
/
${
currentOperateFile
.
name
}
`
;
}
else
{
deletePath
=
selectIds
.
map
((
name
:
any
)
=>
{
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
name
}
`
;
})
.
join
(
" "
);
}
if
(
activeTab
===
2
)
{
deletePath
=
path
===
"/"
?
"/"
:
`
${
path
}
/`
;
if
(
currentOperateFile
)
{
if
(
currentOperateFile
.
type
===
"dataSet"
)
{
getDataFileDelRun
({
projectId
:
projectId
as
string
,
names
:
currentOperateFile
.
name
,
path
:
deletePath
,
});
}
else
{
deletePath
=
path
===
"/"
?
`
${
path
}${
currentOperateFile
.
name
}
`
:
`
${
path
}
/
${
currentOperateFile
.
name
}
`
;
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
}
}
else
{
const
datSetDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"dataSet"
;
});
const
otherDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
!==
"dataSet"
;
});
if
(
datSetDeleteList
.
length
>
0
)
{
getDataFileDelRun
({
projectId
:
projectId
as
string
,
names
:
datSetDeleteList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
),
path
:
deletePath
,
});
}
if
(
otherDeleteList
.
length
>
0
)
{
deletePath
=
otherDeleteList
.
map
((
item
:
any
)
=>
{
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
item
.
name
}
`
;
})
.
join
(
" "
);
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
}
}
}
else
{
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
as
string
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
}
// 删除弹窗
let
deleteDialogRef
:
any
=
React
.
createRef
();
const
hanleShowDeleteDialogRef
=
(
item
:
any
)
=>
{
setCurrentOperateFile
(
item
);
deleteDialogRef
.
current
.
showDialog
();
};
// 批量移动
...
...
@@ -569,7 +432,7 @@ const ProjectData = observer(() => {
// 批量删除
const
handleBatchDelete
=
()
=>
{
setCurrentOperateFile
(
null
);
setDeleteDialogOpen
(
true
);
deleteDialogRef
.
current
.
showDialog
(
);
};
// 前端展示的文件路径
...
...
@@ -692,7 +555,7 @@ const ProjectData = observer(() => {
aria
-
label=
"search"
size=
"small"
style=
{
{
padding
:
"4px"
}
}
onClick=
{
searchFileList
}
onClick=
{
handleRefresh
}
>
<
SearchIcon
className=
{
style
.
searchIcon
}
...
...
@@ -746,6 +609,7 @@ const ProjectData = observer(() => {
load=
{
tableLoadding
}
initSelected=
{
selectIds
}
headCells=
{
versionsHeadCells
}
rowsPerPage=
{
"99"
}
checkboxData=
{
(
e
:
any
)
=>
{
hanldeCheckbox
(
e
);
}
}
...
...
@@ -789,41 +653,16 @@ const ProjectData = observer(() => {
</
Button
>
</
div
>
)
}
<
Dialog
open=
{
deleteDialogOpen
}
onClose=
{
handleDeleteDialogClose
}
aria
-
labelledby=
"提示"
aria
-
describedby=
"确认要删除吗"
>
<
DialogTitle
id=
"alert-dialog-title"
>
{
"提示"
}
</
DialogTitle
>
<
DialogContent
>
<
DialogContentText
id=
"alert-dialog-description"
>
{
currentOperateFile
?
"确认删除该数据吗?"
:
`确认删除这${selectIds.length}条数据吗?`
}
</
DialogContentText
>
</
DialogContent
>
<
DialogActions
>
<
Button
onClick=
{
handleDeleteDialogClose
}
color=
"inherit"
variant=
"contained"
style=
{
{
color
:
"#1E2633"
,
backgroundColor
:
"#fff"
}
}
size=
"small"
>
取消
</
Button
>
<
LoadingButton
loading=
{
deleteloading
}
onClick=
{
handleDelete
}
color=
"primary"
variant=
"contained"
size=
"small"
>
确认
</
LoadingButton
>
</
DialogActions
>
</
Dialog
>
<
DeleteDialog
onRef=
{
deleteDialogRef
}
path=
{
path
}
fileToken=
{
fileToken
}
projectId=
{
projectId
}
currentOperateFile=
{
currentOperateFile
}
selectIds=
{
selectIds
}
refresh=
{
handleRefresh
}
showList=
{
showList
}
></
DeleteDialog
>
<
UpLoaderFile
onRef=
{
UpLoaderFileRef
}
path=
{
path
}
...
...
@@ -845,7 +684,6 @@ const ProjectData = observer(() => {
currentOperateFile=
{
currentOperateFile
}
selectIds=
{
selectIds
}
refresh=
{
handleRefresh
}
activeTab=
{
activeTab
}
showList=
{
showList
}
></
MoveFile
>
</
div
>
...
...
src/views/Project/ProjectSetting/BaseInfo/index.tsx
View file @
9bbf7fae
...
...
@@ -212,6 +212,7 @@ const BaseInfo = observer(() => {
// 显示删除弹窗
const
handleClickDelete
=
()
=>
{
DialogRef
.
current
.
handleClickOpen
();
setDeleteProjectName
(
""
);
};
const
deleteProjectNameChange
=
(
e
:
any
)
=>
{
...
...
src/views/Project/ProjectSetting/ProjectMembers/components/AddMember.tsx
View file @
9bbf7fae
...
...
@@ -61,7 +61,6 @@ const AddMember = observer((props: IProps) => {
const
defaultValue
=
selectOptions
.
filter
(
(
every
)
=>
every
.
value
===
item
);
console
.
log
(
selectOptions
,
defaultValue
,
"111"
);
return
(
<
MySelect
input=
{
<
OutlinedInput
/>
}
...
...
@@ -122,13 +121,16 @@ const AddMember = observer((props: IProps) => {
}
);
}
, [currentProjectStore?.currentProjectInfo, http, addMemberDialog]);
const onClose = () =
>
{
const onClose = (event: any =
{}
, reason: any = "other") =
>
{
// 点击弹窗外不关闭弹窗
if
(
reason
===
"backdropClick"
)
{
return
;
}
setAddMemberDialog
(
false
);
}
;
const onConfirm = () =
>
{
const
projectInfo
=
toJS
(
currentProjectStore
?.
currentProjectInfo
);
console
.
log
(
tableData
,
1111
);
const
params
=
tableData
.
filter
((
item
:
any
)
=>
{
return
checkData
.
includes
(
item
?.
username
);
});
...
...
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