storage.js
1.35 KB
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
$(document).delegate('.storage_graph_link', 'click', function(e){
var anchor = this,
el = $(anchor),
id = el.attr('data-status');
if(e.ctrlKey || e.metaKey){
return true;
}else{
e.preventDefault();
}
var cell = document.getElementById(id);
var text = el.html();
if (text == '[:: show ::]') {
anchor.innerHTML = '[:: hide ::]';
if (cell.nodeName == 'IMG') { // <img src='...'/>
cell.src=anchor.href;
} else {
$.ajax({
type: "get",
url: anchor.href,
success : function(response, textStatus) {
cell.style.display = 'block';
cell.parentNode.style.display = 'block';
cell.innerHTML = response;
var data = $('#countTrendMeta',cell).text();
graphLineChart($('#countTrend',cell)[0],eval('('+data+')'));
data = $('#longTrendMeta',cell).text();
graphLineChart($('#longTrend',cell)[0],eval('('+data+')'));
data = $('#avgTrendMeta',cell).text();
graphLineChart($('#avgTrend',cell)[0],eval('('+data+')'));
data = $('#errorTrendMeta',cell).text();
graphLineChart($('#errorTrend',cell)[0],eval('('+data+')'));
data = $('#piechartMeta',cell).text();
graphPieChart($('#piechart',cell)[0],eval('('+data+')'));
}
});
}
} else {
anchor.innerHTML = '[:: show ::]';
cell.style.display = 'none';
cell.parentNode.style.display = 'none';
}
})