[pve-devel] r5843 - in pve-manager/pve2/www/new: . panel

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Apr 21 10:20:35 CEST 2011


Author: dietmar
Date: 2011-04-21 10:20:35 +0200 (Thu, 21 Apr 2011)
New Revision: 5843

Modified:
   pve-manager/pve2/www/new/StateProvider.js
   pve-manager/pve2/www/new/panel/ConfigPanel.js
   pve-manager/pve2/www/new/panel/Datacenter.js
   pve-manager/pve2/www/new/panel/KVMConfig.js
   pve-manager/pve2/www/new/panel/NodeConfig.js
   pve-manager/pve2/www/new/panel/StorageBrowser.js
Log:
fix history state handling


Modified: pve-manager/pve2/www/new/StateProvider.js
===================================================================
--- pve-manager/pve2/www/new/StateProvider.js	2011-04-20 11:35:02 UTC (rev 5842)
+++ pve-manager/pve2/www/new/StateProvider.js	2011-04-21 08:20:35 UTC (rev 5843)
@@ -45,13 +45,19 @@
 	    'view',
 	    'rid',
 	    'ltab',
-	    'ctab'
+	    'nodetab',
+	    'storagetab',
+	    'kvmtab',
+	    'dctab'
 	];
  
 	var defaults = {
 	    view: 'server',
 	    ltab: 'clog',
-	    ctab: 'search',
+	    nodetab: '',
+	    storagetab: '',
+	    kvmtab: '',
+	    dctab: '',
 	    rid: 'root'
 	};
 

Modified: pve-manager/pve2/www/new/panel/ConfigPanel.js
===================================================================
--- pve-manager/pve2/www/new/panel/ConfigPanel.js	2011-04-20 11:35:02 UTC (rev 5842)
+++ pve-manager/pve2/www/new/panel/ConfigPanel.js	2011-04-21 08:20:35 UTC (rev 5843)
@@ -9,7 +9,8 @@
     initComponent: function() {
         var me = this;
 
-	var stateid = 'ctab';
+	var stateid = me.hstateid;
+
 	var sp = Ext.state.Manager.getProvider();
 
 	var items = me.items || [];
@@ -30,44 +31,53 @@
 
 	if (me.showSearch) {
 	    items.unshift({
-		id: 'search',
 		itemId: 'search', 
-		border: false,
 		xtype: 'pveResourceGrid'
 	    });
 	}
 
 	Ext.apply(me, {
 	    listeners: {
-		tabchange: function() {
-		    var atab = me.getActiveTab().itemId;
-		    var state = { value: atab };
-		    sp.set(stateid, state);
+		tabchange: function(tp, newcard, oldcard) {
+		    var ntab = newcard.itemId;
+		    // Note: '' is alias for first tab.
+		    // First tab can be 'search' or something else
+		    if (newcard.itemId === 'search')
+			ntab = '';
+		    var state = { value: ntab };
+		    if (stateid) {
+			sp.set(stateid, state);
+
+		    }
 		}
 	    },
 	    items: items
 	});
 
-	var state = sp.get(stateid);
-	if (state && state.value) {
-	    me.activeTab = state.value;
+	if (stateid) {
+	    var state = sp.get(stateid);
+	    if (state && state.value) {
+		me.activeTab = state.value;
+	    }
 	}
 
 	me.callParent();
 
 	var statechange = function(sp, key, state) {
-	    if (key === stateid) {
+	    if (stateid && key === stateid) {
 		var atab = me.getActiveTab().itemId;
-		var ntab = state.value;
+		var ntab = state.value || items[0].itemId;
 		if (state && ntab && (atab != ntab)) {
 		    me.setActiveTab(ntab);
 		}
 	    }
 	};
 
-	sp.on('statechange', statechange);
-	me.on('destroy', function() {
-	    sp.un('statechange', statechange);		    
-	});
+	if (stateid) {
+	    sp.on('statechange', statechange);
+	    me.on('destroy', function() {
+		sp.un('statechange', statechange);		    
+	    });
+	}
     }
 });

Modified: pve-manager/pve2/www/new/panel/Datacenter.js
===================================================================
--- pve-manager/pve2/www/new/panel/Datacenter.js	2011-04-20 11:35:02 UTC (rev 5842)
+++ pve-manager/pve2/www/new/panel/Datacenter.js	2011-04-21 08:20:35 UTC (rev 5843)
@@ -7,6 +7,7 @@
 
 	Ext.apply(me, {
 	    title: "Datacenter",
+	    hstateid: 'dctab',
 	    items: [
 		{
 		    title: 'Summary',

Modified: pve-manager/pve2/www/new/panel/KVMConfig.js
===================================================================
--- pve-manager/pve2/www/new/panel/KVMConfig.js	2011-04-20 11:35:02 UTC (rev 5842)
+++ pve-manager/pve2/www/new/panel/KVMConfig.js	2011-04-21 08:20:35 UTC (rev 5843)
@@ -16,7 +16,9 @@
 	var vmname = me.pveSelNode.data.name;
 	var descr = vmname ? "'" + vmname + "' " : '';
 	Ext.apply(me, {
-	    title: "Virtual machine " + descr + "'KVM " + vmid + "' on node '" + nodename + "'",
+	    title: "Virtual machine " + descr + "'KVM " + vmid + 
+		"' on node '" + nodename + "'",
+	    hstateid: 'kvmtab',
 	    items: [
 		{
 		    title: 'Summary',

Modified: pve-manager/pve2/www/new/panel/NodeConfig.js
===================================================================
--- pve-manager/pve2/www/new/panel/NodeConfig.js	2011-04-20 11:35:02 UTC (rev 5842)
+++ pve-manager/pve2/www/new/panel/NodeConfig.js	2011-04-21 08:20:35 UTC (rev 5843)
@@ -11,7 +11,7 @@
 
 	Ext.apply(me, {
 	    title: "Node '" + nodename + "'",
-
+	    hstateid: 'nodetab',
 	    items: [
 		{
 		    title: 'Summary',

Modified: pve-manager/pve2/www/new/panel/StorageBrowser.js
===================================================================
--- pve-manager/pve2/www/new/panel/StorageBrowser.js	2011-04-20 11:35:02 UTC (rev 5842)
+++ pve-manager/pve2/www/new/panel/StorageBrowser.js	2011-04-21 08:20:35 UTC (rev 5843)
@@ -15,6 +15,7 @@
 
 	Ext.apply(me, {
 	    title: "Storage '" + storeid + "'" + "' on node '" + nodename + "'",
+	    hstateid: 'storagetab',
 	    items: [
 		{
 		    title: 'Summary',




More information about the pve-devel mailing list