[pve-devel] [PATCH manager 2/6] move chart series initialization into initComponent

Dominik Csapak d.csapak at proxmox.com
Tue Dec 6 16:26:38 CET 2016


with extjs 6.2 the charts are initialized differently, so that we can
not do this in the afterrender event, instead we do it in the
initComponent, after calling callParent

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/panel/RRDChart.js | 43 +++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/www/manager6/panel/RRDChart.js b/www/manager6/panel/RRDChart.js
index 5b2abf1..4cb6dcd 100644
--- a/www/manager6/panel/RRDChart.js
+++ b/www/manager6/panel/RRDChart.js
@@ -25,7 +25,6 @@ Ext.define('PVE.widget.RRDChart', {
 	docked: 'bottom'
     },
     listeners: {
-	afterrender: 'onAfterRender',
 	animationend: 'onAfterAnimation'
     },
 
@@ -96,9 +95,27 @@ Ext.define('PVE.widget.RRDChart', {
 	    '<br>' + new Date(record.get('time')));
     },
 
-    onAfterRender: function(){
+    onAfterAnimation: function(chart, eopts) {
+	// if the undobuton is disabled,
+	// disable our tool
+	var ourUndoZoomButton = chart.tools[0];
+	var undoButton = chart.interactions[0].getUndoButton();
+	ourUndoZoomButton.setDisabled(undoButton.isDisabled());
+    },
+
+    initComponent: function() {
 	var me = this;
 
+	if (!me.store) {
+	    throw "cannot work without store";
+	}
+
+	if (!me.fields) {
+	    throw "cannot work without fields";
+	}
+
+	me.callParent();
+
 	// add correct label for left axis
 	var axisTitle = "";
 	if (me.percentArr.indexOf(me.fields[0]) != -1) {
@@ -161,28 +178,6 @@ Ext.define('PVE.widget.RRDChart', {
 		}
 	    });
 	});
-    },
-
-    onAfterAnimation: function(chart, eopts) {
-	// if the undobuton is disabled,
-	// disable our tool
-	var ourUndoZoomButton = chart.tools[0];
-	var undoButton = chart.interactions[0].getUndoButton();
-	ourUndoZoomButton.setDisabled(undoButton.isDisabled());
-    },
-
-    initComponent: function() {
-	var me = this;
-
-	if (!me.store) {
-	    throw "cannot work without store";
-	}
-
-	if (!me.fields) {
-	    throw "cannot work without fields";
-	}
-
-	me.callParent();
 
 	// enable animation after the store is loaded
 	me.store.onAfter('load', function() {
-- 
2.1.4





More information about the pve-devel mailing list