From 02929ed6420a05e553d6cce695468d627bfbc2df Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Mon, 17 Feb 2025 11:27:30 +0100 Subject: [PATCH 1/5] fix(ui): change button kind from danger to tertiary in FilterBypassRules.vue --- ui/src/views/FilterBypassRules.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/FilterBypassRules.vue b/ui/src/views/FilterBypassRules.vue index 86b66493..b5cec050 100644 --- a/ui/src/views/FilterBypassRules.vue +++ b/ui/src/views/FilterBypassRules.vue @@ -125,7 +125,7 @@
Date: Mon, 17 Feb 2025 16:01:05 +0100 Subject: [PATCH 2/5] feat(ui): implement delete filter rule modal and update deletion logic in FilterBypassRules.vue --- ui/public/i18n/en/translation.json | 6 +- ui/src/views/FilterBypassRules.vue | 112 ++++++++++++----------------- 2 files changed, 51 insertions(+), 67 deletions(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index d50e06d7..f4e6f713 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -354,10 +354,12 @@ "type_ip_l": "IP address", "type_cidr_l": "CIDR network", "create_bypass_rule_for": "Create bypass rule for {value}", - "bypass_rule_is_going_to_be_deleted": "Bypass rule for {value} is going to be deleted...", "delete_bypass_rule_for": "Delete bypass rule for {value}", "bypass_rule_already_exists": "This bypass rule already exists", - "placeholder_bypass_rule": "E.g. {value}" + "placeholder_bypass_rule": "E.g. {value}", + "delete_filter_rule": "Delete filter rule", + "delete_rule_confirm": "Confirm the deletion of rule {name} ?", + "delete_filter_rule_explanation": "The rule will be removed from the list of bypass rules" }, "settings_mailboxes": { "title": "Mailboxes settings", diff --git a/ui/src/views/FilterBypassRules.vue b/ui/src/views/FilterBypassRules.vue index b5cec050..abe42b6b 100644 --- a/ui/src/views/FilterBypassRules.vue +++ b/ui/src/views/FilterBypassRules.vue @@ -128,7 +128,7 @@ kind="tertiary" :icon="TrashCan20" size="small" - @click="willDeleteBypassRule(row)" + @click="showDeleteRuleModal(row)" >{{ $t("common.delete") }}
@@ -146,6 +146,37 @@ @hide="hideCreateBypassRuleModal" @reloadBypassRules="listBypassRules" /> + + + + @@ -180,6 +211,12 @@ export default { q: { page: "filterBypassRules", }, + isShownDeleteRuleModal: false, + currentRule: { + direction: "", + value: "", + type: "", + }, urlCheckInterval: null, tablePage: [], tableColumns: ["direction", "value", "type"], @@ -217,6 +254,13 @@ export default { this.listBypassRules(); }, methods: { + showDeleteRuleModal(rule) { + this.currentRule = rule; + this.isShownDeleteRuleModal = true; + }, + hideDeleteRuleModal() { + this.isShownDeleteRuleModal = false; + }, goToFilter() { this.goToAppPage(this.instanceName, "filter"); }, @@ -226,67 +270,6 @@ export default { hideCreateBypassRuleModal() { this.isShownCreateBypassRuleModal = false; }, - willDeleteBypassRule(rule) { - const notification = { - id: this.getUuid(), - title: this.$t( - "filter_bypass_rules.bypass_rule_is_going_to_be_deleted", - { - value: rule.value, - } - ), - type: "info", - toastTimeout: this.DELETE_DELAY - 1000, - actionLabel: this.core.$t("common.cancel"), - action: { - type: "callback", - callback: this.cancelDeleteBypassRule.bind(null, rule), - }, - }; - this.createNotificationForApp(notification); - - const timeout = setTimeout(() => { - // remove notification from drawer - this.deleteNotificationForApp(notification.id); - - // delete timeout - this.deleteBypassRuleTimeout = this.deleteBypassRuleTimeout.filter( - (el) => el.name !== rule.value - ); - - // call api to remove address - this.removeBypassRule(rule); - }, this.DELETE_DELAY); - - this.deleteBypassRuleTimeout.push({ - name: rule.value, - timeout, - notification, - }); - - // remove bypass rule from table - this.rules = this.rules.filter((r) => r.value !== rule.value); - }, - cancelDeleteBypassRule(rule) { - const timeoutFound = this.deleteBypassRuleTimeout.find( - (el) => el.name === rule.value - ); - - if (timeoutFound) { - clearTimeout(timeoutFound.timeout); - - // remove notification from drawer - this.deleteNotificationForApp(timeoutFound.notification.id); - - // delete timeout - this.deleteBypassRuleTimeout = this.deleteBypassRuleTimeout.filter( - (el) => el.name !== rule.value - ); - } - - // reload bypass rules - this.listBypassRules(); - }, async listBypassRules() { this.loading.listBypassRules = true; this.error.listBypassRules = ""; @@ -386,9 +369,8 @@ export default { }, removeBypassRuleCompleted() { this.loading.removeBypassRule = false; - - // reload addresses - this.$emit("reloadBypassRules"); + this.hideDeleteRuleModal(); + this.listBypassRules(); }, }, }; From 48d7c28373c93c1c18c2e86248e4ea6b5528a418 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Wed, 19 Feb 2025 12:12:28 +0100 Subject: [PATCH 3/5] Translation review of Andre Co-authored-by: Andrea Leardini --- ui/public/i18n/en/translation.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index f4e6f713..9a33f30e 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -357,9 +357,8 @@ "delete_bypass_rule_for": "Delete bypass rule for {value}", "bypass_rule_already_exists": "This bypass rule already exists", "placeholder_bypass_rule": "E.g. {value}", - "delete_filter_rule": "Delete filter rule", - "delete_rule_confirm": "Confirm the deletion of rule {name} ?", - "delete_filter_rule_explanation": "The rule will be removed from the list of bypass rules" + "delete_filter_rule": "Delete bypass rule", + "delete_rule_confirm": "Delete rule {name}?", }, "settings_mailboxes": { "title": "Mailboxes settings", From e523846a4de3b6a75cde142c530f55b599b68bda Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Wed, 19 Feb 2025 12:13:15 +0100 Subject: [PATCH 4/5] fix(ui): remove unnecessary explanation text in delete confirmation modal --- ui/src/views/FilterBypassRules.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/src/views/FilterBypassRules.vue b/ui/src/views/FilterBypassRules.vue index abe42b6b..6552af11 100644 --- a/ui/src/views/FilterBypassRules.vue +++ b/ui/src/views/FilterBypassRules.vue @@ -169,9 +169,6 @@ @confirmDelete="removeBypassRule(currentRule)" >