From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C4D091FF191 for ; Tue, 23 Sep 2025 15:26:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B8B59FD53; Tue, 23 Sep 2025 15:27:13 +0200 (CEST) Message-ID: Date: Tue, 23 Sep 2025 15:27:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Hannes Laimer , pmg-devel@lists.proxmox.com References: <20250923093332.57010-1-h.laimer@proxmox.com> <20250923093332.57010-3-h.laimer@proxmox.com> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <20250923093332.57010-3-h.laimer@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758634017624 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.028 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [data.store] Subject: Re: [pmg-devel] [PATCH pmg-gui v2 1/1] fix #3450: ui: queue: multi-select for item 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" Am 23.09.25 um 11:34 schrieb Hannes Laimer: > ExtJS does not allow having a "select all" checkbox in the header for > buffered stores, that is why we have to use `Ext.data.Store` instead. > > Signed-off-by: Hannes Laimer > --- > filtering did not feel as instant as it did with the buffered store, but > not really noticable > > js/PostfixMailQueue.js | 104 +++++++++++++++++++++++++++-------------- > 1 file changed, 68 insertions(+), 36 deletions(-) > > diff --git a/js/PostfixMailQueue.js b/js/PostfixMailQueue.js > index 17c7d05..7fd690d 100644 > --- a/js/PostfixMailQueue.js > +++ b/js/PostfixMailQueue.js > @@ -22,8 +22,14 @@ Ext.define('PMG.Postfix.MailQueue', { > > queuename: 'deferred', > > + selModel: { > + selType: 'checkboxmodel', > + mode: 'MULTI', > + showHeaderCheckbox: true, > + }, > + > store: { > - xclass: 'Ext.data.BufferedStore', > + xclass: 'Ext.data.Store', > model: 'pmg-mailq', > remoteFilter: true, > remoteSort: true, > @@ -54,44 +60,62 @@ Ext.define('PMG.Postfix.MailQueue', { > > onFlush: function (button, event, rec) { > var view = this.getView(); > - > - Proxmox.Utils.API2Request({ > - url: > - '/api2/extjs/nodes/' + > - view.nodename + > - '/postfix/queue/' + > - view.queuename + > - '/' + > - rec.data.queue_id, > - method: 'POST', > - waitMsgTarget: view, > - failure: function (response, opts) { > - Ext.Msg.alert(gettext('Error'), response.htmlStatus); > - }, > - }); > + let sel = view.getSelectionModel().getSelection(); > + if (sel && sel.length > 0) { > + let ids = sel.map((r) => r.get('queue_id')); > + Ext.Msg.show({ > + title: gettext('Confirm'), > + message: Ext.String.format(gettext("Deliver {0} selected mails now?"), ids.length), > + buttons: Ext.Msg.YESNO, > + icon: Ext.Msg.WARNING, Is this really something we want to use a warning for? Also, will it now prompt for a single mail too? Would like to avoid doing that for the single mail edge case. > + fn: function (btn) { > + if (btn !== 'yes') { return; } > + Proxmox.Utils.API2Request({ > + url: > + '/api2/extjs/nodes/' + > + view.nodename + > + '/postfix/queue/' + > + view.queuename, could use a template string `/api2/extjs/nodes/${view.nodename}/postfix/queue/${view.queuename}` > + method: 'POST', > + params: { action: 'deliver', id: ids.join(';') }, > + waitMsgTarget: view, > + success: function () { view.selModel.deselectAll(); view.store.load(); }, would rather have above function split over multiple lines. > + failure: function (response) { Ext.Msg.alert(gettext('Error'), response.htmlStatus); }, can be written as: failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus), > + }); > + }, > + }); > + return; > + } > }, > > onRemove: function (button, event, rec) { > var view = this.getView(); > - > - Proxmox.Utils.API2Request({ > - url: > - '/api2/extjs/nodes/' + > - view.nodename + > - '/postfix/queue/' + > - view.queuename + > - '/' + > - rec.data.queue_id, > - method: 'DELETE', > - waitMsgTarget: view, > - success: function (response, opts) { > - view.selModel.deselectAll(); > - view.store.load(); > - }, > - failure: function (response, opts) { > - Ext.Msg.alert(gettext('Error'), response.htmlStatus); > - }, > - }); Most comments from above also apply to the code below. > + let sel = view.getSelectionModel().getSelection(); > + if (sel && sel.length > 0) { > + let ids = sel.map((r) => r.get('queue_id')); > + Ext.Msg.show({ > + title: gettext('Confirm'), > + message: Ext.String.format(gettext("Delete {0} selected mails?"), ids.length), > + buttons: Ext.Msg.YESNO, > + icon: Ext.Msg.WARNING, > + fn: function (btn) { > + if (btn !== 'yes') { return; } > + Proxmox.Utils.API2Request({ > + url: > + '/api2/extjs/nodes/' + > + view.nodename + > + '/postfix/queue/' + > + view.queuename, > + method: 'POST', > + params: { action: 'delete', id: ids.join(';') }, > + waitMsgTarget: view, > + success: function () { view.selModel.deselectAll(); view.store.load(); }, > + failure: function (response) { Ext.Msg.alert(gettext('Error'), response.htmlStatus); }, > + }); > + }, > + }); > + return; > + } > }, > > onHeaders: function (button, event, rec) { > @@ -130,6 +154,12 @@ Ext.define('PMG.Postfix.MailQueue', { > tbar: [ > { > xtype: 'proxmoxButton', > + reference: 'headerBtn', > + enableFn: function (rec) { > + let grid = this.up('grid'); > + if (!grid) { return false; } > + return grid.getSelectionModel().getCount() === 1; > + }, > disabled: true, > text: gettext('Headers'), > handler: 'onHeaders', > @@ -141,7 +171,9 @@ Ext.define('PMG.Postfix.MailQueue', { > handler: 'onFlush', > }, > { > - xtype: 'proxmoxStdRemoveButton', > + xtype: 'proxmoxButton', > + disabled: true, > + text: gettext('Remove'), > handler: 'onRemove', > }, > { _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel