]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: backup job: disable zstd thread count field when zstd isn't used
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 16 Apr 2024 12:09:54 +0000 (14:09 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Apr 2024 14:05:09 +0000 (16:05 +0200)
Also need to check for enable/disable of the compression selector,
because with PBS the value zstd is set, but the thread count setting
doesn't apply.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/dc/Backup.js
www/manager6/panel/BackupAdvancedOptions.js

index 7024df6c355d998de19f9f1dcabf74ec9a218a27..6913dbfa1a20bbafb4b610bdfae6656ef30b0e96 100644 (file)
@@ -145,6 +145,18 @@ Ext.define('PVE.dc.BackupEdit', {
            }
        },
 
+       compressionChange: function(f, value, oldValue) {
+           this.getView().lookup('backupAdvanced').updateCompression(value, f.isDisabled());
+       },
+
+       compressionDisable: function(f) {
+           this.getView().lookup('backupAdvanced').updateCompression(f.getValue(), true);
+       },
+
+       compressionEnable: function(f) {
+           this.getView().lookup('backupAdvanced').updateCompression(f.getValue(), false);
+       },
+
        init: function(view) {
            let me = this;
            if (view.isCreate) {
@@ -359,6 +371,11 @@ Ext.define('PVE.dc.BackupEdit', {
                                        deleteEmpty: '{!isCreate}',
                                    },
                                    value: 'zstd',
+                                   listeners: {
+                                       change: 'compressionChange',
+                                       disable: 'compressionDisable',
+                                       enable: 'compressionEnable',
+                                   },
                                },
                                {
                                    xtype: 'pveBackupModeSelector',
@@ -473,6 +490,7 @@ Ext.define('PVE.dc.BackupEdit', {
                },
                {
                    xtype: 'pveBackupAdvancedOptionsPanel',
+                   reference: 'backupAdvanced',
                    title: gettext('Advanced'),
                    cbind: {
                        isCreate: '{isCreate}',
index 4d74ba3d1bd55bae6bf415d47edabc8f0848878c..11a39352755c36341f775e0d8596dc8071cae3b2 100644 (file)
@@ -12,6 +12,10 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
        return {};
     },
 
+    controller: {
+       xclass: 'Ext.app.ViewController',
+    },
+
     onGetValues: function(formValues) {
        if (this.needMask) { // isMasked() may not yet be true if not rendered once
            return {};
@@ -54,6 +58,14 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
        return options;
     },
 
+    updateCompression: function(value, disabled) {
+       if (!disabled && value === 'zstd') {
+           this.lookup('zstdThreadCount').setDisabled(false);
+       } else {
+           this.lookup('zstdThreadCount').setDisabled(true);
+       }
+    },
+
     column1: [
        {
            xtype: 'pveBandwidthField',
@@ -71,6 +83,7 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
        {
            xtype: 'proxmoxintegerfield',
            name: 'zstd',
+           reference: 'zstdThreadCount',
            fieldLabel: Ext.String.format(gettext('{0} Threads'), 'Zstd'),
            fieldStyle: 'text-align: right',
            emptyText: gettext('use fallback'),