all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Jonas Theisen <j.theisen@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v5 7/9] fix #7904: ui: add "Enable" checkbox to {sync,verify,tape,GC} job edit
Date: Wed,  4 Nov 2026 15:53:33 +0100	[thread overview]
Message-ID: <20261104145405.441861-8-j.theisen@proxmox.com> (raw)
In-Reply-To: <20261104145405.441861-1-j.theisen@proxmox.com>

This allows users to disable jobs from the UI using the "disable"
API parameter.

This also disallows the schedule from being empty, since disabling
jobs can now be done with the "disable" parameter.

To avoid user confusion and remain backwards compatible, the
setValues function automatically sets the "disable" parameter to
true if the schedule is currently empty, i.e. the job is disabled.
For this to work the value for the checkbox needs to be set
explicitely despite the bind, since the viewModel binds the value
asynchronously and such the GET could finish before that happend
which would lose the value from the config.

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7904
Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
 www/tape/window/TapeBackupJob.js | 37 +++++++++++++++++++++--
 www/window/GCJobEdit.js          | 52 +++++++++++++++++++++++++++++---
 www/window/SyncJobEdit.js        | 34 +++++++++++++++++++--
 www/window/VerifyJobEdit.js      | 33 ++++++++++++++++++--
 4 files changed, 142 insertions(+), 14 deletions(-)

diff --git a/www/tape/window/TapeBackupJob.js b/www/tape/window/TapeBackupJob.js
index ad03b6076..4b431b8ad 100644
--- a/www/tape/window/TapeBackupJob.js
+++ b/www/tape/window/TapeBackupJob.js
@@ -46,6 +46,20 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
         },
     },
 
+    viewModel: {
+        data: {
+            jobEnabled: true,
+        },
+    },
+
+    setValues: function (values) {
+        let me = this;
+        if (!values.schedule) {
+            values.disable = true;
+        }
+        me.callParent([values]);
+    },
+
     items: {
         xtype: 'tabpanel',
         bodyPadding: 10,
@@ -66,8 +80,9 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
                         delete values.delete;
                     }
 
-                    return values;
+                    return PBS.Utils.enableToDisable(values);
                 },
+                onSetValues: (values) => PBS.Utils.disableToEnable(values),
                 cbind: {
                     isCreate: '{isCreate}', // pass it through
                 },
@@ -112,15 +127,31 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
                 ],
 
                 column2: [
+                    {
+                        xtype: 'proxmoxcheckbox',
+                        fieldLabel: gettext('Enable'),
+                        name: 'enable',
+                        autoEl: {
+                            tag: 'div',
+                            'data-qtip': gettext('Enable scheduled execution of this job.'),
+                        },
+                        bind: {
+                            value: '{jobEnabled}',
+                        },
+                        uncheckedValue: false,
+                        value: true, // value needs to be set despite bind for setValues to work
+                    },
                     {
                         fieldLabel: gettext('Schedule'),
                         xtype: 'pbsCalendarEvent',
                         name: 'schedule',
-                        emptyText: gettext('none (disabled)'),
+                        allowBlank: false,
                         cbind: {
-                            deleteEmpty: '{!isCreate}',
                             value: '{scheduleValue}',
                         },
+                        bind: {
+                            disabled: '{!jobEnabled}',
+                        },
                     },
                     {
                         fieldLabel: gettext('Export Media-Set'),
diff --git a/www/window/GCJobEdit.js b/www/window/GCJobEdit.js
index 6afcf7de1..ae221726d 100644
--- a/www/window/GCJobEdit.js
+++ b/www/window/GCJobEdit.js
@@ -19,10 +19,52 @@ Ext.define('PBS.window.GCJobEdit', {
         return {};
     },
 
-    items: {
-        xtype: 'pbsCalendarEvent',
-        name: 'gc-schedule',
-        fieldLabel: gettext('GC Schedule'),
-        emptyText: gettext('none (disabled)'),
+    viewModel: {
+        data: {
+            gcEnabled: true,
+        },
     },
+
+    setValues: function (values) {
+        let me = this;
+        if (!values['gc-schedule']) {
+            values['gc-disable'] = true;
+        }
+
+        PBS.Utils.disableToEnable(values, 'gc-');
+        me.callParent([values]);
+    },
+
+    getValues: function (dirtyOnly) {
+        let me = this;
+        let values = me.callParent([dirtyOnly]);
+
+        return PBS.Utils.enableToDisable(values, 'gc-');
+    },
+
+    items: [
+        {
+            xtype: 'proxmoxcheckbox',
+            fieldLabel: gettext('Enable'),
+            name: 'gc-enable',
+            autoEl: {
+                tag: 'div',
+                'data-qtip': gettext('Enable scheduled execution of this job.'),
+            },
+            bind: {
+                value: '{gcEnabled}',
+            },
+            uncheckedValue: false,
+            value: true, // value needs to be set despite bind for setValues to work
+        },
+        {
+            xtype: 'pbsCalendarEvent',
+            name: 'gc-schedule',
+            fieldLabel: gettext('GC Schedule'),
+            allowBlank: false,
+            bind: {
+                disabled: '{!gcEnabled}',
+            },
+        },
+    ],
 });
diff --git a/www/window/SyncJobEdit.js b/www/window/SyncJobEdit.js
index 961ce2951..0f12c9d65 100644
--- a/www/window/SyncJobEdit.js
+++ b/www/window/SyncJobEdit.js
@@ -90,6 +90,12 @@ Ext.define('PBS.window.SyncJobEdit', {
         },
     },
 
+    viewModel: {
+        data: {
+            jobEnabled: true,
+        },
+    },
+
     setValues: function (values) {
         let me = this;
         if (values.id && !values.remote) {
@@ -97,6 +103,10 @@ Ext.define('PBS.window.SyncJobEdit', {
         } else {
             values.location = 'remote';
         }
+
+        if (!values.schedule) {
+            values.disable = true;
+        }
         me.callParent([values]);
     },
 
@@ -130,8 +140,10 @@ Ext.define('PBS.window.SyncJobEdit', {
                         PBS.Utils.delete_if_default(values, 'rate-out');
                         PBS.Utils.delete_if_default(values, 'remote');
                     }
-                    return values;
+
+                    return PBS.Utils.enableToDisable(values);
                 },
+                onSetValues: (values) => PBS.Utils.disableToEnable(values),
                 cbind: {
                     isCreate: '{isCreate}', // pass it through
                 },
@@ -203,15 +215,31 @@ Ext.define('PBS.window.SyncJobEdit', {
                             deleteEmpty: '{!isCreate}',
                         },
                     },
+                    {
+                        xtype: 'proxmoxcheckbox',
+                        fieldLabel: gettext('Enable'),
+                        name: 'enable',
+                        autoEl: {
+                            tag: 'div',
+                            'data-qtip': gettext('Enable scheduled execution of this job.'),
+                        },
+                        bind: {
+                            value: '{jobEnabled}',
+                        },
+                        uncheckedValue: false,
+                        value: true, // value needs to be set despite bind for setValues to work
+                    },
                     {
                         xtype: 'pbsCalendarEvent',
                         name: 'schedule',
                         fieldLabel: gettext('Sync Schedule'),
-                        emptyText: gettext('none'),
+                        allowBlank: false,
                         cbind: {
-                            deleteEmpty: '{!isCreate}',
                             value: '{scheduleValue}',
                         },
+                        bind: {
+                            disabled: '{!jobEnabled}',
+                        },
                     },
                     {
                         xtype: 'pmxBandwidthField',
diff --git a/www/window/VerifyJobEdit.js b/www/window/VerifyJobEdit.js
index b8d8b5810..4b3fdae87 100644
--- a/www/window/VerifyJobEdit.js
+++ b/www/window/VerifyJobEdit.js
@@ -34,6 +34,7 @@ Ext.define('PBS.window.VerifyJobEdit', {
             ignoreVerified: true,
             defaultReadThreads: null,
             defaultVerifyThreads: null,
+            jobEnabled: true,
         },
     },
 
@@ -80,6 +81,14 @@ Ext.define('PBS.window.VerifyJobEdit', {
         },
     },
 
+    setValues: function (values) {
+        let me = this;
+        if (!values.schedule) {
+            values.disable = true;
+        }
+        me.callParent([values]);
+    },
+
     items: {
         xtype: 'inputpanel',
         onGetValues: function (values) {
@@ -88,8 +97,10 @@ Ext.define('PBS.window.VerifyJobEdit', {
             if (!values.id && me.up('pbsVerifyJobEdit').isCreate) {
                 values.id = 'v-' + Ext.data.identifier.Uuid.Global.generate().slice(0, 13);
             }
-            return values;
+
+            return PBS.Utils.enableToDisable(values);
         },
+        onSetValues: (values) => PBS.Utils.disableToEnable(values),
         column1: [
             {
                 xtype: 'pmxDisplayEditField',
@@ -124,14 +135,30 @@ Ext.define('PBS.window.VerifyJobEdit', {
         ],
 
         column2: [
+            {
+                xtype: 'proxmoxcheckbox',
+                fieldLabel: gettext('Enable'),
+                name: 'enable',
+                autoEl: {
+                    tag: 'div',
+                    'data-qtip': gettext('Enable scheduled execution of this job.'),
+                },
+                bind: {
+                    value: '{jobEnabled}',
+                },
+                uncheckedValue: false,
+                value: true, // value needs to be set despite bind for setValues to work
+            },
             {
                 xtype: 'pbsCalendarEvent',
                 name: 'schedule',
                 fieldLabel: gettext('Schedule'),
-                emptyText: gettext('none (disabled)'),
+                allowBlank: false,
                 cbind: {
                     value: '{scheduleValue}',
-                    deleteEmpty: '{!isCreate}',
+                },
+                bind: {
+                    disabled: '{!jobEnabled}',
                 },
             },
             {
-- 
2.47.3





  parent reply	other threads:[~2026-11-04 14:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 14:53 [PATCH proxmox{,-backup} v5 0/9] fix #7904: Implement Enable checkboxes for all jobs Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox v5 1/9] pbs-api-types: add 'disable' to {sync,verify,tape,gc} job schema and datastore config Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox v5 2/9] pbs-api-types: prune job: make schedule optional Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox-backup v5 3/9] server: schedules: add 'disable' parameter to compute_schedule_status() Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox-backup v5 4/9] ui: prune job: align prune edit window to other "Enable" checkboxes Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox-backup v5 5/9] api: prune job: align prune job schedule to other jobs Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox-backup v5 6/9] fix #7904: api: implement "disable" for {sync,verify,tape,GC} jobs Jonas Theisen
2026-11-04 14:53 ` Jonas Theisen [this message]
2026-11-04 14:53 ` [PATCH proxmox-backup v5 8/9] ui: job overview: show "Disabled" as schedule of disabled jobs Jonas Theisen
2026-11-04 14:53 ` [PATCH proxmox-backup v5 9/9] ui: calendar-event: hide clear button if a schedule is required Jonas Theisen

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=20261104145405.441861-8-j.theisen@proxmox.com \
    --to=j.theisen@proxmox.com \
    --cc=pbs-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