[pve-devel] r5998 - in pve-manager/pve2/www/new: . node

svn-commits at proxmox.com svn-commits at proxmox.com
Wed May 18 14:08:39 CEST 2011


Author: dietmar
Date: 2011-05-18 14:08:39 +0200 (Wed, 18 May 2011)
New Revision: 5998

Added:
   pve-manager/pve2/www/new/node/NetworkView.js
Modified:
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/node/Config.js
Log:
implement NetworkView


Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	2011-05-18 11:16:36 UTC (rev 5997)
+++ pve-manager/pve2/www/new/Makefile.am	2011-05-18 12:08:39 UTC (rev 5998)
@@ -37,6 +37,7 @@
 	node/StatusView.js				\
 	node/Summary.js					\
 	node/ServiceView.js				\
+	node/NetworkView.js				\
 	node/Config.js					\
 	qemu/StatusView.js				\
 	qemu/Summary.js					\

Modified: pve-manager/pve2/www/new/node/Config.js
===================================================================
--- pve-manager/pve2/www/new/node/Config.js	2011-05-18 11:16:36 UTC (rev 5997)
+++ pve-manager/pve2/www/new/node/Config.js	2011-05-18 12:08:39 UTC (rev 5998)
@@ -26,7 +26,7 @@
 		{
 		    title: 'Network',
 		    itemId: 'network',
-		    html: 'network ' + nodename
+		    xtype: 'pveNodeNetworkView'
 		},
 		{
 		    title: 'DNS',

Added: pve-manager/pve2/www/new/node/NetworkView.js
===================================================================
--- pve-manager/pve2/www/new/node/NetworkView.js	                        (rev 0)
+++ pve-manager/pve2/www/new/node/NetworkView.js	2011-05-18 12:08:39 UTC (rev 5998)
@@ -0,0 +1,79 @@
+Ext.define('PVE.node.NetworkView', {
+    extend: 'Ext.grid.GridPanel',
+
+    alias: ['widget.pveNodeNetworkView'],
+
+    initComponent : function() {
+	var me = this;
+
+	var nodename = me.pveSelNode.data.node;
+	if (!nodename) 
+	    throw "no node name specified";
+
+	var rstore = Ext.create('PVE.data.UpdateStore', {
+	    interval: 1000,
+	    storeid: 'pve-networks',
+	    model: Ext.define('pve-networks', {
+		extend: 'Ext.data.Model',
+		fields: [ 
+		    'iface', 'type', 'active', 'autostart'
+		],
+		idProperty: 'iface',
+		proxy: {
+                    type: 'pve',
+                    url: "/api2/json/nodes/" + nodename + "/network",
+		}
+	    })
+	});
+
+	var store = Ext.create('PVE.data.DiffStore', { rstore: rstore });
+
+	me.mon(rstore, 'load', function(s, records, success) {
+	    if (!success) {
+		me.setLoading("Data load error");
+		return;
+	    } else {
+		me.setLoading(false);
+	    }
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    stateful: false,
+	   // tbar: [ start_btn, stop_btn, restart_btn ],
+	    columns: [
+		{
+		    header: 'Interface',
+		    width: 100,
+		    sortable: true,
+		    dataIndex: 'iface'
+		},
+		{
+		    header: 'Type',
+		    width: 80,
+		    sortable: true,
+		    dataIndex: 'type'
+		},
+		{
+		    xtype: 'booleancolumn', 
+ 		    header: 'Active',
+		    width: 80,
+		    sortable: true,
+		    dataIndex: 'active',
+		    trueText: 'Yes',
+		    falseText: 'No',
+		    undefinedText: 'No'
+		}
+	    ],
+	    listeners: {
+		//selectionchange: set_button_status,
+		show: rstore.startUpdate,
+		hide: rstore.stopUpdate,
+		destroy: rstore.stopUpdate,
+	    }
+	});
+
+	me.callParent();
+    }
+});
+    
\ No newline at end of file




More information about the pve-devel mailing list