NEZ-2075 feat:tool配置参数调整
This commit is contained in:
@@ -127,7 +127,7 @@ export function positiveInteger (rule, value, callback) {
|
||||
if (isNaN(Number(value))) {
|
||||
callback(new Error(vm.$t('validate.number')))
|
||||
} else {
|
||||
if (Number(value) >= 0 && (parseInt(value) == parseFloat(value))) {
|
||||
if (Number(value) >= 0) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.positiveInteger')))
|
||||
@@ -227,3 +227,69 @@ export function dataValidate () {
|
||||
// const DMY = '/((^(3[01]|[12][0-9]|0[1-9])(\\/)(10|12|0[13578])(\\/)((1[8-9]\\d{2})|([2-9]\\d{3}))$)|(^(30|[12][0-9]|0[1-9])(\\/)(11|0[469])(\\/)((1[8-9]\\d{2})|([2-9]\\d{3}))$)|(^(2[0-8]|1[0-9]|0[1-9])(\\/)(02)(\\/)((1[8-9]\\d{2})|([2-9]\\d{3}))$)|(^(29)(\\/)(02)(\\/)([2468][048]00)$)|(^(29)(\\/)(02)(\\/)([3579][26]00)$)|(^(29)(\\/)(02)(\\/)([1][89][0][48])$)|(^(29)(\\/)(02)(\\/)([2-9][0-9][0][48])$)|(^(29)(\\/)(02)(\\/)([1][89][2468][048])$)|(^(29)(\\/)(02)(\\/)([2-9][0-9][2468][048])$)|(^(29)(\\/)(02)(\\/)([1][89][13579][26])$)|(^(29)(\\/)(02)(\\/)([2-9][0-9][13579][26])$))/'
|
||||
// const MDY =
|
||||
}
|
||||
|
||||
// 验证timeout
|
||||
export function timeoutValidator (rule, value, callback) {
|
||||
setTimeout(() => {
|
||||
// 判断是否是数字
|
||||
if (isNaN(Number(value))) {
|
||||
callback(new Error(vm.$t('validate.number')))
|
||||
} else {
|
||||
// 判断是否是正整数
|
||||
if (Number(value) >= 0 && (String(value).indexOf('.') == -1)) {
|
||||
// 判断范围
|
||||
if (value >= 1 && value <= 60000) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.timeout')))
|
||||
}
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.positiveInteger')))
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
// 验证packageSize
|
||||
export function packageSizeValidator (rule, value, callback) {
|
||||
setTimeout(() => {
|
||||
// 判断是否是数字
|
||||
if (isNaN(Number(value))) {
|
||||
callback(new Error(vm.$t('validate.number')))
|
||||
} else {
|
||||
// 判断是否是正整数
|
||||
if (Number(value) >= 0 && (String(value).indexOf('.') == -1)) {
|
||||
// 判断范围
|
||||
if (value >= 1 && value <= 4096) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.packageSize')))
|
||||
}
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.positiveInteger')))
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
// 验证maxHops
|
||||
export function maxHopsValidator (rule, value, callback) {
|
||||
setTimeout(() => {
|
||||
// 判断是否是数字
|
||||
if (isNaN(Number(value))) {
|
||||
callback(new Error(vm.$t('validate.number')))
|
||||
} else {
|
||||
// 判断是否是正整数
|
||||
if (Number(value) >= 0 && (String(value).indexOf('.') == -1)) {
|
||||
// 判断范围
|
||||
if (value >= 1 && value <= 1000) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.maxHops')))
|
||||
}
|
||||
} else {
|
||||
callback(new Error(vm.$t('validate.positiveInteger')))
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="tools-header-center">
|
||||
<el-form size="small" ref="ruleForm" :model="ruleForm" :rules="formRules" label-position="right" label-width="150px">
|
||||
<!-- Data centers -->
|
||||
<el-form-item style="margin-bottom:12px" :label="$t('config.dc.dc')">
|
||||
<el-form-item style="margin-bottom:14px" :label="$t('config.dc.dc')">
|
||||
<!-- <el-select v-model="checked" multiple @change="checkedChange" >-->
|
||||
<!-- <el-option-->
|
||||
<!-- :key="item.id"-->
|
||||
@@ -68,7 +68,7 @@
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
<!-- Package size -->
|
||||
<el-form-item prop="packageSize" style="margin-bottom:12px" :label="$t('ping.packageSize')">
|
||||
<el-form-item prop="packageSize" style="margin-bottom:14px" :label="$t('ping.packageSize')">
|
||||
<div class="wrap" style="height:32px">
|
||||
<el-input v-model.number="ruleForm.packageSize" placeholder="">
|
||||
<template slot="append">{{$t('ping.bytes')}}</template>
|
||||
@@ -76,10 +76,10 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- Timeout -->
|
||||
<el-form-item prop="timeout" style="margin-bottom:12px" :label="$t('ping.timeout')">
|
||||
<el-form-item prop="timeout" style="margin-bottom:14px" :label="$t('ping.timeout')">
|
||||
<div class="wrap" style="height:32px">
|
||||
<el-input v-model.number="ruleForm.timeout" placeholder="" >
|
||||
<template slot="append">{{$t('alert.config.second')}}</template>
|
||||
<el-input v-model.number="ruleForm.timeout" placeholder="">
|
||||
<template slot="append">{{$t('overall.ms')}}</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -153,7 +153,7 @@ import nzDataList from '@/components/common/table/nzDataList'
|
||||
import dataListMixin from '@/components/common/mixin/dataList'
|
||||
import pingTable from '@/components/common/table/tool/pingTable'
|
||||
import VueTagsInput from '@johmun/vue-tags-input'
|
||||
import { positiveInteger } from '../../common/js/validate'
|
||||
import { timeoutValidator, packageSizeValidator } from '../../common/js/validate'
|
||||
const ipv4 = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\:\d{0,5})?$/
|
||||
const ipv6 = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/
|
||||
export default {
|
||||
@@ -197,13 +197,13 @@ export default {
|
||||
tableData: [],
|
||||
ruleForm: {
|
||||
// 超时时间
|
||||
timeout: 30,
|
||||
timeout: 100,
|
||||
// 包大小
|
||||
packageSize: 64
|
||||
},
|
||||
formRules: {
|
||||
timeout: [{ validator: positiveInteger, trigger: 'blur' }],
|
||||
packageSize: [{ validator: positiveInteger, trigger: 'blur' }]
|
||||
timeout: [{ validator: timeoutValidator, trigger: 'blur' }],
|
||||
packageSize: [{ validator: packageSizeValidator, trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="tools-header-center">
|
||||
<el-form size="small" ref="ruleForm" :model="ruleForm" :rules="formRules" label-position="right" label-width="150px">
|
||||
<!-- Data centers -->
|
||||
<el-form-item style="margin-bottom:12px" :label="$t('config.dc.dc')">
|
||||
<el-form-item style="margin-bottom:14px" :label="$t('config.dc.dc')">
|
||||
<!-- <el-select v-model="checked" multiple @change="checkedChange" >-->
|
||||
<!-- <el-option-->
|
||||
<!-- :key="item.id"-->
|
||||
@@ -67,16 +67,16 @@
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
<!-- Maximum hops -->
|
||||
<el-form-item prop="maxHops" style="margin-bottom:12px" :label="$t('trace.maxHops')">
|
||||
<el-form-item prop="maxHops" style="margin-bottom:14px" :label="$t('trace.maxHops')">
|
||||
<div class="wrap" style="height:32px">
|
||||
<el-input v-model.number="ruleForm.maxHops" placeholder=""></el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- Timeout -->
|
||||
<el-form-item prop="timeout" style="margin-bottom:12px" :label="$t('ping.timeout')">
|
||||
<el-form-item prop="timeout" style="margin-bottom:14px" :label="$t('ping.timeout')">
|
||||
<div class="wrap" style="height:32px">
|
||||
<el-input v-model.number="ruleForm.timeout" placeholder="">
|
||||
<template slot="append">{{$t('alert.config.second')}}</template>
|
||||
<template slot="append">{{$t('overall.ms')}}</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -146,7 +146,7 @@ import nzDataList from '@/components/common/table/nzDataList'
|
||||
import dataListMixin from '@/components/common/mixin/dataList'
|
||||
import traceTable from '@/components/common/table/tool/traceTable'
|
||||
import VueTagsInput from '@johmun/vue-tags-input'
|
||||
import { positiveInteger } from '../../common/js/validate'
|
||||
import { timeoutValidator, maxHopsValidator } from '../../common/js/validate'
|
||||
const ipv4 = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\:\d{0,5})?$/
|
||||
const ipv6 = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/
|
||||
export default {
|
||||
@@ -190,11 +190,11 @@ export default {
|
||||
// 最大跃点数
|
||||
maxHops: 30,
|
||||
// 超时时间
|
||||
timeout: 30
|
||||
timeout: 100
|
||||
},
|
||||
formRules: {
|
||||
timeout: [{ validator: positiveInteger, trigger: 'blur' }],
|
||||
maxHops: [{ validator: positiveInteger, trigger: 'blur' }]
|
||||
timeout: [{ validator: timeoutValidator, trigger: 'blur' }],
|
||||
maxHops: [{ validator: maxHopsValidator, trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user