[pve-devel] [PATCH v2 manager 1/1] Add 'type' option to AgentFeatureSelector

Matt Dunwoodie ncon at noconroy.net
Tue Nov 19 15:25:55 CET 2019


This adds an extra field to the AgentFeatureSelector that reflects the
change in qemu-server.

Changes since previous version:

 * Use map rather than if/else if/else for type display string.
 * Use Proxmox.Utils.unknownText for unknown type (should not occur with
   regular use).
 * Keep existing fields as boxLabel rather than fieldLabel, as they
   look crammed with fieldLabel.
 * Use __default__ for default option, to save space and replicate
   behaviour in other places.
 * Store option in advancedItems as it is a special case.

Even though the map only contains one item, it will be easily added to
in the future. There is only one item as there is no need to have a
string for "virtio" as it is not displayed because of __default__.

Signed-off-by: Matt Dunwoodie <ncon at noconroy.net>
---
 www/manager6/Utils.js                     | 13 ++++++++++---
 www/manager6/form/AgentFeatureSelector.js | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 55b06e50..15cd4f4c 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -276,10 +276,17 @@ Ext.define('PVE.Utils', { utilities: {
 	    var keystring = '' ;
 	    agentstring += ', ' + key + ': ';
 
-	    if (PVE.Parser.parseBoolean(value)) {
-		agentstring += Proxmox.Utils.enabledText;
+	    if (key === 'type') {
+		let map = {
+		    isa: "ISA",
+		};
+	        agentstring += map[value] || Proxmox.Utils.unknownText;
 	    } else {
-		agentstring += Proxmox.Utils.disabledText;
+		if (PVE.Parser.parseBoolean(value)) {
+		    agentstring += Proxmox.Utils.enabledText;
+		} else {
+		    agentstring += Proxmox.Utils.disabledText;
+		}
 	    }
 	});
 
diff --git a/www/manager6/form/AgentFeatureSelector.js b/www/manager6/form/AgentFeatureSelector.js
index 44ef2e57..4a968fdb 100644
--- a/www/manager6/form/AgentFeatureSelector.js
+++ b/www/manager6/form/AgentFeatureSelector.js
@@ -31,6 +31,20 @@ Ext.define('PVE.form.AgentFeatureSelector', {
 	},
     ],
 
+    advancedItems: [
+	{
+	    xtype: 'proxmoxKVComboBox',
+	    name: 'type',
+	    value: '__default__',
+	    deleteEmpty: false,
+	    fieldLabel: 'Type',
+	    comboItems: [
+		['__default__', Proxmox.Utils.defaultText + " (VirtIO)"],
+		['isa', 'ISA'],
+	    ],
+	}
+    ],
+
     onGetValues: function(values) {
 	var agentstr = PVE.Parser.printPropertyString(values, 'enabled');
 	return { agent: agentstr };
-- 
2.23.0




More information about the pve-devel mailing list