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
2d1e0f78
Commit
2d1e0f78
authored
Jul 14, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 未选择模板时不允许点击添加模板
parent
d7fa2b1d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
index.tsx
...kbench/workbenchTemplate/components/AddTemplate/index.tsx
+8
-4
index.module.css
src/views/WorkFlowEdit/index.module.css
+3
-0
index.tsx
src/views/WorkFlowEdit/index.tsx
+7
-14
No files found.
src/views/Project/ProjectWorkbench/workbenchTemplate/components/AddTemplate/index.tsx
View file @
2d1e0f78
...
...
@@ -83,10 +83,14 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
});
const
handleAddTemplate
=
()
=>
{
addTemplate
({
projectId
:
projectId
as
string
,
workflowSpecIds
:
selectTemplateData
,
});
if
(
selectTemplateData
.
length
===
0
)
{
Message
.
error
(
"请选择要添加的模板"
);
}
else
{
addTemplate
({
projectId
:
projectId
as
string
,
workflowSpecIds
:
selectTemplateData
,
});
}
};
// 添加工作流模板-获取模板列表
...
...
src/views/WorkFlowEdit/index.module.css
View file @
2d1e0f78
...
...
@@ -45,3 +45,6 @@
background-color
:
#fff
;
padding
:
24px
;
}
.saveBox
{
width
:
390px
;
}
src/views/WorkFlowEdit/index.tsx
View file @
2d1e0f78
...
...
@@ -115,7 +115,7 @@ const WorkFlowEdit = observer((props: IProps) => {
},
[
id
,
fetchTemplateConfigInfoRun
]);
// 校验模板名称
const
checkTitle
=
()
=>
{
const
checkTitle
=
(
title
:
string
)
=>
{
if
(
!
title
)
{
setTitleHelper
({
error
:
true
,
...
...
@@ -152,7 +152,6 @@ const WorkFlowEdit = observer((props: IProps) => {
helperText
:
"新版本号必须大于老版本号,且必须为X.Y.Z格式,XYZ必须为0~99的正整数"
,
});
return
false
;
}
else
if
(
versionArr
[
0
]
===
oldversionArr
[
0
])
{
if
(
versionArr
[
1
]
<
oldversionArr
[
1
])
{
setVersionHelper
({
...
...
@@ -160,7 +159,6 @@ const WorkFlowEdit = observer((props: IProps) => {
helperText
:
"新版本号必须大于老版本号,且必须为X.Y.Z格式,XYZ必须为0~99的正整数"
,
});
return
false
;
}
else
if
(
versionArr
[
1
]
===
oldversionArr
[
1
])
{
if
(
versionArr
[
2
]
<=
oldversionArr
[
2
])
{
setVersionHelper
({
...
...
@@ -168,26 +166,21 @@ const WorkFlowEdit = observer((props: IProps) => {
helperText
:
"新版本号必须大于老版本号,且必须为X.Y.Z格式,XYZ必须为0~99的正整数"
,
});
return
false
;
}
}
}
return
true
;
};
// 校验版本号格式
const
checkVersion
=
(
version
:
string
)
=>
{
if
(
oldversion
)
{
if
(
!
checkNewOldVersion
(
version
,
oldversion
))
{
return
;
}
}
console
.
log
(
version
);
if
(
/^
[
1-9
]\d?(\.(
0|
[
1-9
]\d?)){2}
$/
.
test
(
version
))
{
setVersionHelper
({
error
:
false
,
helperText
:
""
,
});
if
(
oldversion
)
{
checkNewOldVersion
(
version
,
oldversion
);
}
}
else
{
setVersionHelper
({
error
:
true
,
...
...
@@ -200,7 +193,7 @@ const WorkFlowEdit = observer((props: IProps) => {
const
handleTitleChange
=
(
e
:
any
)
=>
{
const
title
=
e
.
target
.
value
;
setTitle
(
title
);
checkTitle
();
checkTitle
(
title
);
// 格式不正确,必须在15字符以内,仅限大小写字母、数字、中文
};
...
...
@@ -281,7 +274,7 @@ const WorkFlowEdit = observer((props: IProps) => {
// 表单弹窗确定,新建/编辑自定义模板保存
const
handleOncofirm
=
()
=>
{
checkTitle
();
checkTitle
(
title
);
checkVersion
(
version
);
if
(
!
titleHelper
.
error
&&
!
versionHelper
.
error
)
{
saveUserSpecRun
({
...
...
@@ -387,7 +380,7 @@ const WorkFlowEdit = observer((props: IProps) => {
onClose=
{
handleCloseDialog
}
onConfirm=
{
handleOncofirm
}
>
<
div
>
<
div
className=
{
styles
.
saveBox
}
>
<
MyInput
value=
{
title
}
label=
"模板名称"
...
...
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