[pve-devel] r5556 - in pve-manager/pve2/www/manager: . grid

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Feb 16 14:57:49 CET 2011


Author: dietmar
Date: 2011-02-16 14:57:49 +0100 (Wed, 16 Feb 2011)
New Revision: 5556

Modified:
   pve-manager/pve2/www/manager/NodeConfig.js
   pve-manager/pve2/www/manager/StorageBrowser.js
   pve-manager/pve2/www/manager/grid/ObjectView.js
Log:
factor out code to display error messages


Modified: pve-manager/pve2/www/manager/NodeConfig.js
===================================================================
--- pve-manager/pve2/www/manager/NodeConfig.js	2011-02-16 13:34:53 UTC (rev 5555)
+++ pve-manager/pve2/www/manager/NodeConfig.js	2011-02-16 13:57:49 UTC (rev 5556)
@@ -778,7 +778,7 @@
 });
 Ext.reg('pveNodeDNSView', PVE.NodeDNSView);
 
-PVE.NodeServiceView = Ext.extend(Ext.grid.GridPanel, {
+PVE.NodeServiceView = Ext.extend(PVE.grid.StdGrid, {
 
     initComponent : function() {
 	var self = this;

Modified: pve-manager/pve2/www/manager/StorageBrowser.js
===================================================================
--- pve-manager/pve2/www/manager/StorageBrowser.js	2011-02-16 13:34:53 UTC (rev 5555)
+++ pve-manager/pve2/www/manager/StorageBrowser.js	2011-02-16 13:57:49 UTC (rev 5556)
@@ -1,6 +1,6 @@
 Ext.ns("PVE");
 
-PVE.StorageContent = Ext.extend(Ext.grid.GridPanel, {
+PVE.StorageContent = Ext.extend(PVE.grid.StdGrid, {
 
     initComponent : function() {
 	var self = this;

Modified: pve-manager/pve2/www/manager/grid/ObjectView.js
===================================================================
--- pve-manager/pve2/www/manager/grid/ObjectView.js	2011-02-16 13:34:53 UTC (rev 5555)
+++ pve-manager/pve2/www/manager/grid/ObjectView.js	2011-02-16 13:57:49 UTC (rev 5556)
@@ -1,8 +1,35 @@
 Ext.ns("PVE.grid");
 
+// a grid which displays 'load' exception messages inline
+PVE.grid.StdGrid = Ext.extend(Ext.grid.GridPanel, {
+
+    initComponent : function() {
+	var self = this;
+
+	if (!self.store)
+	    throw "no store specified";
+
+	PVE.grid.StdGrid.superclass.initComponent.call(self);
+
+	var display_exception = function(t, type, action, options, response, arg) {
+	    var msg;
+	    self.store.removeAll();
+	    if (type == 'response') {
+		msg = "Error " + response.status + ": " + response.statusText;
+	    } else {
+		msg = "Data load error";
+	    }
+	    self.getView().mainBody.update('<div class="x-form-invalid">' + msg + '</div>');
+	};
+
+	self.store.on('exception', display_exception); 
+	self.on('beforedestroy', function() { self.store.un('exception', display_exception) }); 
+    }
+});
+	
 // a special grid to display PVE.data.ObjectStore
 
-PVE.grid.ObjectView = Ext.extend(Ext.grid.GridPanel, {
+PVE.grid.ObjectView = Ext.extend(PVE.grid.StdGrid, {
 
     initComponent : function() {
 	var self = this;
@@ -52,21 +79,6 @@
 	});
 
 	PVE.grid.ObjectView.superclass.initComponent.call(self);
-
-	var display_exception = function(t, type, action, options, response, arg) {
-	    var msg;
-	    self.store.removeAll();
-	    if (type == 'response') {
-		msg = "Error " + response.status + ": " + response.statusText;
-	    } else {
-		msg = "Data load error";
-	    }
-	    self.getView().mainBody.update('<div class="x-grid-empty">' + msg + '</div>');
-	};
-
-	self.store.on('exception', display_exception); 
-	self.on('beforedestroy', function() { self.store.un('exception', display_exception) }); 
-
     }
 });
 




More information about the pve-devel mailing list