The backend treats an undefined value and 0 differently. If the option
is undefined, it will still be set for Windows in config_to_command.
Replace the checkbox with a combobox covering all options.

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---

Changes from v1:
    * use a combobox with all options to allow
      users going back to the default value

 www/manager6/Utils.js        |  7 +++++++
 www/manager6/qemu/Options.js | 15 +++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 0cce81d4..676f56a8 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -273,6 +273,13 @@ Ext.define('PVE.Utils', { utilities: {
        return fa.join(', ');
     },
 
+    render_localtime: function(value) {
+       if (value === '__default__') {
+           return Proxmox.Utils.defaultText + ' (' + gettext('Enabled for 
Windows') + ')';
+       }
+       return Proxmox.Utils.format_boolean(value);
+    },
+
     render_qga_features: function(value) {
        if (!value) {
            return Proxmox.Utils.defaultText + ' (' + 
Proxmox.Utils.disabledText  + ')';
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 86f4ec40..21241044 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -212,17 +212,20 @@ Ext.define('PVE.qemu.Options', {
            },
            localtime: {
                header: gettext('Use local time for RTC'),
-               defaultValue: false,
-               renderer: Proxmox.Utils.format_boolean,
+               defaultValue: '__default__',
+               renderer: PVE.Utils.render_localtime,
                editor: caps.vms['VM.Config.Options'] ? {
                    xtype: 'proxmoxWindowEdit',
                    subject: gettext('Use local time for RTC'),
                    items: {
-                       xtype: 'proxmoxcheckbox',
+                       xtype: 'proxmoxKVComboBox',
                        name: 'localtime',
-                       uncheckedValue: 0,
-                       defaultValue: 0,
-                       deleteDefaultValue: true,
+                       value: '__default__',
+                       comboItems: [
+                           ['__default__', 
PVE.Utils.render_localtime('__default__')],
+                           [1, PVE.Utils.render_localtime(1)],
+                           [0, PVE.Utils.render_localtime(0)],
+                       ],
                        labelWidth: 140,
                        fieldLabel: gettext('Use local time for RTC')
                    }
-- 
2.20.1


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

Reply via email to