[pve-devel] [PATCH manager v2 3/4] spice: Add enhanecements to VM Options panel
Aaron Lauterer
a.lauterer at proxmox.com
Wed Sep 18 16:11:09 CEST 2019
On 9/18/19 12:12 PM, Dominik Csapak wrote:
> On 9/17/19 11:35 AM, Aaron Lauterer wrote:
>> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
>> ---
>> www/manager6/Utils.js | 18 ++++++++++++++++++
>> www/manager6/qemu/Options.js | 13 +++++++++++++
>> 2 files changed, 31 insertions(+)
>>
>> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
>> index 6a489e7e..a9adb382 100644
>> --- a/www/manager6/Utils.js
>> +++ b/www/manager6/Utils.js
>> @@ -334,6 +334,24 @@ Ext.define('PVE.Utils', { utilities: {
>> }
>> },
>> + render_spice_enhancements: function(values) {
>> + if (!values) {
>> + return Proxmox.Utils.disabledText;
>> + }
>> + var props = PVE.Parser.parsePropertyString(values);
>> + if (Ext.Object.isEmpty(props)) {
>> + return Proxmox.Utils.disabledText;
>> + }
>
> you can combine those cases with:
>
> let props = PVE.Parser.parsePropertyString(values || {});
I tried it but unfortunately parsePropertyString does not take an empty
object, or empty string, without defining a default key. Since all
options for now are optional we cannot define a default key.
My approach for now would be to define the disabled return text once at
the beginning and then use that variable as the return value in both if
statements.
>
>> + var output = [];
>> + if (PVE.Parser.parseBoolean(props.foldersharing)) {
>> + output.push(gettext("Folder sharing enabled"));
>> + }
>> + if (props.videostreaming === "all" || props.videostreaming ===
>> "filter") {
>> + output.push(gettext("Video Streaming") + ": " +
>> props.videostreaming);
>> + }
>> + return output.join(", ");
>> + },
>> +
>> // fixme: auto-generate this
>> // for now, please keep in sync with PVE::Tools::kvmkeymaps
>> kvm_keymaps: {
>> diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
>> index e1580060..96eb0499 100644
>> --- a/www/manager6/qemu/Options.js
>> +++ b/www/manager6/qemu/Options.js
>> @@ -281,6 +281,19 @@ Ext.define('PVE.qemu.Options', {
>> }
>> } : undefined
>> },
>> + spice_enhancements: {
>> + header: gettext('Spice Enhancements'),
>> + defaultValue: false,
>> + renderer: PVE.Utils.render_spice_enhancements,
>> + editor: caps.vms['VM.Config.Options'] ? {
>> + xtype: 'proxmoxWindowEdit',
>> + subject: gettext('Spice Enhancements'),
>> + items: {
>> + xtype: 'pveSpiceEnhancementSelector',
>> + name: 'spice_enhancements',
>> + }
>> + } : undefined
>> + },
>> hookscript: {
>> header: gettext('Hookscript')
>> }
>>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
More information about the pve-devel
mailing list