1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* ************************************************************************
#module(Smokeping)
************************************************************************ */
/**
* a widget showing the smokeping graph overview
*/
qx.Class.define('Smokeping.ui.GraphList',
{
extend: qx.ui.layout.FlowLayout,
/*
*****************************************************************************
CONSTRUCTOR
*****************************************************************************
*/
/**
* @param base_url {String} Path to the location of the image generator
*
*/
construct: function (url) {
with(this){
base(arguments);
set({
overflow: 'auto',
backgroundColor: 'white',
border: new qx.ui.core.Border(1,'solid','#a0a0a0'),
width: '100%',
height: '100%',
verticalSpacing: 10,
horizontalSpacing: 10,
padding: 10
})
};
this._url = url;
qx.event.message.Bus.subscribe('sp.menu.folder',this._load_graphs,this);
},
members: {
_load_graphs: function(m){
var files = m.getData()
this.removeAll();
for(var i=0;i<files.length;i++){
var shadow = new Smokeping.GraphShadow();
shadow.set({
width: 150,
height: 75,
start: Math.round((new Date()).getTime()/1000)-(3600*24*3),
end: Math.round((new Date()).getTime()/1000),
top: 1000000,
bottom: 0,
cgi: this._url + 'grapher.cgi',
data: files[i]
});
var image = new Smokeping.ui.Graph(shadow);
this.add(image);
}
}
}
});
|