Commit c656f6fb authored by Alexandre Derumier's avatar Alexandre Derumier Committed by Dietmar Maurer

rrd display : avoid 2 refresh

Currently when we open a new summary panel

- we display the rrd with default hour timeframe
- then we refresh it
- then we update from timeframe selector

With this patch:
- We display the rrd with timeframe from selector, or if not defined default hour
- We update from timeframe selector value if timeframe && cf are differents from current value
Signed-off-by: 's avatarAlexandre Derumier <aderumier@odiso.com>
parent 7bf2d98f
......@@ -5,21 +5,34 @@ Ext.define('PVE.panel.RRDView', {
initComponent : function() {
var me = this;
if (!me.datasource) {
throw "no datasource specified";
}
if (!me.rrdurl) {
throw "no rrdurl specified";
}
var stateid = 'pveRRDTypeSelection';
var sp = Ext.state.Manager.getProvider();
var stateinit = sp.get(stateid);
if (!me.timeframe) {
if(stateinit.timeframe){
me.timeframe = stateinit.timeframe;
}else{
me.timeframe = 'hour';
}
}
if (!me.rrdcffn) {
if(stateinit.rrdcffn){
me.rrdcffn = stateinit.cf;
}else{
me.rrdcffn = 'AVERAGE';
}
if (!me.datasource) {
throw "no datasource specified";
}
if (!me.rrdurl) {
throw "no rrdurl specified";
}
var datasource = me.datasource;
......@@ -33,7 +46,6 @@ Ext.define('PVE.panel.RRDView', {
return url;
};
var stateid = 'pveRRDTypeSelection';
Ext.apply(me, {
layout: 'fit',
......@@ -45,11 +57,13 @@ Ext.define('PVE.panel.RRDView', {
},
applyState : function(state) {
if (state && state.id) {
if(state.timeframe !== me.timeframe || state.cf !== me.rrdcffn){
me.timeframe = state.timeframe;
me.rrdcffn = state.cf;
me.reload_task.delay(10);
}
}
}
});
me.callParent();
......@@ -80,9 +94,6 @@ Ext.define('PVE.panel.RRDView', {
me.reload_task.cancel();
});
var sp = Ext.state.Manager.getProvider();
me.applyState(sp.get(stateid));
var state_change_fn = function(prov, key, value) {
if (key == stateid) {
me.applyState(value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment