From 4bdee680c623cde73bef7d5d1c83c506641719ce Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Tue, 22 Mar 2022 17:43:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20IPAM=20IP=20details?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=A1=A8=E5=8D=95=E9=AA=8C=E8=AF=81=E5=92=8C?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rightBox/ipDetailsBox.vue | 21 ++++++------------- .../common/table/settings/ipamTable.vue | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/ipDetailsBox.vue b/nezha-fronted/src/components/common/rightBox/ipDetailsBox.vue index f5adde90b..12a256a63 100644 --- a/nezha-fronted/src/components/common/rightBox/ipDetailsBox.vue +++ b/nezha-fronted/src/components/common/rightBox/ipDetailsBox.vue @@ -2,7 +2,7 @@
-
{{editipDetails.id ? ($t("overall.ipam.edit")) : $t("overall.ipam.create")}}
+
{{editipDetails.id ? ($t("overall.ipamIp.edit")) : $t("overall.ipamIp.create")}}
@@ -55,21 +55,12 @@ export default { mixins: [editRigthBox], data () { const detailsIpv = (rule, value, callback) => { - const Ipv4 = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/ - const Ipv6 = /^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/ + const ipvVerify = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/ setTimeout(() => { - if (this.detailsType === 4) { - if (Ipv4.test(value)) { - callback() - } else { - callback(new Error(vm.$t('validate.address'))) - } - } else if (this.detailsType === 6) { - if (Ipv6.test(value)) { - callback() - } else { - callback(new Error(vm.$t('validate.address'))) - } + if (ipvVerify.test(value)) { + callback() + } else { + callback(new Error(vm.$t('validate.address'))) } }, 100) } diff --git a/nezha-fronted/src/components/common/table/settings/ipamTable.vue b/nezha-fronted/src/components/common/table/settings/ipamTable.vue index aaed0f6c5..e0c309aec 100644 --- a/nezha-fronted/src/components/common/table/settings/ipamTable.vue +++ b/nezha-fronted/src/components/common/table/settings/ipamTable.vue @@ -36,7 +36,7 @@