mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-07-27 10:45:56 +00:00
add store to read statistics using timeframe from StatTimeSelector
This commit is contained in:
parent
eafa9a6565
commit
42a0470de2
47
js/StatStore.js
Normal file
47
js/StatStore.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
Ext.define('PMG.data.StatStore', {
|
||||||
|
extend: 'Ext.data.Store',
|
||||||
|
alias: 'store.pmgStatStore',
|
||||||
|
|
||||||
|
autoDestroy: true,
|
||||||
|
|
||||||
|
staturl: undefined,
|
||||||
|
|
||||||
|
reload: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
var ts = PMG.StatTimeSelector.getTimeSpan();
|
||||||
|
|
||||||
|
var last = me.proxy.extraParams;
|
||||||
|
|
||||||
|
if (last.starttime === ts.starttime && last.endtime === ts.endtime)
|
||||||
|
return; // avoid repeated loads
|
||||||
|
|
||||||
|
me.proxy.url = me.staturl;
|
||||||
|
me.proxy.extraParams = { starttime: ts.starttime, endtime: ts.endtime };
|
||||||
|
|
||||||
|
console.log("LOAD" + me.proxy.url);
|
||||||
|
|
||||||
|
me.load();
|
||||||
|
},
|
||||||
|
|
||||||
|
proxy: {
|
||||||
|
type: 'proxmox'
|
||||||
|
},
|
||||||
|
|
||||||
|
constructor: function(config) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
config = config || {};
|
||||||
|
|
||||||
|
// staturl is required
|
||||||
|
if (!config.staturl) {
|
||||||
|
throw "no staturl specified";
|
||||||
|
}
|
||||||
|
|
||||||
|
me.mon(Ext.GlobalEvents, 'pmgStatTimeSelectorUpdate', me.reload, me);
|
||||||
|
|
||||||
|
me.callParent([config]);
|
||||||
|
|
||||||
|
me.reload();
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user