[pve-devel] [PATCH v3 manager 2/3] ui: add spice enhancements form component

Aaron Lauterer a.lauterer at proxmox.com
Fri Oct 4 12:09:13 CEST 2019


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 www/manager6/Makefile                         |  1 +
 www/manager6/form/SpiceEnhancementSelector.js | 60 +++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 www/manager6/form/SpiceEnhancementSelector.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 82e25c79..aa460c3b 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -66,6 +66,7 @@ JSSRC= 				                 	\
 	form/CalendarEvent.js				\
 	form/CephPoolSelector.js			\
 	form/PermPathSelector.js			\
+	form/SpiceEnhancementSelector.js		\
 	dc/Tasks.js					\
 	dc/Log.js					\
 	panel/StatusPanel.js				\
diff --git a/www/manager6/form/SpiceEnhancementSelector.js b/www/manager6/form/SpiceEnhancementSelector.js
new file mode 100644
index 00000000..7e98c044
--- /dev/null
+++ b/www/manager6/form/SpiceEnhancementSelector.js
@@ -0,0 +1,60 @@
+Ext.define('PVE.form.SpiceEnhancementSelector', {
+    extend: 'Proxmox.panel.InputPanel',
+    alias: 'widget.pveSpiceEnhancementSelector',
+    items: [
+	{
+	    xtype: 'proxmoxcheckbox',
+	    itemId: 'foldersharing',
+	    name: 'foldersharing',
+	    fieldLabel: gettext('Folder sharing'),
+	    uncheckedValue: 0,
+	},
+	{
+	    xtype: 'proxmoxKVComboBox',
+	    itemId: 'videostreaming',
+	    name: 'videostreaming',
+	    value: 'off',
+	    fieldLabel: gettext('Video streaming'),
+	    comboItems: [
+		['off', 'off'],
+		['all', 'all'],
+		['filter', 'filter'],
+	    ],
+	},
+	{
+	    xtype: 'displayfield',
+	    itemId: 'spicehint',
+	    userCls: 'pve-hint',
+	    value: gettext('To use these features set the display to SPICE in the hardware settings of the VM.'),
+	    hidden: true
+	}
+    ],
+
+    onGetValues: function(values) {
+	var ret = {};
+
+	if (values.videostreaming !== "off") {
+	    ret.videostreaming = values.videostreaming;
+	}
+	if (values.foldersharing) {
+	    ret.foldersharing = 1;
+	}
+	if (Ext.Object.isEmpty(ret)) {
+	    return { 'delete': 'spice_enhancements' };
+	}
+	var enhancements = PVE.Parser.printPropertyString(ret);
+	return { spice_enhancements: enhancements };
+    },
+
+    setValues: function(values) {
+	var vga = PVE.Parser.parsePropertyString(values.vga, 'type');
+	if (vga.type !== "qxl") {
+	    this.down('#spicehint').setVisible(true);
+	}
+	if (values.spice_enhancements) {
+	    var enhancements = PVE.Parser.parsePropertyString(values.spice_enhancements);
+	    enhancements['foldersharing'] = PVE.Parser.parseBoolean(enhancements['foldersharing'], 0);
+	    this.callParent([enhancements]);
+	}
+    },
+});
-- 
2.20.1





More information about the pve-devel mailing list