[pve-devel] [PATCH manager 6/7] ext6migrate: change setContent behaviour of workspace

Dominik Csapak d.csapak at proxmox.com
Fri Mar 11 15:57:33 CET 2016


instead of removing the current content and setting the new
we add the new content to the next card of the content container
(which now has the card layout, same as in the wizard)

then seamlessly change the active card, and then destroy the old card
with a delay

this has three reasons:
on a change, the panel does not flicker anymore
we give the old content time to finish ajax request (avoid race
conditions)
and we (hopefully) load the new content faster as the destroy
process can take some time

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Workspace.js | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index e16bc30..ff1c27d 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -188,14 +188,23 @@ Ext.define('PVE.StdWorkspace', {
 	var me = this;
 	
 	var cont = me.child('#content');
-	cont.removeAll(true);
+
+	var lay = cont.getLayout();
+
+	var cur = lay.getActiveItem();
 
 	if (comp) {
 	    PVE.Utils.setErrorMask(cont, false);
 	    comp.border = false;
 	    cont.add(comp);
-	    cont.updateLayout();
-	} 
+	    if (cur !== null && lay.getNext()) {
+		lay.next();
+		var task = Ext.create('Ext.util.DelayedTask', function(){
+		    cont.remove(cur);
+		});
+		task.delay(10);
+	    }
+	}
 	// else {
 	    // TODO: display something useful
 
@@ -411,7 +420,7 @@ Ext.define('PVE.StdWorkspace', {
 		    region: 'center',
 		    id: 'content',
 		    xtype: 'container',
-		    layout: { type: 'fit' },
+		    layout: { type: 'card' },
 		    border: false,
 		    stateful: false,
 		    margin: '0 5 0 0',
-- 
2.1.4





More information about the pve-devel mailing list