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
5342de1f
Commit
5342de1f
authored
Jul 14, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 解决自定义模板保存校验错误的问题
parent
9592bb2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
15 deletions
+20
-15
index.tsx
src/components/BusinessComponents/FileSelect/index.tsx
+4
-12
index.tsx
src/views/WorkFlowEdit/index.tsx
+16
-3
No files found.
src/components/BusinessComponents/FileSelect/index.tsx
View file @
5342de1f
...
...
@@ -46,7 +46,10 @@ const FileSelect = observer((props: FileSelectProps) => {
const
[
keyWord
,
setKeyWord
]
=
useState
(
""
);
const
fileSelectOnConfirm
=
()
=>
{
onConfirm
(
path
);
console
.
log
(
path
);
console
.
log
(
selectFileName
);
console
.
log
(
selectItem
);
// onConfirm(path);
};
// 搜索值改变
...
...
@@ -57,14 +60,6 @@ const FileSelect = observer((props: FileSelectProps) => {
setKeyWord
(
e
.
target
.
value
);
};
// 按回车搜索
// const handleKeyWordChangeKeyUp = (e: any) => {
// if (e.keyCode === 13) {
// searchFileList();
// getDataSetListSearch();
// }
// };
// 文件夹下钻
const
handleViewFolders
=
(
item
:
any
)
=>
{
if
(
debounce
)
{
...
...
@@ -250,7 +245,6 @@ const FileSelect = observer((props: FileSelectProps) => {
}
else
if
(
type
===
"dataset"
)
{
return
[...
folderList
,
...
dataSetList
];
}
else
{
// type === path
return
[...
folderList
];
}
},
[
list
,
dataSetList
,
type
]);
...
...
@@ -310,7 +304,6 @@ const FileSelect = observer((props: FileSelectProps) => {
:
index
>
pathArr
.
length
-
4
?
item
:
""
}
{
/* && index > pathArr.length - 4 */
}
{
index
===
pathArr
.
length
-
1
||
(
index
<=
pathArr
.
length
-
4
&&
index
>
0
)
?
null
:
(
<
i
className=
{
style
.
showPathI
}
>
{
">"
}
</
i
>
...
...
@@ -346,7 +339,6 @@ const FileSelect = observer((props: FileSelectProps) => {
getDataSetList
();
}
}
// type?: "file" | "dataset" | "path";
},
[
type
,
keyWord
,
...
...
src/views/WorkFlowEdit/index.tsx
View file @
5342de1f
...
...
@@ -121,26 +121,30 @@ const WorkFlowEdit = observer((props: IProps) => {
error
:
true
,
helperText
:
"必须输入模板名称"
,
});
return
false
;
}
else
if
(
title
.
length
>
15
)
{
setTitleHelper
({
error
:
true
,
helperText
:
"格式不正确,必须在15字符以内,仅限大小写字母、数字、中文"
,
});
return
false
;
}
else
if
(
!
checkIsNumberLetterChinese
(
title
))
{
setTitleHelper
({
error
:
true
,
helperText
:
"格式不正确,必须在15字符以内,仅限大小写字母、数字、中文"
,
});
return
false
;
}
else
{
setTitleHelper
({
error
:
false
,
helperText
:
""
,
});
return
true
;
}
};
// 校验新版本号是否大于旧版本号
const
checkNewOldVersion
=
(
version
:
string
,
oldversion
:
string
)
=>
{
const
checkNewOldVersion
=
(
version
:
string
,
oldversion
:
string
)
:
boolean
=>
{
let
versionArr
:
any
[]
=
version
.
split
(
"."
);
let
oldversionArr
:
any
[]
=
oldversion
.
split
(
"."
);
versionArr
=
versionArr
.
map
((
item
)
=>
Number
(
item
));
...
...
@@ -152,6 +156,7 @@ 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
({
...
...
@@ -159,6 +164,7 @@ 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
({
...
...
@@ -166,9 +172,11 @@ const WorkFlowEdit = observer((props: IProps) => {
helperText
:
"新版本号必须大于老版本号,且必须为X.Y.Z格式,XYZ必须为0~99的正整数"
,
});
return
false
;
}
}
}
return
true
;
};
// 校验版本号格式
...
...
@@ -179,13 +187,18 @@ const WorkFlowEdit = observer((props: IProps) => {
helperText
:
""
,
});
if
(
oldversion
)
{
checkNewOldVersion
(
version
,
oldversion
);
if
(
checkNewOldVersion
(
version
,
oldversion
))
{
return
true
;
}
else
{
return
false
;
}
}
}
else
{
setVersionHelper
({
error
:
true
,
helperText
:
"格式不正确,必须为X.Y.Z格式,且XYZ必须为0~99的正整数"
,
});
return
false
;
}
};
...
...
@@ -276,7 +289,7 @@ const WorkFlowEdit = observer((props: IProps) => {
const
handleOncofirm
=
()
=>
{
checkTitle
(
title
);
checkVersion
(
version
);
if
(
!
titleHelper
.
error
&&
!
versionHelper
.
error
)
{
if
(
checkTitle
(
title
)
&&
checkVersion
(
version
)
)
{
saveUserSpecRun
({
title
,
version
,
...
...
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