all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH manager 1/2] ui: dc: backup edit: add filter for guests without backup job
Date: Thu,  1 Oct 2026 15:13:08 +0200	[thread overview]
Message-ID: <20261001131309.172079-2-e.huhsovitz@proxmox.com> (raw)
In-Reply-To: <20261001131309.172079-1-e.huhsovitz@proxmox.com>

Add a checkbox in the guest selector toolbar that shows only guests
which are not covered by any backup job. The window fetches the guest
list from /cluster/backup-info/not-backed-up once and caches it for the
lifetime of the edit window.

Use a named node filter when the node selector changes instead of
clearing all store filters. This keeps the new filter and the review
filter active across node changes.

Signed-off-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
---
 www/manager6/dc/Backup.js | 70 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 66 insertions(+), 4 deletions(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index d3db9d9c..62f1838b 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -66,10 +66,14 @@ Ext.define('PVE.dc.BackupEdit', {
 
             me.resetSearch();
 
-            store.clearFilter();
-            store.filterBy(function (rec) {
-                return !value || rec.get('node') === value;
-            });
+            store.removeFilter('vmgrid-node');
+            if (value) {
+                store.addFilter({
+                    id: 'vmgrid-node',
+                    property: 'node',
+                    value: value,
+                });
+            }
 
             if (value) {
                 let selModel = vmgrid.getSelectionModel();
@@ -246,6 +250,45 @@ Ext.define('PVE.dc.BackupEdit', {
             }
         },
 
+        noBackupJobFilterChange: function (checkbox, checked) {
+            let me = this;
+            let store = me.lookup('vmgrid').getStore();
+
+            if (!checked) {
+                store.removeFilter(me.noJobFilter);
+                return;
+            }
+
+            if (me.noJobVmIds) {
+                store.addFilter(me.noJobFilter);
+                return;
+            }
+
+            checkbox.setDisabled(true);
+            Proxmox.Utils.API2Request({
+                url: '/cluster/backup-info/not-backed-up',
+                method: 'GET',
+                success: function (response) {
+                    let noJobVmIds = {};
+                    let data = response.result.data || [];
+                    for (const rec of data) {
+                        noJobVmIds[String(rec.vmid)] = true;
+                    }
+                    me.noJobVmIds = noJobVmIds;
+
+                    if (checkbox.getValue()) {
+                        store.addFilter(me.noJobFilter);
+                    }
+                    checkbox.setDisabled(false);
+                },
+                failure: function (response) {
+                    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+                    checkbox.setValue(false);
+                    checkbox.setDisabled(false);
+                },
+            });
+        },
+
         init: function (view) {
             let me = this;
 
@@ -254,6 +297,15 @@ Ext.define('PVE.dc.BackupEdit', {
                 scope: me,
                 filterFn: me.reviewFn,
             });
+
+            me.noJobFilter = new Ext.util.Filter({
+                id: 'vmgrid-no-job',
+                scope: me,
+                filterFn: function (record) {
+                    return me.noJobVmIds && me.noJobVmIds[String(record.get('vmid'))];
+                },
+            });
+
             me.lookup('searchField').setTargetStore(me.lookup('vmgrid').getStore());
 
             if (view.isCreate) {
@@ -463,6 +515,16 @@ Ext.define('PVE.dc.BackupEdit', {
                                     '->',
                                     {
                                         xtype: 'proxmoxcheckbox',
+                                        reference: 'noBackupJobCheckbox',
+                                        boxLabel: gettext('Only guests without backup job'),
+                                        submitValue: false,
+                                        listeners: {
+                                            change: 'noBackupJobFilterChange',
+                                        },
+                                    },
+                                    {
+                                        xtype: 'proxmoxcheckbox',
+                                        reference: 'reviewCheckbox',
                                         boxLabel: gettext('Review'),
                                         submitValue: false,
                                         listeners: {
-- 
2.47.3





  reply	other threads:[~2026-10-01 13:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 13:13 [PATCH manager 0/2] ui: dc: backup edit: add filter for guests without backup job Elias Huhsovitz
2026-10-01 13:13 ` Elias Huhsovitz [this message]
2026-10-01 13:13 ` [PATCH manager 2/2] ui: dc: backup edit: add missing / to not-backed-up url Elias Huhsovitz

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=20261001131309.172079-2-e.huhsovitz@proxmox.com \
    --to=e.huhsovitz@proxmox.com \
    --cc=pve-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal