[pve-devel] [PATCH manager] fix editor and set_button_status for cloudinit

Dominik Csapak d.csapak at proxmox.com
Fri Apr 6 10:22:44 CEST 2018


cloudinit images do not have an editor so return here
and value has to be a string to match
also set the remove button text correctly when selecting a cloudinit disk

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/qemu/HardwareView.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index e726cb70..b597e172 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -248,7 +248,9 @@ Ext.define('PVE.qemu.HardwareView', {
 	    var editor = rowdef.editor;
 	    if (rowdef.tdCls == 'pve-itype-icon-storage') {
 		var value = me.getObjectValue(rec.data.key, '', true); 
-		if (value.match(/media=cdrom/)) {
+		if (value.match(/vm-.*-cloudinit/)) {
+		    return;
+		} else if (value.match(/media=cdrom/)) {
 		    editor = 'PVE.qemu.CDEdit';
 		}
 	    }
@@ -518,12 +520,12 @@ Ext.define('PVE.qemu.HardwareView', {
 		rowdef.tdCls == 'pve-itype-icon-storage' &&
 		(value && !value.match(/media=cdrom/));
 
-	    var isCloudInit = (value && value.match(/vm-.*-cloudinit/));
+	    var isCloudInit = (value && value.toString().match(/vm-.*-cloudinit/));
 
 	    var isEfi = (key === 'efidisk0');
 
 	    remove_btn.setDisabled(rec.data['delete'] || (rowdef.never_delete === true));
-	    remove_btn.setText(isUsedDisk ? remove_btn.altText : remove_btn.defaultText);
+	    remove_btn.setText((isUsedDisk && !isCloudInit) ? remove_btn.altText : remove_btn.defaultText);
 
 	    edit_btn.setDisabled(rec.data['delete'] || !rowdef.editor || isCloudInit);
 
-- 
2.11.0





More information about the pve-devel mailing list