-
Notifications
You must be signed in to change notification settings - Fork 497
/
Copy pathacra-analysis.html
168 lines (140 loc) · 5.73 KB
/
acra-analysis.html
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
SMS Backup+ error report
</title>
<style type="text/css">
A:link {text-decoration: none }
body {
font-family: Arial;
border: 0 none;
}
</style>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart', 'table']});
</script>
<script type="text/javascript">
function show(spreadsheet, analysis, analysisContainer) {
var q = new google.visualization.Query(spreadsheet);
q.setQuery(analysis['query']);
q.send(function(response) {
var spinner = document.getElementById('spinner'),
errors = document.getElementById('errors');
if (response.isError()) {
var i = response.getReasons().length,
timeout = false;
while (i--) if (response.getReasons()[i] === 'timeout') timeout = true;
if (timeout) {
if (spinner) spinner.innerHTML = "request timed out, retrying...";
show(spreadsheet, analysis, analysisContainer);
} else {
errors.innerHTML = 'Error in query: ' + response.getMessage() +
' ' + response.getDetailedMessage();
}
} else {
if (spinner) spinner.style.display = "none";
var toc = document.getElementById('toc-' + analysis['id']);
if (toc) toc.style.display = '';
var data = response.getDataTable();
var id = analysis['id'];
var container = document.createElement('div');
container.setAttribute('id', id + '-' + 'table');
analysisContainer.appendChild(container);
var table = new google.visualization.Table(container),
view = new google.visualization.DataView(data);
// reverse columns - most recent version first
var columns = [0].concat(view.getViewColumns().slice(1, view.getViewColumns().length).reverse());
columns.push({
calc: function(table, rowNum) {
var sum = 0;
for (var i=1; i<columns.length-1; i++) sum += table.getValue(rowNum, i);
return sum;
},
type: 'number',
label: 'Total'
});
view.setColumns(columns);
table.draw(view, {title: analysis['title']});
var view2 = new google.visualization.DataView(data);
view2.setColumns(columns);
var columns = view2.getViewColumns();
// produce one piechart per pivot point
for (var i=1; i < columns.length; i++) {
view2.setColumns([0, columns[i]]);
var version = view2.getColumnLabel(1);
if (version && !(version === "")) {
var container = document.createElement('div');
container.setAttribute("id", id + '-' + version);
analysisContainer.appendChild(container);
var piechart = new google.visualization.PieChart(container);
piechart.draw(view2, {legend: 'bottom',
pieSliceText: 'label',
height: 500,
title: analysis['title'] + ': App version ' + version});
}
}
}
});
}
google.setOnLoadCallback(function() {
var sheet = document.getElementById('spreadsheet');
if (sheet) {
// N = model, B = version, F = android_version
var reports = [
{
id: 'crash-by-version',
query: 'SELECT F, COUNT(A) GROUP BY F PIVOT B',
title: 'Number of crashes by Android version'
},
{
id: 'crash-by-model',
query: 'SELECT N, COUNT(A) GROUP BY N PIVOT B',
title: 'Number of crashes by Android model',
}
];
for (var i=0; i<reports.length;i++) {
var q = reports[i];
var li = document.createElement('li');
li.setAttribute('id', 'toc-' + q['id']);
li.style.display = 'none';
document.getElementById('toc').appendChild(li);
var a = document.createElement("a");
a.href = '#' + q['id'];
a.innerHTML = q['title'];
li.appendChild(a);
var analysisContainer = document.createElement('div');
analysisContainer.setAttribute('id', q['id']);
var anchor = document.createElement('a');
anchor.setAttribute('name', q['id']);
anchor.innerHTML = q['title'];
analysisContainer.appendChild(anchor);
document.getElementById('reports').appendChild(analysisContainer);
show(sheet.href, q, analysisContainer);
}
}
});
</script>
</head>
<body>
<h1><a href="http://github.com/jberkel/sms-backup-plus#readme">SMS Backup+</a> error reports</h1>
<p>
<a href="https://github.com/jberkel/sms-backup-plus/tree/gh-pages#readme">What is this?<a>
</p>
<a id="spreadsheet"
href="https://spreadsheets.google.com/ccc?key=0At-v8_qu4q4VdFZOM3JNWng5bmZYLXNCWFJ0b1hPdHc&authkey=CMKWmssL">
Spreadsheet
</a>
<span id="spinner">
loading, please wait...
</span>
<div id="errors"/>
<div>
<ul id="toc">
</ul>
</div>
<div id="reports"/>
</body>
</html>