[pve-devel] [PATCH manager v2 2/4] spice: Add enhancements form component
Aaron Lauterer
a.lauterer at proxmox.com
Tue Sep 17 11:35:49 CEST 2019
Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/form/SpiceEnhancementSelector.js | 72 +++++++++++++++++++
2 files changed, 73 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..cbafd502
--- /dev/null
+++ b/www/manager6/form/SpiceEnhancementSelector.js
@@ -0,0 +1,72 @@
+Ext.define('PVE.form.SpiceEnhancementSelector', {
+ extend: 'Proxmox.panel.InputPanel',
+ alias: 'widget.pveSpiceEnhancementSelector',
+ insideWizard: false,
+
+ initComponent: function() {
+ var me = this;
+ me.items = [
+ {
+ xtype: 'displayfield',
+ value: gettext('Spice enhancements') + ':',
+ hidden: !me.insideWizard
+ },
+ {
+ xtype: 'proxmoxcheckbox',
+ itemId: 'foldersharing',
+ name: 'foldersharing',
+ submitValue: false,
+ fieldLabel: gettext('Folder sharing'),
+ uncheckedValue: 0,
+ },
+ {
+ xtype: 'proxmoxKVComboBox',
+ itemId: 'videostreaming',
+ name: 'videostreaming',
+ submitValue: false,
+ value: 'off',
+ fieldLabel: gettext('Video streaming'),
+ comboItems: [
+ ['off', 'off'],
+ ['all', 'all'],
+ ['filter', 'filter'],
+ ],
+ },
+ ];
+
+ me.callParent();
+ },
+
+ // handle submitted values manually to work in the VM create wizard as well.
+ // without submitValue = false the fields would be added to the config
+ onGetValues: function() {
+ var me = this;
+ if (me.disabled) {
+ return;
+ }
+
+ var values = {};
+ var foldersharing = me.down('field[name=foldersharing]').getValue();
+ var videostreaming = me.down('field[name=videostreaming]').getValue();
+
+ if (videostreaming !== "off") {
+ values.videostreaming = videostreaming;
+ }
+ if (foldersharing) {
+ values.foldersharing = 1;
+ }
+ if (Ext.Object.isEmpty(values)) {
+ return { 'delete': 'spice_enhancements' };
+ }
+ var enhancements = PVE.Parser.printPropertyString(values);
+ return { spice_enhancements: enhancements };
+ },
+
+ setValues: function(values) {
+ 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