improve pending changes for qemu hardware in gui

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-05-03 09:26:42 +02:00 committed by Dietmar Maurer
parent c79b6aaf25
commit ea5e798cf3
3 changed files with 7 additions and 4 deletions

View File

@ -12,6 +12,8 @@ pve-manager (4.2-4) unstable; urgency=medium
* add undo Zoom Button
* improve pending changes for qemu hardware in gui
-- Proxmox Support Team <support@proxmox.com> Tue, 03 May 2016 06:33:55 +0200
pve-manager (4.2-3) unstable; urgency=medium

View File

@ -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;
}

View File

@ -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));