[pve-devel] [PATCH manager v2] improve pending changes for qemu hardware in gui

Dominik Csapak d.csapak at proxmox.com
Tue May 3 09:26:42 CEST 2016


this patch fixes an access to an undefined value
if a disk/cd/network device was pending

also improve how this is displayed:
instead of
****
undefined
new value
****

show just the new value

this occured when having a new disk under pending,
or having a disk removal under pending

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes since v1:
 * fixed jslint errors
 www/manager6/grid/PendingObjectGrid.js | 4 ++--
 www/manager6/qemu/HardwareView.js      | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/www/manager6/grid/PendingObjectGrid.js b/www/manager6/grid/PendingObjectGrid.js
index 546afd3..d5702f2 100644
--- a/www/manager6/grid/PendingObjectGrid.js
+++ b/www/manager6/grid/PendingObjectGrid.js
@@ -55,7 +55,7 @@ Ext.define('PVE.grid.PendingObjectGrid', {
 		pending = undefined;
 	    }
 	} else {
-	    current = value;
+	    current = value || '';
 	    pending = record.data.pending;
 	}
 
@@ -64,7 +64,7 @@ Ext.define('PVE.grid.PendingObjectGrid', {
 	}
 
 	if (pending || pendingdelete) {
-	    return current + '<div style="color:red">' + pending + pendingdelete + '</div>';
+	    return current + '<div style="color:red">' + (pending || '') + pendingdelete + '</div>';
 	} else {
 	    return current;
 	}
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index e0460d2..b2c399d 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -439,8 +439,9 @@ Ext.define('PVE.qemu.HardwareView', {
 	    var rowdef = rows[key];
 
 	    var pending = rec.data['delete'] || me.hasPendingChanges(key);
-	    var isDisk = !key.match(/^unused\d+/) && 
-		(rowdef.tdCls == 'pve-itype-icon-storage' && !value.match(/media=cdrom/));
+	    var isDisk = !key.match(/^unused\d+/) &&
+		rowdef.tdCls == 'pve-itype-icon-storage' &&
+		(value && !value.match(/media=cdrom/));
 
 	    remove_btn.setDisabled(rec.data['delete'] || (rowdef.never_delete === true));
 
-- 
2.1.4





More information about the pve-devel mailing list