From 9f5a03419e111a24c5d83de850fb3dd3cd2adb89 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 29 May 2023 15:08:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=A2=E6=9D=BF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F=E7=BB=9F=E4=B8=80=20(#1177?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/container/setting/index.vue | 26 +++---- .../src/views/setting/safe/allowips/index.vue | 74 +++++-------------- frontend/src/views/setting/safe/index.vue | 29 ++++++-- 3 files changed, 48 insertions(+), 81 deletions(-) diff --git a/frontend/src/views/container/setting/index.vue b/frontend/src/views/container/setting/index.vue index cd4d36ac6..bd09d2ae1 100644 --- a/frontend/src/views/container/setting/index.vue +++ b/frontend/src/views/container/setting/index.vue @@ -46,21 +46,15 @@ -
+
- + {{ $t('commons.button.set') }}
@@ -85,21 +79,15 @@ -
+
- + {{ $t('commons.button.set') }}
@@ -465,4 +453,10 @@ onMounted(() => { body { margin: 0; } + +.append-button { + width: 80px; + background-color: var(--el-fill-color-light); + color: var(--el-color-info); +} diff --git a/frontend/src/views/setting/safe/allowips/index.vue b/frontend/src/views/setting/safe/allowips/index.vue index 3609f84d7..d27d38d4b 100644 --- a/frontend/src/views/setting/safe/allowips/index.vue +++ b/frontend/src/views/setting/safe/allowips/index.vue @@ -7,35 +7,13 @@ - - - - - - - - - - - - - -
- -
- - - - {{ $t('commons.button.delete') }} - -
- {{ $t('commons.button.add') }} -
- {{ $t('setting.allowIPsHelper1') }} + +
@@ -69,40 +47,22 @@ const drawerVisiable = ref(); const loading = ref(); const acceptParams = (params: DialogProps): void => { - allowIPs.value = []; - if (params.allowIPs) { - for (const ip of params.allowIPs.split(',')) { - if (ip) { - allowIPs.value.push({ value: ip }); - } - } - } + allowIPs.value = params.allowIPs; drawerVisiable.value = true; }; -const handlePortsAdd = () => { - let item = { - value: '', - }; - allowIPs.value.push(item); -}; -const handlePortsDelete = (index: number) => { - allowIPs.value.splice(index, 1); -}; - const onSavePort = async () => { - let allows = ''; - if (allowIPs.value.length !== 0) { - for (const ip of allowIPs.value) { - if (checkIp(ip.value)) { - MsgError(i18n.global.t('firewall.addressFormatError')); - return false; + if (allowIPs.value) { + let ips = allowIPs.value.split('\n'); + for (const ip of ips) { + if (ip) { + if (checkIp(ip)) { + MsgError(i18n.global.t('firewall.addressFormatError')); + return false; + } } - allows += ip.value + ','; } - allows = allows.substring(0, allows.length - 1); } - ElMessageBox.confirm(i18n.global.t('setting.allowIPsHelper'), i18n.global.t('setting.allowIPs'), { confirmButtonText: i18n.global.t('commons.button.confirm'), cancelButtonText: i18n.global.t('commons.button.cancel'), @@ -110,7 +70,7 @@ const onSavePort = async () => { }).then(async () => { loading.value = true; - await updateSetting({ key: 'AllowIPs', value: allows }) + await updateSetting({ key: 'AllowIPs', value: allowIPs.value.replaceAll('\n', ',') }) .then(() => { loading.value = false; MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); diff --git a/frontend/src/views/setting/safe/index.vue b/frontend/src/views/setting/safe/index.vue index 872ba39d1..d8cd003b7 100644 --- a/frontend/src/views/setting/safe/index.vue +++ b/frontend/src/views/setting/safe/index.vue @@ -40,13 +40,18 @@ - - - +
+ + + {{ $t('commons.button.set') }} + +