[pve-devel] [PATCH manager v5 4/5] added clipboard checkbox to VM Options

Markus Frank m.frank at proxmox.com
Wed Apr 12 10:57:30 CEST 2023


Signed-off-by: Markus Frank <m.frank at proxmox.com>
---
 www/manager6/qemu/DisplayEdit.js |  6 ++++++
 www/manager6/qemu/Options.js     | 34 ++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index 9bb1763e..05f12eed 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -4,6 +4,7 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
     onlineHelp: 'qm_display',
 
     onGetValues: function(values) {
+	values = Ext.apply(this.originalConfig, values);
 	let ret = PVE.Parser.printPropertyString(values, 'type');
 	if (ret === '') {
 	    return { 'delete': 'vga' };
@@ -11,6 +12,11 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 	return { vga: ret };
     },
 
+    onSetValues: function(values) {
+	this.originalConfig = values;
+	return values;
+    },
+
     items: [{
 	name: 'type',
 	xtype: 'proxmoxKVComboBox',
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 7b112400..58fd8a65 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -154,6 +154,40 @@ Ext.define('PVE.qemu.Options', {
 		    },
 		} : undefined,
 	    },
+	    vga: {
+		header: gettext('Use noVNC clipboard'),
+		defaultValue: false,
+		renderer: function(value) {
+		    let vga = PVE.Parser.parsePropertyString(value, 'type');
+		    return vga.clipboard ? Proxmox.Utils.yesText : Proxmox.Utils.noText;
+		},
+		editor: caps.vms['VM.Config.HWType'] ? {
+		    xtype: 'proxmoxWindowEdit',
+		    subject: gettext('Use noVNC clipboard'),
+		    onlineHelp: 'qm_display',
+		    items: {
+			xtype: 'pveDisplayInputPanel',
+			items: {
+			    xtype: 'proxmoxcheckbox',
+			    name: 'clipboard',
+			    uncheckedValue: 0,
+			    defaultValue: 0,
+			    itemId: 'clipboardBox',
+			    fieldLabel: gettext('Enabled'),
+			},
+			onGetValues: function(values) {
+			    values = Ext.apply(this.originalConfig, values);
+			    PVE.Utils.delete_if_default(values, 'clipboard', 0, 1);
+			    let ret = PVE.Parser.printPropertyString(values, 'type');
+			    return { vga: ret };
+			},
+			onSetValues: function(values) {
+			    this.originalConfig = PVE.Parser.parsePropertyString(values.vga, 'type');
+			    return this.originalConfig;
+			},
+		    },
+		} : undefined,
+	    },
 	    hotplug: {
 		header: gettext('Hotplug'),
 		defaultValue: 'disk,network,usb',
-- 
2.30.2






More information about the pve-devel mailing list