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

Aaron Lauterer a.lauterer at proxmox.com
Mon Oct 7 15:23:51 CEST 2019


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

As suggested by Thomas in [0] I removed the gettext around the feature
names to have the same feature names accross all translations. This
should help if people start searching for a problem with them.

The check if the hint to set SPICE in display is using a regex in order
to detect SPICE set with multiple monitors.

[0]: https://pve.proxmox.com/pipermail/pve-devel/2019-October/039387.html

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..1642bf1d
--- /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: 'Folder Sharing',
+	    uncheckedValue: 0,
+	},
+	{
+	    xtype: 'proxmoxKVComboBox',
+	    itemId: 'videostreaming',
+	    name: 'videostreaming',
+	    value: 'off',
+	    fieldLabel: '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 (!/^qxl\d?$/.test(vga.type)) {
+	    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