[pve-devel] [PATCH manager] fix #1884: qemu vm: pending deletion of cdrom/dvd drive shows as hard disk in hardware tab

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Aug 24 10:51:14 CEST 2018


On 8/23/18 3:50 PM, David Limbeck wrote:
> Signed-off-by: David Limbeck <d.limbeck at proxmox.com>
> ---
>  www/manager6/qemu/HardwareView.js | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
> index a87a9df1..9b99f77e 100644
> --- a/www/manager6/qemu/HardwareView.js
> +++ b/www/manager6/qemu/HardwareView.js
> @@ -14,7 +14,15 @@ Ext.define('PVE.qemu.HardwareView', {
>  	if (rowdef.tdCls) {
>  	    metaData.tdCls = rowdef.tdCls;
>  	    if (rowdef.tdCls == 'pve-itype-icon-storage') { 
> -		var value = me.getObjectValue(key, '', true);
> +		var oldValue = me.getObjectValue(key, '', false);
> +		var newValue = me.getObjectValue(key, '', true);
> +		var value;
> +		if(oldValue === '') {
> +		    value = newValue;
> +		}
> +		else {

coding style nit: we always place else on the same line as the closing bracket.

    [...]
} else {
    [...]

but why so complicate and not just somethingh alike:

----8<----
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index a87a9df1..df9847da 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -14,7 +14,10 @@ Ext.define('PVE.qemu.HardwareView', {
        if (rowdef.tdCls) {
            metaData.tdCls = rowdef.tdCls;
            if (rowdef.tdCls == 'pve-itype-icon-storage') {
-               var value = me.getObjectValue(key, '', true);
+               var value = me.getObjectValue(key, '', false);
+               if(value === '') {
+                   value = me.getObjectValue(key, '', true);
+               }
                if (value.match(/vm-.*-cloudinit/)) {
                    metaData.tdCls = 'pve-itype-icon-cloud';
                    return rowdef.cloudheader;
---->8----

?


> +		    value = oldValue;
> +		}
>  		if (value.match(/vm-.*-cloudinit/)) {
>  		    metaData.tdCls = 'pve-itype-icon-cloud';
>  		    return rowdef.cloudheader;
> 





More information about the pve-devel mailing list