public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui 1/1] fix #3450: ui: add button to delete all queue entries matching a filter
Date: Fri, 19 Sep 2025 16:50:49 +0200	[thread overview]
Message-ID: <20250919145049.20077-3-h.laimer@proxmox.com> (raw)
In-Reply-To: <20250919145049.20077-1-h.laimer@proxmox.com>

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 js/PostfixMailQueue.js | 46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/js/PostfixMailQueue.js b/js/PostfixMailQueue.js
index 17c7d05..f51fb40 100644
--- a/js/PostfixMailQueue.js
+++ b/js/PostfixMailQueue.js
@@ -112,6 +112,45 @@ Ext.define('PMG.Postfix.MailQueue', {
             win.show();
         },
 
+        onDeleteFilter: function (button, event, rec) {
+            let view = this.getView();
+            let filter = view.lookupReference('filter').getValue();
+
+            if (!filter) {
+                Ext.Msg.alert(gettext('Error'), gettext('Please enter a filter first.'));
+                return;
+            }
+
+            Ext.Msg.show({
+                title: gettext('Confirm'),
+                message: Ext.String.format(
+                    gettext('Delete all mails in {0} queue matching filter: \'{1}\'?'),
+                    view.queuename,
+                    Ext.htmlEncode(filter)
+                ),
+                buttons: Ext.Msg.YESNO,
+                icon: Ext.Msg.WARNING,
+                fn: function (btn) {
+                    if (btn !== 'yes') { return; }
+                    let url =
+                        '/api2/extjs/nodes/' +
+                        view.nodename +
+                        '/postfix/queue/' +
+                        view.queuename +
+                        '?filter=' + encodeURIComponent(filter);
+                    Proxmox.Utils.API2Request({
+                        url: url,
+                        method: 'DELETE',
+                        waitMsgTarget: view,
+                        success: function () { view.store.load(); },
+                        failure: function (response) {
+                            Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+                        },
+                    });
+                },
+            });
+        },
+
         control: {
             '#': {
                 activate: function () {
@@ -144,6 +183,13 @@ Ext.define('PMG.Postfix.MailQueue', {
             xtype: 'proxmoxStdRemoveButton',
             handler: 'onRemove',
         },
+        '-',
+        {
+            xtype: 'proxmoxButton',
+            text: gettext('Delete Matching Filter'),
+            selModel: null,
+            handler: 'onDeleteFilter',
+        },
         {
             xtype: 'label',
             html: gettext('Filter') + ':',
-- 
2.47.3



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


      parent reply	other threads:[~2025-09-19 14:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 14:50 [pmg-devel] [PATCH pmg-api/pmg-gui 0/2] add support to delete multiple queue entries at once Hannes Laimer
2025-09-19 14:50 ` [pmg-devel] [PATCH pmg-api 1/1] fix #3450: api: add 'filter' parameter to queue DELETE endpoint Hannes Laimer
2025-09-19 14:50 ` Hannes Laimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250919145049.20077-3-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal