[pve-devel] [PATCH manager] remove unnecessary sort function in HardwareView.js

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Nov 7 09:14:33 CET 2018


On 11/6/18 12:14 PM, David Limbeck wrote:
> we're adding everything in the right order already so there's no need to
> sort them based on groups

Hmm,

Memory, Processor and Keyboard switches order with this.

Also if I add a serial port and then a USB (e.g., spice) one the order is
now switched until reload (as it does not gets ordered on change)

Not a really big issue, but you should at least mention that...

@Dominik do we really want this, or do we want a better sorter for the
increase of unused disks?

Because if I have holes in the unused disk id allocation the next detach
also results in a wrong order with this, until reopening of component or
page...

> 
> Signed-off-by: David Limbeck <d.limbeck at proxmox.com>
> ---
> this is in preparation for increased unused disks as unused disk 10-19
> would appear before disk 2
> 
>  www/manager6/qemu/HardwareView.js | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
> index f2a3e244..2a86e461 100644
> --- a/www/manager6/qemu/HardwareView.js
> +++ b/www/manager6/qemu/HardwareView.js
> @@ -233,16 +233,6 @@ Ext.define('PVE.qemu.HardwareView', {
>  	    };
>  	}
>  
> -	var sorterFn = function(rec1, rec2) {
> -	    var v1 = rec1.data.key;
> -	    var v2 = rec2.data.key;
> -	    var g1 = rows[v1].group || 0;
> -	    var g2 = rows[v2].group || 0;
> -	    
> -	    return (g1 !== g2) ? 
> -		(g1 > g2 ? 1 : -1) : (v1 > v2 ? 1 : (v1 < v2 ? -1 : 0));
> -	};
> -
>  	var reload = function() {
>  	    me.rstore.load();
>  	};
> @@ -627,7 +617,6 @@ Ext.define('PVE.qemu.HardwareView', {
>  		revert_btn
>  	    ],
>  	    rows: rows,
> -	    sorterFn: sorterFn,
>  	    listeners: {
>  		itemdblclick: run_editor,
>  		selectionchange: set_button_status
> 





More information about the pve-devel mailing list