From 1c1f3c77618008fd3c6a5437de229fc73ae7612e Mon Sep 17 00:00:00 2001 From: ssongliu Date: Fri, 3 Jul 2026 15:59:22 +0800 Subject: [PATCH] feat: support importing all firewall rules (#13192) * feat: support importing all firewall rules * fix: preserve selected firewall import action --- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/es-es.ts | 1 + frontend/src/lang/modules/fa.ts | 1 + frontend/src/lang/modules/ja.ts | 1 + frontend/src/lang/modules/ko.ts | 1 + frontend/src/lang/modules/ms.ts | 1 + frontend/src/lang/modules/pt-br.ts | 1 + frontend/src/lang/modules/ru.ts | 1 + frontend/src/lang/modules/tr.ts | 1 + frontend/src/lang/modules/zh-Hant.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + .../src/views/host/firewall/ip/import/index.vue | 13 ++++++++++--- .../src/views/host/firewall/port/import/index.vue | 13 ++++++++++--- 13 files changed, 31 insertions(+), 6 deletions(-) diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index ef5de4696..478fd128d 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -52,6 +52,7 @@ const message = { verify: 'Verify', saveAndEnable: 'Save and enable', import: 'Import', + importAll: 'Import all', export: 'Export', power: 'Submit', search: 'Search', diff --git a/frontend/src/lang/modules/es-es.ts b/frontend/src/lang/modules/es-es.ts index 89a461c71..82b20eb17 100644 --- a/frontend/src/lang/modules/es-es.ts +++ b/frontend/src/lang/modules/es-es.ts @@ -52,6 +52,7 @@ const message = { verify: 'Verificar', saveAndEnable: 'Guardar y habilitar', import: 'Importar', + importAll: 'Importar todo', export: 'Exportar', power: 'Enviar', search: 'Buscar', diff --git a/frontend/src/lang/modules/fa.ts b/frontend/src/lang/modules/fa.ts index 9607cf7f1..e24bae57a 100644 --- a/frontend/src/lang/modules/fa.ts +++ b/frontend/src/lang/modules/fa.ts @@ -52,6 +52,7 @@ const message = { verify: 'تأیید', saveAndEnable: 'ذخیره و فعال‌سازی', import: 'واردات', + importAll: 'وارد کردن همه', export: 'خروجی', power: 'ارسال', search: 'جستجو', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 304a2fbc0..d63078756 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -49,6 +49,7 @@ const message = { verify: '検証', saveAndEnable: '保存して有効化', import: 'インポート', + importAll: 'すべてインポート', export: 'エクスポート', power: '送信', search: '検索', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 767035117..83ec944ac 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -49,6 +49,7 @@ const message = { verify: '검증', saveAndEnable: '저장 및 활성화', import: '가져오기', + importAll: '모두 가져오기', export: '내보내기', power: '제출', search: '검색', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index b7802b58d..df9202e7e 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -49,6 +49,7 @@ const message = { verify: 'Sahkan', saveAndEnable: 'Simpan dan aktifkan', import: 'Import', + importAll: 'Import semua', export: 'Eksport', power: 'Hantar', search: 'Cari', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index 2dce44b7c..ecf0c1a43 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -49,6 +49,7 @@ const message = { verify: 'Verificar', saveAndEnable: 'Salvar e ativar', import: 'Importar', + importAll: 'Importar tudo', export: 'Exportar', power: 'Enviar', search: 'Pesquisar', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 3dcbf15e1..cfd9ce400 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -49,6 +49,7 @@ const message = { verify: 'Проверить', saveAndEnable: 'Сохранить и включить', import: 'Импорт', + importAll: 'Импортировать все', export: 'Экспорт', power: 'Отправить', search: 'Поиск', diff --git a/frontend/src/lang/modules/tr.ts b/frontend/src/lang/modules/tr.ts index c92a2c09b..4bb1914da 100644 --- a/frontend/src/lang/modules/tr.ts +++ b/frontend/src/lang/modules/tr.ts @@ -52,6 +52,7 @@ const message = { verify: 'Doğrula', saveAndEnable: 'Kaydet ve etkinleştir', import: 'İçe Aktar', + importAll: 'Tümünü içe aktar', export: 'Dışa Aktar', power: 'Gönder', search: 'Ara', diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts index db3acdcab..ce19d99d6 100644 --- a/frontend/src/lang/modules/zh-Hant.ts +++ b/frontend/src/lang/modules/zh-Hant.ts @@ -52,6 +52,7 @@ const message = { verify: '驗證', saveAndEnable: '儲存並啟用', import: '匯入', + importAll: '全部匯入', export: '匯出', power: '提交', search: '搜尋', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 9ead26644..7f933ffa1 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -52,6 +52,7 @@ const message = { verify: '验证', saveAndEnable: '保存并启用', import: '导入', + importAll: '全部导入', export: '导出', power: '授权', search: '搜索', diff --git a/frontend/src/views/host/firewall/ip/import/index.vue b/frontend/src/views/host/firewall/ip/import/index.vue index 0fcc23ec4..ccaf5021b 100644 --- a/frontend/src/views/host/firewall/ip/import/index.vue +++ b/frontend/src/views/host/firewall/ip/import/index.vue @@ -60,7 +60,10 @@ {{ $t('commons.button.cancel') }} - + + {{ $t('commons.button.importAll') }} + + {{ $t('commons.button.import') }} @@ -200,12 +203,16 @@ const compareRules = (importedRules: any[]) => { search(); }; -const onImport = async () => { +const onImportAll = async () => { + await onImport(displayData.value); +}; + +const onImport = async (rules = selects.value) => { loading.value = true; let successCount = 0; let errorCount = 0; - for (const rule of selects.value) { + for (const rule of rules) { try { const params: Host.RuleIP = { operation: 'add', diff --git a/frontend/src/views/host/firewall/port/import/index.vue b/frontend/src/views/host/firewall/port/import/index.vue index 4c38fb759..5294ba75b 100644 --- a/frontend/src/views/host/firewall/port/import/index.vue +++ b/frontend/src/views/host/firewall/port/import/index.vue @@ -62,7 +62,10 @@ {{ $t('commons.button.cancel') }} - + + {{ $t('commons.button.importAll') }} + + {{ $t('commons.button.import') }} @@ -206,12 +209,16 @@ const compareRules = (importedRules: any[]) => { search(); }; -const onImport = async () => { +const onImportAll = async () => { + await onImport(displayData.value); +}; + +const onImport = async (rules = selects.value) => { loading.value = true; let successCount = 0; let errorCount = 0; - for (const rule of selects.value) { + for (const rule of rules) { try { const params: Host.RulePort = { operation: 'add',