feat: support importing all firewall rules (#13192)

* feat: support importing all firewall rules

* fix: preserve selected firewall import action
This commit is contained in:
ssongliu
2026-07-03 15:59:22 +08:00
committed by GitHub
parent fae49284b7
commit 1c1f3c7761
13 changed files with 31 additions and 6 deletions

View File

@@ -52,6 +52,7 @@ const message = {
verify: 'Verify',
saveAndEnable: 'Save and enable',
import: 'Import',
importAll: 'Import all',
export: 'Export',
power: 'Submit',
search: 'Search',

View File

@@ -52,6 +52,7 @@ const message = {
verify: 'Verificar',
saveAndEnable: 'Guardar y habilitar',
import: 'Importar',
importAll: 'Importar todo',
export: 'Exportar',
power: 'Enviar',
search: 'Buscar',

View File

@@ -52,6 +52,7 @@ const message = {
verify: 'تأیید',
saveAndEnable: 'ذخیره و فعال‌سازی',
import: 'واردات',
importAll: 'وارد کردن همه',
export: 'خروجی',
power: 'ارسال',
search: 'جستجو',

View File

@@ -49,6 +49,7 @@ const message = {
verify: '検証',
saveAndEnable: '保存して有効化',
import: 'インポート',
importAll: 'すべてインポート',
export: 'エクスポート',
power: '送信',
search: '検索',

View File

@@ -49,6 +49,7 @@ const message = {
verify: '검증',
saveAndEnable: '저장 활성화',
import: '가져오기',
importAll: '모두 가져오기',
export: '내보내기',
power: '제출',
search: '검색',

View File

@@ -49,6 +49,7 @@ const message = {
verify: 'Sahkan',
saveAndEnable: 'Simpan dan aktifkan',
import: 'Import',
importAll: 'Import semua',
export: 'Eksport',
power: 'Hantar',
search: 'Cari',

View File

@@ -49,6 +49,7 @@ const message = {
verify: 'Verificar',
saveAndEnable: 'Salvar e ativar',
import: 'Importar',
importAll: 'Importar tudo',
export: 'Exportar',
power: 'Enviar',
search: 'Pesquisar',

View File

@@ -49,6 +49,7 @@ const message = {
verify: 'Проверить',
saveAndEnable: 'Сохранить и включить',
import: 'Импорт',
importAll: 'Импортировать все',
export: 'Экспорт',
power: 'Отправить',
search: 'Поиск',

View File

@@ -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',

View File

@@ -52,6 +52,7 @@ const message = {
verify: '驗證',
saveAndEnable: '儲存並啟用',
import: '匯入',
importAll: '全部匯入',
export: '匯出',
power: '提交',
search: '搜尋',

View File

@@ -52,6 +52,7 @@ const message = {
verify: '验证',
saveAndEnable: '保存并启用',
import: '导入',
importAll: '全部导入',
export: '导出',
power: '授权',
search: '搜索',

View File

@@ -60,7 +60,10 @@
<el-button @click="visible = false">
{{ $t('commons.button.cancel') }}
</el-button>
<el-button type="primary" :disabled="selects.length === 0" @click="onImport">
<el-button type="primary" plain :disabled="displayData.length === 0" @click="onImportAll">
{{ $t('commons.button.importAll') }}
</el-button>
<el-button type="primary" :disabled="selects.length === 0" @click="() => onImport()">
{{ $t('commons.button.import') }}
</el-button>
</span>
@@ -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',

View File

@@ -62,7 +62,10 @@
<el-button @click="visible = false">
{{ $t('commons.button.cancel') }}
</el-button>
<el-button type="primary" :disabled="selects.length === 0" @click="onImport">
<el-button type="primary" plain :disabled="displayData.length === 0" @click="onImportAll">
{{ $t('commons.button.importAll') }}
</el-button>
<el-button type="primary" :disabled="selects.length === 0" @click="() => onImport()">
{{ $t('commons.button.import') }}
</el-button>
</span>
@@ -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',