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

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Apr 8 09:53:40 CEST 2011


Author: dietmar
Date: 2011-04-08 09:53:40 +0200 (Fri, 08 Apr 2011)
New Revision: 5804

Added:
   pve-manager/pve2/www/new/panel/ConfigPanel.js
Modified:
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/StateProvider.js
   pve-manager/pve2/www/new/Workspace.js
   pve-manager/pve2/www/new/grid/ResourceGrid.js
Log:
start work on ConfigPanel


Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	2011-04-08 05:33:46 UTC (rev 5803)
+++ pve-manager/pve2/www/new/Makefile.am	2011-04-08 07:53:40 UTC (rev 5804)
@@ -11,7 +11,8 @@
 	form/ViewSelector.js				\
 	panel/StatusPanel.js				\
 	window/LoginWindow.js				\
-	grig/ResourceGrid.js				\
+	grid/ResourceGrid.js				\
+	panel/ConfigPanel.js				\
 	tree/ResourceTree.js				\
 	Workspace.js
 

Modified: pve-manager/pve2/www/new/StateProvider.js
===================================================================
--- pve-manager/pve2/www/new/StateProvider.js	2011-04-08 05:33:46 UTC (rev 5803)
+++ pve-manager/pve2/www/new/StateProvider.js	2011-04-08 07:53:40 UTC (rev 5804)
@@ -26,7 +26,8 @@
 	var list = [
 	    'view',
 	    'rid',
-	    'ltab'
+	    'ltab',
+	    'ctab'
 	];
 
 	Ext.Array.each(list, function(name) {

Modified: pve-manager/pve2/www/new/Workspace.js
===================================================================
--- pve-manager/pve2/www/new/Workspace.js	2011-04-08 05:33:46 UTC (rev 5803)
+++ pve-manager/pve2/www/new/Workspace.js	2011-04-08 07:53:40 UTC (rev 5804)
@@ -118,6 +118,9 @@
 		{
 		    region: 'center',
 		    id: 'content',
+		    xtype: 'panel',
+		    layout: 'fit',
+
 		    stateful: false,
 		    margins:'0 5 0 0',
 		    items: self.defaultView
@@ -132,11 +135,9 @@
 			listeners: {
 			    select: function(sm, n) {		    
 				var comp = { 
-				    xtype: 'panel',
+				    xtype: 'pveConfigPanel',
 				    layout: 'fit',
-				    html: "TEST",
 				    border: false,
-				    title: "NODE ID " + n.data.id,
 				    pveSelNode: n 
 				};
 				self.setView(comp);

Modified: pve-manager/pve2/www/new/grid/ResourceGrid.js
===================================================================
--- pve-manager/pve2/www/new/grid/ResourceGrid.js	2011-04-08 05:33:46 UTC (rev 5803)
+++ pve-manager/pve2/www/new/grid/ResourceGrid.js	2011-04-08 07:53:40 UTC (rev 5804)
@@ -1,4 +1,4 @@
-Ext.define('PVE.tree.ResourceGrid', {
+Ext.define('PVE.grid.ResourceGrid', {
     extend: 'Ext.grid.GridPanel',
     requires: ['PVE.Utils', 
 	       'PVE.data.ResourceStore'],
@@ -8,8 +8,15 @@
     initComponent : function() {
 	var me = this;
 
+	var store = PVE.data.ResourceStore;
+
 	Ext.apply(me, {
-	    title: 'Search'
+	    title: 'Search',
+	    store: store,
+            columns:[{
+		text: 'ID',
+		dataIndex: 'id'
+	    }]
 	});
 
 	me.callParent();

Added: pve-manager/pve2/www/new/panel/ConfigPanel.js
===================================================================
--- pve-manager/pve2/www/new/panel/ConfigPanel.js	                        (rev 0)
+++ pve-manager/pve2/www/new/panel/ConfigPanel.js	2011-04-08 07:53:40 UTC (rev 5804)
@@ -0,0 +1,69 @@
+Ext.define('PVE.panel.ConfigPanel', {
+    extend: 'Ext.tab.TabPanel',
+    requires: [
+	'Ext.state.Manager',
+	'PVE.grid.ResourceGrid'
+    ],
+    alias: 'widget.pveConfigPanel',
+
+    initComponent: function() {
+        var me = this;
+
+	var stateid = 'ctab';
+	var sp = Ext.state.Manager.getProvider();
+
+	var items = me.items || [];
+	me.items = null;
+
+	items.unshift({
+	    pveSelNode: me.pveSelNode,
+	    id: 'search',
+	    border: false,
+	    xtype: 'pveResourceGrid'
+	});
+
+	items.push({
+	    border: false,
+	    title: "TAB1",
+	    html: "test1"	    
+	});
+	items.push({
+	    border: false,
+	    title: "TAB2",
+	    html: "test2"	    
+	});
+
+	Ext.apply(me, {
+	    title: "NODE ID " + me.pveSelNode.data.id,
+	    listeners: {
+		tabchange: function() {
+		    var state = { value: me.items.indexOf(me.getActiveTab()) };
+		    sp.set(stateid, state);
+		}
+	    },
+	    items: items
+	});
+
+	var state = sp.get(stateid);
+	if (state && state.value) {
+	    me.activeTab = parseInt(state.value);
+	}
+
+	me.callParent();
+
+	var statechange = function(sp, key, state) {
+	    if (key === stateid) {
+		var atab = me.items.indexOf(me.getActiveTab());
+		var ntab = parseInt(state.value);
+		if (state && (ntab >= 0) && (atab != state.value)) {
+		    me.setActiveTab(ntab);
+		}
+	    }
+	};
+
+	sp.on('statechange', statechange);
+	me.on('destroy', function() {
+	    sp.un('statechange', statechange);		    
+	});
+    }
+});




More information about the pve-devel mailing list