[pve-devel] [PATCH manager] Fix 2718: GUI: handle localtime option correctly
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon May 18 17:02:14 CEST 2020
On 5/11/20 12:40 PM, Fabian Ebner wrote:
> The backend treats undef and 0 differently. If the option
> is undef, it will still be set for Windows in config_to_command.
>
> Make sure that the default value in the GUI is different from 0 and
> is displayed with that additional information, and don't delete
> the option if it's set to 0.
>
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
> www/manager6/Utils.js | 7 +++++++
> www/manager6/qemu/Options.js | 6 +++---
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
> index 0cce81d4..24e7f1e2 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 === 'undef') {
> + 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..658d081f 100644
> --- a/www/manager6/qemu/Options.js
> +++ b/www/manager6/qemu/Options.js
> @@ -212,8 +212,8 @@ Ext.define('PVE.qemu.Options', {
> },
> localtime: {
> header: gettext('Use local time for RTC'),
> - defaultValue: false,
> - renderer: Proxmox.Utils.format_boolean,
> + defaultValue: 'undef',
hmm, IIRC, this is not really used anywhere else - why not using "undefined"?
> + renderer: PVE.Utils.render_localtime,
> editor: caps.vms['VM.Config.Options'] ? {
> xtype: 'proxmoxWindowEdit',
> subject: gettext('Use local time for RTC'),
> @@ -222,7 +222,7 @@ Ext.define('PVE.qemu.Options', {
> name: 'localtime',
> uncheckedValue: 0,
> defaultValue: 0,
> - deleteDefaultValue: true,
> + deleteDefaultValue: false,
this is now still a checkbox, which means one can never go back to the "undefined"
value.. Switching it over to a combobox allowing one to select any of the tri-state
values is probably better..
> labelWidth: 140,
> fieldLabel: gettext('Use local time for RTC')
> }
>
More information about the pve-devel
mailing list