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
09f2b20b
Commit
09f2b20b
authored
Jul 12, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成自定义模板保存联调
parent
4af3d4d3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
15 deletions
+58
-15
api_manager.ts
src/api/api_manager.ts
+1
-0
workbench_api.ts
src/api/workbench_api.ts
+12
-1
index.tsx
...kbench/workbenchTemplate/components/AddTemplate/index.tsx
+8
-3
index.tsx
src/views/WorkFlowEdit/index.tsx
+18
-2
util.ts
src/views/WorkFlowEdit/util.ts
+19
-9
No files found.
src/api/api_manager.ts
View file @
09f2b20b
...
@@ -38,6 +38,7 @@ const RESTAPI = {
...
@@ -38,6 +38,7 @@ const RESTAPI = {
API_WORKBENCH_WORKFLOW_TASKINFO
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/workflowjob/task-info`
,
//查询任务某个算子详情
API_WORKBENCH_WORKFLOW_TASKINFO
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workbench/workflowjob/task-info`
,
//查询任务某个算子详情
API_OPERATOR_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/actorspecs`
,
// 获取算子列表
API_OPERATOR_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/actorspecs`
,
// 获取算子列表
API_VERSION_OPERATOR
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/actorversion`
,
// 获取指定版本算子
API_VERSION_OPERATOR
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/actorversion`
,
// 获取指定版本算子
API_SAVE_USERSPEC
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/saveuserspec`
,
// 保存用户自定义工作流模板
};
};
export
default
RESTAPI
;
export
default
RESTAPI
;
src/api/workbench_api.ts
View file @
09f2b20b
...
@@ -146,6 +146,16 @@ const fetchVersionOperator = (params: IFetchOperatorListParams) => {
...
@@ -146,6 +146,16 @@ const fetchVersionOperator = (params: IFetchOperatorListParams) => {
params
,
params
,
});
});
};
};
// 保存用户自定义工作流模板
const
saveUserSpec
=
(
params
:
any
)
=>
{
return
request
({
url
:
Api
.
API_SAVE_USERSPEC
,
method
:
"post"
,
data
:
params
,
});
};
export
{
export
{
current
,
current
,
menu
,
menu
,
...
@@ -157,5 +167,6 @@ export {
...
@@ -157,5 +167,6 @@ export {
deleteWorkflowJob
,
deleteWorkflowJob
,
cancelWorkflowJob
,
cancelWorkflowJob
,
fetchOperatorList
,
fetchOperatorList
,
fetchVersionOperator
fetchVersionOperator
,
saveUserSpec
};
};
src/views/Project/ProjectWorkbench/workbenchTemplate/components/AddTemplate/index.tsx
View file @
09f2b20b
...
@@ -289,12 +289,17 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
...
@@ -289,12 +289,17 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
</
div
>
</
div
>
{
customTemplateInfo
?.
show
?
(
{
customTemplateInfo
?.
show
?
(
<
WorkFlowEdit
<
WorkFlowEdit
onBack=
{
()
=>
onBack=
{
()
=>
{
setCustomTemplateInfo
({
setCustomTemplateInfo
({
id
:
""
,
id
:
""
,
show
:
false
,
show
:
false
,
})
});
}
setSelectTemplateData
([]);
getAddTemplateList
({
projectId
:
projectId
as
string
,
productId
:
productId
as
string
,
});
}
}
/>
/>
)
:
null
}
)
:
null
}
</
div
>
</
div
>
...
...
src/views/WorkFlowEdit/index.tsx
View file @
09f2b20b
...
@@ -19,6 +19,8 @@ import ParameterSetting from "./components/ParameterSetting";
...
@@ -19,6 +19,8 @@ import ParameterSetting from "./components/ParameterSetting";
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
ITask
}
from
"../Project/ProjectSubmitWork/interface"
;
import
{
ITask
}
from
"../Project/ProjectSubmitWork/interface"
;
import
_
from
"lodash"
;
import
_
from
"lodash"
;
import
{
saveUserSpec
}
from
"@/api/workbench_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
getCustomTemplateParameterCheckResult
}
from
"./util"
;
import
{
getCustomTemplateParameterCheckResult
}
from
"./util"
;
import
styles
from
"./index.module.css"
;
import
styles
from
"./index.module.css"
;
...
@@ -47,7 +49,14 @@ const WorkFlowEdit = (props: IProps) => {
...
@@ -47,7 +49,14 @@ const WorkFlowEdit = (props: IProps) => {
const
[
popperTitle
,
setPopperTitle
]
=
useState
(
const
[
popperTitle
,
setPopperTitle
]
=
useState
(
"返回后,当前页面已填写内容将不保存,确认返回吗?"
"返回后,当前页面已填写内容将不保存,确认返回吗?"
);
);
// 返回后,当前页面已填写内容将不保存,确认返回吗?
const
{
run
:
saveUserSpecRun
}
=
useMyRequest
(
saveUserSpec
,
{
onSuccess
:
(
res
)
=>
{
onBack
&&
onBack
();
console
.
log
(
res
);
},
});
// useMyRequest
// saveUserSpec
const
[
anchorEl
,
setAnchorEl
]
=
useState
<
any
>
(
null
);
const
[
anchorEl
,
setAnchorEl
]
=
useState
<
any
>
(
null
);
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
setAnchorEl
(
null
);
setAnchorEl
(
null
);
...
@@ -80,6 +89,7 @@ const WorkFlowEdit = (props: IProps) => {
...
@@ -80,6 +89,7 @@ const WorkFlowEdit = (props: IProps) => {
parameter
.
error
=
checkResult
.
error
;
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
parameter
.
helperText
=
checkResult
.
helperText
;
if
(
checkResult
.
error
)
{
if
(
checkResult
.
error
)
{
console
.
log
(
parameter
);
check
=
false
;
check
=
false
;
}
}
});
});
...
@@ -89,6 +99,12 @@ const WorkFlowEdit = (props: IProps) => {
...
@@ -89,6 +99,12 @@ const WorkFlowEdit = (props: IProps) => {
Message
.
error
(
"工作流校验未通过,请检查!"
);
Message
.
error
(
"工作流校验未通过,请检查!"
);
}
else
{
}
else
{
console
.
log
(
"弹表单窗"
);
console
.
log
(
"弹表单窗"
);
saveUserSpecRun
({
title
:
"自定义模板标题"
,
version
:
"1.0.0"
,
description
:
"这里是描述"
,
tasks
:
templateConfigInfoClone
,
});
}
}
};
};
...
@@ -128,7 +144,7 @@ const WorkFlowEdit = (props: IProps) => {
...
@@ -128,7 +144,7 @@ const WorkFlowEdit = (props: IProps) => {
<
div
className=
{
styles
.
swHeaderRight
}
>
<
div
className=
{
styles
.
swHeaderRight
}
>
<
ButtonComponent
<
ButtonComponent
text=
"保存"
text=
"保存"
click=
{
()
=>
handlePreserve
}
click=
{
()
=>
handlePreserve
()
}
></
ButtonComponent
>
></
ButtonComponent
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/views/WorkFlowEdit/util.ts
View file @
09f2b20b
...
@@ -7,6 +7,13 @@ export const getCustomTemplateParameterCheckResult = (
...
@@ -7,6 +7,13 @@ export const getCustomTemplateParameterCheckResult = (
}
=>
{
}
=>
{
let
error
=
false
;
let
error
=
false
;
let
helperText
=
""
;
let
helperText
=
""
;
// 输出不做校验
if
(
parameter
.
parameterGroup
===
"out"
)
{
return
{
error
,
helperText
,
}
}
// 表单校验
// 表单校验
if
(
parameter
.
required
)
{
if
(
parameter
.
required
)
{
// 提交任务时不展示
// 提交任务时不展示
...
@@ -28,15 +35,18 @@ export const getCustomTemplateParameterCheckResult = (
...
@@ -28,15 +35,18 @@ export const getCustomTemplateParameterCheckResult = (
helperText
,
helperText
,
};
};
}
}
if
(
Array
.
isArray
(
parameter
.
validators
))
{
// 有值才做validators旋律校验
if
(
parameter
.
validators
.
length
>
0
)
{
if
(
parameter
.
defaultValue
)
{
parameter
.
validators
.
forEach
((
validator
)
=>
{
if
(
Array
.
isArray
(
parameter
.
validators
))
{
const
reg
=
new
RegExp
(
validator
.
regex
);
if
(
parameter
.
validators
.
length
>
0
)
{
if
(
!
reg
.
test
(
parameter
.
defaultValue
))
{
parameter
.
validators
.
forEach
((
validator
)
=>
{
error
=
true
;
const
reg
=
new
RegExp
(
validator
.
regex
);
helperText
=
validator
.
message
;
if
(
!
reg
.
test
(
parameter
.
defaultValue
))
{
}
error
=
true
;
});
helperText
=
validator
.
message
;
}
});
}
}
}
}
}
return
{
return
{
...
...
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