[Fix][UI Next][V1.0.0-Alpha] Fix time alert validate of workflow (#8750)

slim
Devosend 2022-03-08 12:25:31 +08:00 committed by GitHub
parent 799e2fd215
commit 080a237b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -21,4 +21,6 @@ const regex = {
password: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/
}
export const positiveIntegerRegex = /^\+?[0-9]*$/
export default regex

View File

@ -33,6 +33,7 @@ import { SaveForm, WorkflowDefinition } from './types'
import { useRoute } from 'vue-router'
import { verifyName } from '@/service/modules/process-definition'
import './x6-style.scss'
import { positiveIntegerRegex } from '@/utils/regex'
const props = {
visible: {
@ -95,7 +96,10 @@ export default defineComponent({
},
timeout: {
validator() {
if (formValue.value.timeoutFlag && formValue.value.timeout <= 0) {
if (
formValue.value.timeoutFlag &&
!positiveIntegerRegex.test(String(formValue.value.timeout))
) {
return new Error(t('project.dag.positive_integer'))
}
}