forked from beamspirit/bigwig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rb.js
76 lines (68 loc) · 1.84 KB
/
rb.js
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
69
70
71
72
73
74
75
RB = (function() {
function getFilter(level) {
return level.split("_")[0];
}
function fmt_process_start(data) {
var name = data.started.name;
if(name._type == 'tuple') {
name = name.data[0];
}
return {
'started_pid': data.started.pid,
'started_name': name
};
}
function fmt_application_start(data) {
return data;
}
var dataSources = ['data','generic_data','crashing_process'];
$('#report ._tpl').data("process", function(el, report) {
el.addClass(getFilter(report['report_level']));
var data = null;
for(var i in dataSources) {
var k = dataSources[i];
if(report[k]) {
data = report[k];
break;
}
}
$('.report_level', el).click(function() {
el.toggleClass('selected');
return false;
});
if(data && data.started) {
el.addClass('started');
TPL.update($('.started',el), fmt_process_start(data));
} else if(data && data.application) {
el.addClass('application_start');
TPL.update($('.application_start',el), fmt_application_start(data));
} else {
//el.addClass('selected');
}
if(!data) {
data = report;
}
$('.data', el).html(RENDERER.stringify(data));
});
$('.filter').click(function() {
var href = $(this).attr('href');
var href_parts = href.split("?");
var filter = "all";
if(href_parts.length > 1) {
filter = $.getQueryString('level', href_parts[1]);
}
var current = $('#report').attr('data-filter');
if(filter != current) {
$('.filter').removeClass('current');
$(this).addClass('current');
$('#report').removeClass(current);
$('#report').addClass(filter);
$('#report').attr('data-filter', filter);
}
return false;
});
TPL.connect("/rb/stream");
TPL.fetch("/rb/reports?limit=200");
return {
};
})();