[pve-devel] [PATCH manager v5 5/8] Add a field to show which SCSI controller type we are currently using

Emmanuel Kasper e.kasper at proxmox.com
Thu Oct 5 15:30:13 CEST 2017


We use the field label 'SCSI Controller'. 'Type' is redundant, otherwise
we would have Network Card Type, Display Type, Network Card type, etc ...
---
changes since v4:
 * rename the field label to SCSI Controller, and the associated
  component reference to scsiController.

 www/manager6/qemu/HDEdit.js  | 15 ++++++++++++---
 www/manager6/qemu/Options.js |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 8a415d8b..b6f08080 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -24,11 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
 		this.lookup('iothread').setValue(false);
 	    }
 
-	    var allowDiscard = value.match(/^scsi/);
-	    this.lookup('discard').setDisabled(!allowDiscard);
-	    if (!allowDiscard) {
+	    var scsi = value.match(/^scsi/);
+	    this.lookup('discard').setDisabled(!scsi);
+	    if (!scsi) {
 		this.lookup('discard').setValue(false);
 	    }
+	    this.lookup('scsiController').setVisible(scsi);
 	},
 
 	control: {
@@ -141,6 +142,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
 	if (me.bussel) {
 	    me.bussel.setVMConfig(vmconfig);
+	    me.scsiController.setValue(vmconfig.scsihw);
 	}
 	if (me.unusedDisks) {
 	    var disklist = [];
@@ -195,6 +197,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
 		vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
 	    });
 	    me.column1.push(me.bussel);
+	    me.scsiController = Ext.create('Ext.form.field.Display', {
+		fieldLabel: gettext('SCSI Controller'),
+		reference: 'scsiController',
+		renderer: PVE.Utils.render_scsihw,
+		hidden: true
+	    });
+	    me.column1.push(me.scsiController);
 	}
 
 	if (me.unused) {
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 9dc36d70..b5d32537 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -175,7 +175,7 @@ Ext.define('PVE.qemu.Options', {
 		} : undefined
 	    },
 	    scsihw: {
-		header: gettext('SCSI Controller Type'),
+		header: gettext('SCSI Controller'),
 		editor: caps.vms['VM.Config.Options'] ? 'PVE.qemu.ScsiHwEdit' : undefined,
 		renderer: PVE.Utils.render_scsihw,
 		defaultValue: ''
-- 
2.11.0




More information about the pve-devel mailing list