[pve-devel] [PATCH manager 06/10] ext6migrate: fix StatuView and Summary

Dominik Csapak d.csapak at proxmox.com
Thu Mar 10 11:46:58 CET 2016


we move the static configuration to the class definiton
change applyIf to apply
and change the show event to activate

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/storage/StatusView.js | 95 ++++++++++++++++++--------------------
 www/manager6/storage/Summary.js    | 27 ++++++-----
 2 files changed, 59 insertions(+), 63 deletions(-)

diff --git a/www/manager6/storage/StatusView.js b/www/manager6/storage/StatusView.js
index 5c5f069..d988a88 100644
--- a/www/manager6/storage/StatusView.js
+++ b/www/manager6/storage/StatusView.js
@@ -2,6 +2,51 @@ Ext.define('PVE.storage.StatusView', {
     extend: 'PVE.grid.ObjectGrid',
     alias: 'widget.pveStorageStatusView',
 
+    title: gettext('Status'),
+    cwidth1: 150,
+    interval: 30000,
+    rows : {
+	disable: {
+	    header: gettext('Enabled'),
+	    required: true,
+	    renderer: PVE.Utils.format_neg_boolean
+	},
+	active: {
+	    header: gettext('Active'),
+	    required: true,
+	    renderer: PVE.Utils.format_boolean
+	},
+	content: {
+	    header: gettext('Content'),
+	    required: true,
+	    renderer: PVE.Utils.format_content_types
+	},
+	type: {
+	    header: gettext('Type'),
+	    required: true,
+	    renderer: PVE.Utils.format_storage_type
+	},
+	shared: {
+	    header: gettext('Shared'),
+	    required: true,
+	    renderer: PVE.Utils.format_boolean
+	},
+	total: {
+	    header: gettext('Size'),
+	    required: true,
+	    renderer: PVE.Utils.render_size
+	},
+	used: {
+	    header: gettext('Used'),
+	    required: true,
+	    renderer: PVE.Utils.render_size
+	},
+	avail: {
+	    header: gettext('Avail'),
+	    required: true,
+	    renderer: PVE.Utils.render_size
+	}
+    },
     initComponent : function() {
 	var me = this;
 
@@ -15,56 +60,8 @@ Ext.define('PVE.storage.StatusView', {
 	    throw "no storage ID specified";
 	}
 
-	var rows = {
-	    disable: {
-		header: gettext('Enabled'), 
-		required: true,
-		renderer: PVE.Utils.format_neg_boolean	
-	    },
-	    active: {
-		header: gettext('Active'), 
-		required: true,		
-		renderer: PVE.Utils.format_boolean
-	    },
-	    content: {
-		header: gettext('Content'), 
-		required: true,
-		renderer: PVE.Utils.format_content_types
-	    },
-	    type: {
-		header: gettext('Type'), 
-		required: true,
-		renderer: PVE.Utils.format_storage_type
-	    },
-	    shared: {
-		header: gettext('Shared'), 
-		required: true,
-		renderer: PVE.Utils.format_boolean
-	    },
-	    total: {
-		header: gettext('Size'), 
-		required: true, 
-		renderer: PVE.Utils.render_size
-	    },
-	    used: {
-		header: gettext('Used'), 
-		required: true, 
-		renderer: PVE.Utils.render_size
-	    },
-	    avail: {
-		header: gettext('Avail'), 
-		required: true, 
-		renderer: PVE.Utils.render_size
-	    }
-	};
-
-	Ext.applyIf(me, {
-	    title: gettext('Status'),
+	Ext.apply(me, {
 	    url: "/api2/json/nodes/" + nodename + "/storage/" + storage + "/status",
-	    cwidth1: 150,
-	    interval: 30000,
-	    //height: 195,
-	    rows: rows
 	});
 
 	me.callParent();
diff --git a/www/manager6/storage/Summary.js b/www/manager6/storage/Summary.js
index ca093a8..b463d7a 100644
--- a/www/manager6/storage/Summary.js
+++ b/www/manager6/storage/Summary.js
@@ -1,7 +1,18 @@
 Ext.define('PVE.storage.Summary', {
     extend: 'Ext.panel.Panel',
     alias: 'widget.pveStorageSummary',
-
+    scrollable: true,
+    bodyPadding: 10,
+    defaults: {
+	style: 'padding-top:10px',
+	width: 800
+    },
+    tbar: [
+	'->',
+	{
+	    xtype: 'pveRRDTypeSelector'
+	}
+    ],
     initComponent: function() {
         var me = this;
 
@@ -25,18 +36,6 @@ Ext.define('PVE.storage.Summary', {
 	var rrdurl = "/api2/png/nodes/" + nodename + "/storage/" + storage + "/rrd";
 
 	Ext.apply(me, {
-	    autoScroll: true,
-	    bodyStyle: 'padding:10px',
-	    defaults: {
-		style: 'padding-top:10px',
-		width: 800
-	    },		
-	    tbar: [
-		'->',
-		{
-		    xtype: 'pveRRDTypeSelector'
-		}
-	    ],
 	    items: [
 		statusview,
 		{
@@ -49,7 +48,7 @@ Ext.define('PVE.storage.Summary', {
 	    ]
 	});
 
-	me.on('show', rstore.startUpdate);
+	me.on('activate', rstore.startUpdate);
 	me.on('hide', rstore.stopUpdate);
 	me.on('destroy', rstore.stopUpdate);	
 
-- 
2.1.4





More information about the pve-devel mailing list