From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 7224C1FF15E for ; Mon, 29 Sep 2025 16:18:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0CAA714807; Mon, 29 Sep 2025 16:18:35 +0200 (CEST) Message-ID: Date: Mon, 29 Sep 2025 16:18:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Stoiko Ivanov , pmg-devel@lists.proxmox.com References: <20250929073421.16955-1-s.ivanov@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20250929073421.16955-1-s.ivanov@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759155491636 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pmg-devel] [PATCH pmg-gui] ui: queue: refactor deletion/delivery X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" the only thing i noticed is that the message for delivery changed, not sure if that was intentional (see inline comments) aside from that, looks good to me, so consider it Reviewed-by: Dominik Csapak On 9/29/25 9:34 AM, Stoiko Ivanov wrote: > both actions have almost the same structure and calls, so unify this > in the doAction field, and use it for both deliver and delete. > > the messages for the info-modal were kept as a whole string for both > assuming that this will provide a bit more context to translators. > > Signed-off-by: Stoiko Ivanov > --- > js/PostfixMailQueue.js | 50 +++++++++++++----------------------------- > 1 file changed, 15 insertions(+), 35 deletions(-) > > diff --git a/js/PostfixMailQueue.js b/js/PostfixMailQueue.js > index ec39df9..2b908d9 100644 > --- a/js/PostfixMailQueue.js > +++ b/js/PostfixMailQueue.js > @@ -58,16 +58,16 @@ Ext.define('PMG.Postfix.MailQueue', { > view.delayFilterTask.delay(500); > }, > > - onFlush: function (button, event, rec) { > + doAction: function(action, message) { > var view = this.getView(); > let sel = view.getSelectionModel().getSelection(); > let ids = sel.map((r) => r.get('queue_id')); > > - let do_deliver = function () { > + let do_action = function(){ > Proxmox.Utils.API2Request({ > url: `/api2/extjs/nodes/${view.nodename}/postfix/queue/${view.queuename}`, > method: 'POST', > - params: { action: 'deliver', ids: ids.join(';') }, > + params: { action: action, ids: ids.join(';') }, > waitMsgTarget: view, > success: () => { > view.selModel.deselectAll(); > @@ -77,49 +77,29 @@ Ext.define('PMG.Postfix.MailQueue', { > }); > } > > - if (sel.length === 1) { > - do_deliver(); > - } else if (sel.length > 1) { > + if (sel.length === 1 && action === 'deliver') { > + do_action(action, ids); > + } else { > Ext.Msg.show({ > title: gettext('Confirm'), > - message: Ext.String.format(gettext("Deliver {0} selected mails now?"), ids.length), here it was 'deliver ... now?' > + message: Ext.String.format(message, ids.length), > buttons: Ext.Msg.YESNO, > icon: Ext.Msg.INFO, > fn: function (btn) { > - if (btn === 'yes') { do_deliver(); } > + if (btn === 'yes') { do_action(action, ids); } > }, > }); > } > }, > > - onRemove: function (button, event, rec) { > - var view = this.getView(); > - let sel = view.getSelectionModel().getSelection(); > - let ids = sel.map((r) => r.get('queue_id')); > - > - let do_delete = function () { > - Proxmox.Utils.API2Request({ > - url: `/api2/extjs/nodes/${view.nodename}/postfix/queue/${view.queuename}`, > - method: 'POST', > - params: { action: 'delete', ids: ids.join(';') }, > - waitMsgTarget: view, > - success: () => { > - view.selModel.deselectAll(); > - view.store.load(); > - }, > - failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus), > - }); > - } > + onFlush: function (button, event, rec) { > + let message = gettext("Deliver {0} selected mails?"); vs here it's 'deliver ...?' > + this.doAction('deliver', message); > + }, > > - Ext.Msg.show({ > - title: gettext('Confirm'), > - message: Ext.String.format(gettext("Delete {0} selected mails?"), ids.length), > - buttons: Ext.Msg.YESNO, > - icon: Ext.Msg.INFO, > - fn: function (btn) { > - if (btn === 'yes') { do_delete(); } > - }, > - }); > + onRemove: function (button, event, rec) { > + let message = gettext("Delete {0} selected mails?"); > + this.doAction('delete', message); > }, > > onHeaders: function (button, event, rec) { _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel