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
6507ea38
Commit
6507ea38
authored
Aug 15, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-20220801' of
http://120.77.149.83/root/bkunyun
into feat-20220801
parents
3b42d192
eedd4ab0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
143 additions
and
35 deletions
+143
-35
api_manager.ts
src/api/api_manager.ts
+4
-2
project_api.ts
src/api/project_api.ts
+11
-1
index.tsx
src/views/Project/ProjectJobDetail/index.tsx
+58
-30
interface.ts
src/views/Project/ProjectJobDetail/interface.ts
+15
-0
utils.ts
src/views/Project/ProjectJobDetail/utils.ts
+53
-0
interface.ts
src/views/Project/ProjectSubmitWork/interface.ts
+2
-2
No files found.
src/api/api_manager.ts
View file @
6507ea38
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-13 09:56:57
* @LastEditors: 吴永生
#A02208 yongsheng.wu@wholion
.com
* @LastEditTime: 2022-0
7-10 13:47:53
* @LastEditors: 吴永生
15770852798@163
.com
* @LastEditTime: 2022-0
8-15 17:10:49
* @FilePath: /bkunyun/src/api/api_manager.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
BACKEND_API_URI_PREFIX
}
from
"./api_prefix"
;
import
{
APIOPTION
}
from
'./fileserver/raysyncApi'
const
RESTAPI
=
{
API_USER_FETCH
:
`
${
BACKEND_API_URI_PREFIX
}
/accounts/current`
,
//获取账户信息
...
...
@@ -31,6 +32,7 @@ const RESTAPI = {
API_WORKBENCH_ADD_TEMPLATE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowspec`
,
//项目管理员-添加工作流模板-提交
API_FETCH_TEMPLATE_INFO
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/workflowspec`
,
//点击使用模版查看模版详情
API_WORK_FLOW_JOB
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/workflowjob`
,
//点击任务列表查看任务详情
API_FLOW_OUTPUT_NUMBER
:
`
${
APIOPTION
()
}
/readstreamnum`
,
//任务列表查看流输出数据集数量
API_WORKBENCH_WORKFLOWJOB_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/project/workflowjob`
,
//查询工作流任务
API_WORKBENCH_DEL_WORKFLOWJOB
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/job/`
,
//删除工作流任务
API_WORKBENCH_CANCEL_WORKFLOWJOB
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/cancel`
,
//取消工作流
...
...
src/api/project_api.ts
View file @
6507ea38
...
...
@@ -221,6 +221,15 @@ const fetchWorkFlowJob = (params: { id: string }) => {
});
};
// 工作列表详情获取流输出数量
const
fetchFlowOutputNumber
=
(
params
:
any
)
=>
{
return
request
({
url
:
Api
.
API_FLOW_OUTPUT_NUMBER
,
method
:
"get"
,
params
});
};
type
submitWorkFlowParams
=
{
name
:
string
;
projectId
:
string
;
...
...
@@ -332,5 +341,6 @@ export {
getOverviewInfo
,
getTaskOverview
,
getOperatorList
,
saveBatchActor
saveBatchActor
,
fetchFlowOutputNumber
};
src/views/Project/ProjectJobDetail/index.tsx
View file @
6507ea38
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-08-1
1 17:13:52
* @LastEditTime: 2022-08-1
5 17:18:49
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -16,7 +16,11 @@ import IconButton from "@mui/material/IconButton";
import
MyButton
from
"@/components/mui/MyButton"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
fetchWorkFlowJob
,
getworkFlowTaskInfo
}
from
"@/api/project_api"
;
import
{
fetchWorkFlowJob
,
getworkFlowTaskInfo
,
fetchFlowOutputNumber
,
}
from
"@/api/project_api"
;
import
{
IResponse
}
from
"@/api/http"
;
import
jobSue
from
"@/assets/project/jobSue.svg"
;
import
jobStop
from
"@/assets/project/jobStop.svg"
;
...
...
@@ -37,6 +41,9 @@ import SeeDataset from "../ProjectData/SeeDataset";
import
{
getToken
,
storageUnitFromB
}
from
"@/utils/util"
;
import
LogView
from
"./LogView"
import
usePass
from
"@/hooks/usePass"
;
import
{
IFlowNodeTransmissionNum
}
from
"./interface"
;
import
{
getConnectionArr
,
getDatasetName
,
getDatasetPath
,
getSameBatch
}
from
"./utils"
;
import
styles
from
"./index.module.css"
;
const
stateMap
=
{
...
...
@@ -68,7 +75,8 @@ const ProjectSubmitWork = observer(() => {
const
[
activeFlowIndex
,
setActiveFlowIndex
]
=
useState
<
number
>
(
0
);
const
[
showOptions
,
setShowOptions
]
=
useState
<
boolean
>
(
false
);
const
[
randerOutputs1
,
setRanderOutputs
]
=
useState
<
Array
<
any
>>
([]);
const
location
:
any
=
useLocation
();
const
locationInfo
:
any
=
useLocation
()?.
state
;
// const locationInfo: any = location?.state;
const
navigate
=
useNavigate
();
const
message
=
useMessage
();
const
isPass
=
usePass
();
...
...
@@ -94,6 +102,8 @@ const ProjectSubmitWork = observer(() => {
getOutouts
(
res
.
data
.
outputs
);
getLogs
(
res
.
data
);
setWorkFlowJobInfo
(
res
.
data
);
const
newWorkflowId
=
locationInfo
?.
taskId
?.
replaceAll
(
'-'
,
''
)
getFlowNumber
({
projectId
,
workflowId
:
newWorkflowId
,
filetoken
:
fileToken
,
token
:
getToken
()})
},
});
...
...
@@ -108,12 +118,55 @@ const ProjectSubmitWork = observer(() => {
setLogs
(
logs
)
}
/** 更新流节点传输数据 */
const
updateFlowNodeEdgeLabel
=
useCallback
((
flowNodeInfo
:
IFlowNodeTransmissionNum
[])
=>
{
const
newTasks
=
workFlowJobInfo
&&
workFlowJobInfo
?.
tasks
?.
length
&&
workFlowJobInfo
?.
tasks
.
map
(
item
=>
{
if
(
getSameBatch
(
flowNodeInfo
,
item
)){
const
newEdges
=
item
?.
edges
?.
length
&&
item
.
edges
.
map
(
edgeItem
=>
{
const
connectionArr
=
getConnectionArr
(
flowNodeInfo
,
edgeItem
)
if
(
connectionArr
?.
length
){
return
{
...
edgeItem
,
label
:
String
(
connectionArr
[
0
]?.
value
)
}
}
else
{
return
edgeItem
}
})
return
{
...
item
,
edges
:
newEdges
||
[],
}
}
else
{
return
item
}
})
if
(
workFlowJobInfo
)
{
setWorkFlowJobInfo
({
...
workFlowJobInfo
,
tasks
:
newTasks
||
[]
})
}
},[
workFlowJobInfo
])
/** 获取流节点数据 */
const
{
run
:
getFlowNumber
}
=
useMyRequest
(
fetchFlowOutputNumber
,
{
pollingInterval
:
1000
*
20
,
pollingWhenHidden
:
false
,
onSuccess
:
(
res
:
IResponse
<
IFlowNodeTransmissionNum
[]
>
)
=>
{
if
(
res
?.
data
?.
length
){
updateFlowNodeEdgeLabel
(
res
.
data
)
}
},
});
useEffect
(()
=>
{
const
locationInfo
:
any
=
location
?.
state
;
run
({
id
:
locationInfo
.
taskId
,
});
},
[
location
?.
state
,
run
]);
},
[
location
Info
.
taskId
,
run
]);
const
{
run
:
getworkFlowTaskInfoRun
}
=
useMyRequest
(
getworkFlowTaskInfo
,
{
onSuccess
:
(
res
)
=>
{
...
...
@@ -144,30 +197,6 @@ const ProjectSubmitWork = observer(() => {
// return path;
// };
// 根据outputs的路径获取数据集的路径
const
getDatasetPath
=
(
path
:
string
)
=>
{
let
datasetPath
=
""
;
const
noProjectPath
=
path
.
slice
(
12
);
const
fileIndex
=
noProjectPath
.
indexOf
(
"/.dataset"
);
if
(
fileIndex
!==
-
1
)
{
datasetPath
=
noProjectPath
.
slice
(
0
,
fileIndex
);
}
else
{
datasetPath
=
noProjectPath
;
}
return
datasetPath
?
datasetPath
:
"/"
;
};
// 根据outputs的路径获取数据集的名称
const
getDatasetName
=
(
path
:
string
)
=>
{
let
name
=
""
;
let
nameIndex
=
path
.
indexOf
(
"/.dataset/"
)
+
10
;
const
lastIndex
=
path
.
lastIndexOf
(
"/"
);
if
(
nameIndex
!==
-
1
&&
lastIndex
!==
-
1
)
{
name
=
path
.
slice
(
nameIndex
,
lastIndex
);
}
return
name
;
};
// 下载任务结果
const
handleDownLoadOutput
=
(
item
:
any
)
=>
{
// 是文件下载
...
...
@@ -187,7 +216,6 @@ const ProjectSubmitWork = observer(() => {
/** 返回事件 */
const
onBack
=
useCallback
(()
=>
{
const
locationInfo
:
any
=
location
?.
state
;
if
(
locationInfo
.
from
===
"projectOverview"
)
{
navigate
(
"/product/cadd/projectOverview"
);
}
else
{
...
...
src/views/Project/ProjectJobDetail/interface.ts
0 → 100644
View file @
6507ea38
/*
* @Author: 吴永生 15770852798@163.com
* @Date: 2022-08-15 14:44:24
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-08-15 14:46:02
* @FilePath: /bkunyun/src/views/Project/ProjectJobDetail/interface.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export
interface
IFlowNodeTransmissionNum
{
target
:
string
,
value
:
number
,
batchId
:
string
,
source
:
string
}
\ No newline at end of file
src/views/Project/ProjectJobDetail/utils.ts
0 → 100644
View file @
6507ea38
/*
* @Author: 吴永生 15770852798@163.com
* @Date: 2022-08-15 15:03:10
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-08-15 15:43:16
* @FilePath: /bkunyun/src/views/Project/ProjectJobDetail/utils.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
IEdge
,
ITask
}
from
"../ProjectSubmitWork/interface"
;
import
{
IFlowNodeTransmissionNum
}
from
"./interface"
;
// 根据outputs的路径获取数据集的路径
export
const
getDatasetPath
=
(
path
:
string
)
=>
{
let
datasetPath
=
""
;
const
noProjectPath
=
path
.
slice
(
12
);
const
fileIndex
=
noProjectPath
.
indexOf
(
"/.dataset"
);
if
(
fileIndex
!==
-
1
)
{
datasetPath
=
noProjectPath
.
slice
(
0
,
fileIndex
);
}
else
{
datasetPath
=
noProjectPath
;
}
return
datasetPath
?
datasetPath
:
"/"
;
};
// 根据outputs的路径获取数据集的名称
export
const
getDatasetName
=
(
path
:
string
)
=>
{
let
name
=
""
;
let
nameIndex
=
path
.
indexOf
(
"/.dataset/"
)
+
10
;
const
lastIndex
=
path
.
lastIndexOf
(
"/"
);
if
(
nameIndex
!==
-
1
&&
lastIndex
!==
-
1
)
{
name
=
path
.
slice
(
nameIndex
,
lastIndex
);
}
return
name
;
};
/** 根据批节点 判断是否在同一个批 */
export
const
getSameBatch
=
(
flowNodeInfo
:
IFlowNodeTransmissionNum
[],
task
:
ITask
)
=>
{
return
flowNodeInfo
.
some
(
every
=>
{
return
every
.
batchId
===
task
.
parentNode
})
}
/** 连接的数组 */
export
const
getConnectionArr
=
(
flowNodeInfo
:
IFlowNodeTransmissionNum
[],
edge
:
IEdge
)
=>
{
return
flowNodeInfo
.
filter
(
every
=>
{
return
every
.
source
===
edge
?.
source
&&
every
.
target
===
edge
?.
target
})
}
src/views/Project/ProjectSubmitWork/interface.ts
View file @
6507ea38
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-08-
08 15:55:45
* @LastEditTime: 2022-08-
15 15:57:29
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/interface.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -117,7 +117,7 @@ export type IRenderTask = {
// 工作流详情
export
interface
ITaskInfo
extends
ITemplateConfig
{
name
:
string
;
// 任务(工作流)名称
name
?
:
string
;
// 任务(工作流)名称
outputPath
:
string
;
// 任务结果 输出文件路径
state
:
IState
;
// 任务状态
specTitle
:
string
;
// 源模板
...
...
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