[pve-devel] r5985 - in pve-manager/pve2/www/new: grid node panel qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 17 07:59:43 CEST 2011


Author: dietmar
Date: 2011-05-17 07:59:43 +0200 (Tue, 17 May 2011)
New Revision: 5985

Modified:
   pve-manager/pve2/www/new/grid/ObjectGrid.js
   pve-manager/pve2/www/new/node/Config.js
   pve-manager/pve2/www/new/node/TimeView.js
   pve-manager/pve2/www/new/panel/ConfigPanel.js
   pve-manager/pve2/www/new/qemu/Config.js
   pve-manager/pve2/www/new/qemu/HardwareView.js
Log:
cleanups


Modified: pve-manager/pve2/www/new/grid/ObjectGrid.js
===================================================================
--- pve-manager/pve2/www/new/grid/ObjectGrid.js	2011-05-16 12:17:18 UTC (rev 5984)
+++ pve-manager/pve2/www/new/grid/ObjectGrid.js	2011-05-17 05:59:43 UTC (rev 5985)
@@ -39,9 +39,16 @@
 
 	var rows = me.rows;
 
-	if (!me.rstore)
-	    throw "no rstore specified";
+	if (!me.rstore) {
+	    if (!me.url)
+		throw "no url specified";
 
+	    me.rstore = Ext.create('PVE.data.ObjectStore', {
+		url: me.url,
+		interval: me.interval
+	    });
+	}
+
 	var rstore = me.rstore;
 
 	var store = Ext.create('Ext.data.Store', {
@@ -152,6 +159,4 @@
 
 	me.callParent();
    }
-
-
 });

Modified: pve-manager/pve2/www/new/node/Config.js
===================================================================
--- pve-manager/pve2/www/new/node/Config.js	2011-05-16 12:17:18 UTC (rev 5984)
+++ pve-manager/pve2/www/new/node/Config.js	2011-05-17 05:59:43 UTC (rev 5985)
@@ -41,6 +41,7 @@
 	Ext.applyIf(me, {
 	    cwidth1: 150,
 	    interval: 1000,
+	    height: 286,
 	    rows: rows
 	});
 
@@ -59,6 +60,11 @@
 	if (!nodename) 
 	    throw "no node name specified";
 
+	rstore = Ext.create('PVE.data.ObjectStore', { 
+	    url: "/api2/json/nodes/" + nodename + "/status",
+	    interval: 1000
+	});
+
 	var node_command = function(cmd) {
 	    me.setLoading(true, true);
 	    PVE.Utils.API2Request({
@@ -121,7 +127,7 @@
 	    ]
 	});
 
-	me.mon(me.rstore, 'load', function(s, records, success) {
+	me.mon(rstore, 'load', function(s, records, success) {
 	    var uptimerec = s.data.get('uptime');
 	    var uptime = uptimerec ? uptimerec.data.value : false;
 
@@ -145,7 +151,7 @@
 		{
 		    title: 'Status',
 		    xtype: 'pveNodeStatusView',
-		    rstore: me.rstore,
+		    rstore: rstore,
 		    width: 800
 		},
 		{
@@ -175,6 +181,10 @@
 	    ]
 	});
 
+	me.on('show', rstore.startUpdate);
+	me.on('hide', rstore.stopUpdate);
+	me.on('destroy', rstore.stopUpdate);	
+
 	me.callParent();
     }
 });
@@ -190,11 +200,6 @@
 	if (!nodename) 
 	    throw "no node name specified";
 
-	me.rstore = Ext.create('PVE.data.ObjectStore', { 
-	    url: "/api2/json/nodes/" + nodename + "/status",
-	    interval: 1000
-	});
-
 	Ext.apply(me, {
 	    title: "Node '" + nodename + "'",
 	    hstateid: 'nodetab',
@@ -238,11 +243,5 @@
 	});
 
 	me.callParent();
-
-	me.rstore.startUpdate();
-
-	me.on('destroy', function() {
-	    me.rstore.stopUpdate();
-	});	
-   }
+    }
 });

Modified: pve-manager/pve2/www/new/node/TimeView.js
===================================================================
--- pve-manager/pve2/www/new/node/TimeView.js	2011-05-16 12:17:18 UTC (rev 5984)
+++ pve-manager/pve2/www/new/node/TimeView.js	2011-05-17 05:59:43 UTC (rev 5985)
@@ -27,8 +27,8 @@
 	    cwidth1: 150,
 	    interval: 1000,
 	    rows: {
-		timezone: { header: 'Time zone' },
-		localtime: { header: 'Server time', renderer: rendertime }
+		timezone: { header: 'Time zone', required: true, },
+		localtime: { header: 'Server time', required: true, renderer: rendertime }
 	    },
 	    tbar: [ 
 		{
@@ -44,5 +44,9 @@
 	});
 
 	me.callParent();
+
+	me.on('show', me.rstore.startUpdate);
+	me.on('hide', me.rstore.stopUpdate);
+	me.on('destroy', me.rstore.stopUpdate);	
     }
 });

Modified: pve-manager/pve2/www/new/panel/ConfigPanel.js
===================================================================
--- pve-manager/pve2/www/new/panel/ConfigPanel.js	2011-05-16 12:17:18 UTC (rev 5984)
+++ pve-manager/pve2/www/new/panel/ConfigPanel.js	2011-05-17 05:59:43 UTC (rev 5985)
@@ -24,7 +24,6 @@
 
 	// pass rstore, pveSelNode and viewFilter to all children
 	Ext.apply(me.defaults, {
-	    rstore: me.rstore,
 	    pveSelNode: me.pveSelNode,
 	    viewFilter: me.viewFilter,
 	    border: false
@@ -64,6 +63,8 @@
 
 	me.callParent();
 
+	me.items.get(0).fireEvent('show', me.items.get(0));
+
 	var statechange = function(sp, key, state) {
 	    if (stateid && key === stateid) {
 		var atab = me.getActiveTab().itemId;

Modified: pve-manager/pve2/www/new/qemu/Config.js
===================================================================
--- pve-manager/pve2/www/new/qemu/Config.js	2011-05-16 12:17:18 UTC (rev 5984)
+++ pve-manager/pve2/www/new/qemu/Config.js	2011-05-17 05:59:43 UTC (rev 5985)
@@ -49,8 +49,9 @@
 	Ext.applyIf(me, {
 	    url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/status",
 	    cwidth1: 150,
+	    height: 145,
 	    interval: 1000,
-	    rows: rows
+	    rows: rows,
 	});
 
 	me.callParent();
@@ -72,6 +73,11 @@
 	if (!vmid) 
 	    throw "no VM ID specified";
 
+	rstore = Ext.create('PVE.data.ObjectStore', { 
+	    url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/status",
+	    interval: 1000
+	});
+
 	var rrdurl = "/api2/png/nodes/" + nodename + "/qemu/" + vmid + "/rrd";
 
 	var vm_command = function(cmd) {
@@ -178,7 +184,7 @@
 	    ]
 	});
 
-	me.mon(me.rstore, 'load', function(s, records, success) {
+	me.mon(rstore, 'load', function(s, records, success) {
 	    var statusrec = s.data.get('status');
 	    var status = statusrec ? statusrec.data.value : 'unknown';
 
@@ -208,21 +214,20 @@
 			align: 'stretchmax'
 		    },
 		    width: 800,
-		    height: 160,
 		    border: false,
 		    items: [
 			{
 			    title: 'Status',
 			    xtype: 'pveQemuStatusView',
 			    pveSelNode: me.pveSelNode,
-			    rstore: me.rstore,
+			    rstore: rstore,
 			    width: 400
 			},
 			{
 			    title: 'Comments',
 			    style: 'padding-left:10px',
 			    pveSelNode: me.pveSelNode,
-			    rstore: me.rstore,
+			    rstore: rstore,
 			    html: "test",
 			    width: 400
 			}
@@ -252,6 +257,10 @@
 	    ]
 	});
 
+	me.on('show', rstore.startUpdate);
+	me.on('hide', rstore.stopUpdate);
+	me.on('destroy', rstore.stopUpdate);	
+
  	me.callParent();
     }
 });
@@ -271,11 +280,6 @@
 	if (!vmid) 
 	    throw "no VM ID specified";
 
-	me.rstore = Ext.create('PVE.data.ObjectStore', { 
-	    url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/status",
-	    interval: 1000
-	});
-
 	var vmname = me.pveSelNode.data.name;
 	var descr = vmname ? "'" + vmname + "' " : '';
 	Ext.apply(me, {
@@ -315,19 +319,6 @@
 	    ]
 	});
 
-	me.mon(me.rstore, 'load', function(s, records, success) {
-	    var statusrec = s.data.get('status');
-	    var status = statusrec ? statusrec.data.value : 'unknown';
-	    // fixme: this does not work - why ?
-	    me.down('#console').setDisabled(status !== 'running');
-	});
-
-	me.rstore.startUpdate();
-
 	me.callParent();
-
-	me.on('destroy', function() {
-	    me.rstore.stopUpdate();
-	});
    }
 });

Modified: pve-manager/pve2/www/new/qemu/HardwareView.js
===================================================================
--- pve-manager/pve2/www/new/qemu/HardwareView.js	2011-05-16 12:17:18 UTC (rev 5984)
+++ pve-manager/pve2/www/new/qemu/HardwareView.js	2011-05-17 05:59:43 UTC (rev 5985)
@@ -80,10 +80,6 @@
 	    };
 	}
 
-	me.rstore = Ext.create('PVE.data.ObjectStore', {
-	    url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/config"
-	});
-
 	var run_editor = function() {
 	    
 	    console.log("TEST EDIT");
@@ -92,6 +88,7 @@
 	};
 
 	Ext.applyIf(me, {
+	    url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/config",
 	    cwidth1: 150,
 	    tbar: [ 
 		{
@@ -107,10 +104,11 @@
 	    }
 	});
 
-	me.rstore.load();
-
 	me.callParent();
 
+	me.on('show', function() {
+	    me.rstore.load();
+	});
 
     }
 });




More information about the pve-devel mailing list