public inbox for pbs-devel@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 v3 06/10] fix #7904: ui: job edit: introduce "Enable" checkbox for {sync,verify,tape,GC} jobs
Date: Fri,  9 Oct 2026 16:54:37 +0200	[thread overview]
Message-ID: <20261009145445.282494-4-j.theisen@proxmox.com> (raw)
In-Reply-To: <20261009145445.282494-1-j.theisen@proxmox.com>

This allow users to disable jobs from the UI using the "disable"
API paramter.

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.

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

diff --git a/www/tape/window/TapeBackupJob.js b/www/tape/window/TapeBackupJob.js
index ad03b6076..833672076 100644
--- a/www/tape/window/TapeBackupJob.js
+++ b/www/tape/window/TapeBackupJob.js
@@ -46,6 +46,14 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
         },
     },
 
+    setValues: function (values) {
+        let me = this;
+        if (!values.schedule || values.schedule === '') {
+            values.disable = true;
+        }
+        me.callParent([values]);
+    },
+
     items: {
         xtype: 'tabpanel',
         bodyPadding: 10,
@@ -66,6 +74,16 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
                         delete values.delete;
                     }
 
+                    values.disable = !values.enable;
+                    delete values.enable;
+
+                    return values;
+                },
+                onSetValues: function (values) {
+                    let _me = this;
+                    values.enable = !values.disable;
+                    delete values.disable;
+
                     return values;
                 },
                 cbind: {
@@ -112,13 +130,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 task.'),
+                        },
+                        listeners: {
+                            change: function (field, enabled) {
+                                let me = this;
+                                let view = me.up('pbsTapeBackupJobEdit');
+                                let schedule = view.down('field[name=schedule]');
+                                schedule.setDisabled(!enabled);
+                            },
+                        },
+                        uncheckedValue: false,
+                        value: true,
+                    },
                     {
                         fieldLabel: gettext('Schedule'),
                         xtype: 'pbsCalendarEvent',
                         name: 'schedule',
-                        emptyText: gettext('none (disabled)'),
+                        allowBlank: false,
                         cbind: {
-                            deleteEmpty: '{!isCreate}',
                             value: '{scheduleValue}',
                         },
                     },
diff --git a/www/window/GCJobEdit.js b/www/window/GCJobEdit.js
index 6afcf7de1..094bed874 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)'),
+    setValues: function (values) {
+        let me = this;
+        if (!values['gc-schedule'] || values['gc-schedule'] === '') {
+            values['gc-disable'] = true;
+        }
+
+        values['gc-enable'] = !values['gc-disable'];
+        delete values['gc-disable'];
+        me.callParent([values]);
+    },
+
+    getValues: function (dirtyOnly) {
+        let me = this;
+        let values = me.callParent([dirtyOnly]);
+
+        values['gc-disable'] = !values['gc-enable'];
+        delete values['gc-enable'];
+
+        return values;
     },
+
+    items: [
+        {
+            xtype: 'proxmoxcheckbox',
+            fieldLabel: gettext('Enable'),
+            name: 'gc-enable',
+            autoEl: {
+                tag: 'div',
+                'data-qtip': gettext('Enable scheduled execution of this task.'),
+            },
+            listeners: {
+                change: function (field, enabled) {
+                    let me = this;
+                    let view = me.up('pbsGCJobEdit');
+                    let schedule = view.down('field[name=gc-schedule]');
+                    schedule.setDisabled(!enabled);
+                },
+            },
+            uncheckedValue: false,
+            value: true,
+        },
+        {
+            xtype: 'pbsCalendarEvent',
+            name: 'gc-schedule',
+            fieldLabel: gettext('GC Schedule'),
+            allowBlank: false,
+        },
+    ],
 });
diff --git a/www/window/SyncJobEdit.js b/www/window/SyncJobEdit.js
index 961ce2951..42f6070f1 100644
--- a/www/window/SyncJobEdit.js
+++ b/www/window/SyncJobEdit.js
@@ -97,6 +97,10 @@ Ext.define('PBS.window.SyncJobEdit', {
         } else {
             values.location = 'remote';
         }
+
+        if (!values.schedule || values.schedule === '') {
+            values.disable = true;
+        }
         me.callParent([values]);
     },
 
@@ -130,6 +134,16 @@ Ext.define('PBS.window.SyncJobEdit', {
                         PBS.Utils.delete_if_default(values, 'rate-out');
                         PBS.Utils.delete_if_default(values, 'remote');
                     }
+                    values.disable = !values.enable;
+                    delete values.enable;
+
+                    return values;
+                },
+                onSetValues: function (values) {
+                    let _me = this;
+                    values.enable = !values.disable;
+                    delete values.disable;
+
                     return values;
                 },
                 cbind: {
@@ -203,13 +217,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 task.'),
+                        },
+                        listeners: {
+                            change: function (field, enabled) {
+                                let me = this;
+                                let view = me.up('pbsSyncJobEdit');
+                                let schedule = view.down('field[name=schedule]');
+                                schedule.setDisabled(!enabled);
+                            },
+                        },
+                        uncheckedValue: false,
+                        value: true,
+                    },
                     {
                         xtype: 'pbsCalendarEvent',
                         name: 'schedule',
                         fieldLabel: gettext('Sync Schedule'),
-                        emptyText: gettext('none'),
+                        allowBlank: false,
                         cbind: {
-                            deleteEmpty: '{!isCreate}',
                             value: '{scheduleValue}',
                         },
                     },
diff --git a/www/window/VerifyJobEdit.js b/www/window/VerifyJobEdit.js
index b8d8b5810..b4eda822f 100644
--- a/www/window/VerifyJobEdit.js
+++ b/www/window/VerifyJobEdit.js
@@ -80,6 +80,14 @@ Ext.define('PBS.window.VerifyJobEdit', {
         },
     },
 
+    setValues: function (values) {
+        let me = this;
+        if (!values.schedule || values.schedule === '') {
+            values.disable = true;
+        }
+        me.callParent([values]);
+    },
+
     items: {
         xtype: 'inputpanel',
         onGetValues: function (values) {
@@ -88,6 +96,16 @@ Ext.define('PBS.window.VerifyJobEdit', {
             if (!values.id && me.up('pbsVerifyJobEdit').isCreate) {
                 values.id = 'v-' + Ext.data.identifier.Uuid.Global.generate().slice(0, 13);
             }
+            values.disable = !values.enable;
+            delete values.enable;
+
+            return values;
+        },
+        onSetValues: function (values) {
+            let _me = this;
+            values.enable = !values.disable;
+            delete values.disable;
+
             return values;
         },
         column1: [
@@ -124,14 +142,32 @@ Ext.define('PBS.window.VerifyJobEdit', {
         ],
 
         column2: [
+            {
+                xtype: 'proxmoxcheckbox',
+                fieldLabel: gettext('Enable'),
+                name: 'enable',
+                autoEl: {
+                tag: 'div',
+                    'data-qtip': gettext('Enable scheduled execution of this task.'),
+                },
+                listeners: {
+                    change: function (field, enabled) {
+                        let me = this;
+                        let view = me.up('pbsVerifyJobEdit');
+                        let schedule = view.down('field[name=schedule]');
+                        schedule.setDisabled(!enabled);
+                    },
+                },
+                uncheckedValue: false,
+                value: true,
+            },
             {
                 xtype: 'pbsCalendarEvent',
                 name: 'schedule',
                 fieldLabel: gettext('Schedule'),
-                emptyText: gettext('none (disabled)'),
+                allowBlank: false,
                 cbind: {
                     value: '{scheduleValue}',
-                    deleteEmpty: '{!isCreate}',
                 },
             },
             {
-- 
2.47.3





  parent reply	other threads:[~2026-10-09 14:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 14:54 [PATCH proxmox-backup v3 03/10] ui: prune job: align prune edit window to other "Enable" checkboxes Jonas Theisen
2026-10-09 14:54 ` [PATCH proxmox-backup v3 04/10] api: prune job: align prune job schedule to other jobs Jonas Theisen
2026-10-09 14:54 ` [PATCH proxmox-backup v3 05/10] fix #7904: api: implement "disable" for {sync,verify,tape,GC} jobs Jonas Theisen
2026-10-09 14:54 ` Jonas Theisen [this message]
2026-10-09 14:54 ` [PATCH proxmox-backup v3 07/10] ui: improve visibility of disabled {sync,verify,tape,GC,prune} jobs on the overview page Jonas Theisen
2026-10-09 14:54 ` [PATCH proxmox-backup v3 08/10] ui: calendar-event: remove clear button from calendar selector Jonas Theisen
2026-10-09 14:54 ` [PATCH proxmox-backup v3 09/10] api: create datastore: allow creation without prune job Jonas Theisen
2026-10-09 14:54 ` [PATCH proxmox-backup v3 10/10] ui: create datastore: add enable checkboxes for {GC, prune} 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=20261009145445.282494-4-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 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