aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/templates/graph_crashes.html
blob: e449681543d3ad93618ce325c09e52c703fca5ef (plain)
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
{{/*
Copyright 2022 syzkaller project authors. All rights reserved.
Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

Manager statistics graphs.
*/}}

<!doctype html>
<html>
<head>
	<title>{{.Header.Namespace}} crash stats</title>
	{{template "head" .Header}}

	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
{{if .Graph}}
	<script type="text/javascript">
		google.load("visualization", "1", {packages:["corechart"]});
		google.setOnLoadCallback(drawCharts);
		function drawCharts() {
			var data = new google.visualization.DataTable();
			data.addColumn({type: 'string'});
			{{range $.Graph.Headers}}
				data.addColumn({type: 'number', label: '{{.Name}}'});
				data.addColumn({type: 'string', role: 'tooltip'});
			{{- end}}
			data.addRows([ {{range $.Graph.Columns}}
					[ "{{.Hint}}", {{range .Vals}}
						{{if .Val}}{{.Val}}{{end}}, '{{.Hint}}',
					{{- end}}
					],
				{{- end}}
			]);
			new google.visualization.LineChart(document.getElementById('graph_div')).
				draw(data, {
					width: "80%",
					height: 600,
					interpolateNulls: true,
					focusTarget: "category",
					chartArea: {width: '95%', height: '100%'},
					legend: {position: 'in'},
					axisTitlesPosition: 'out',
					hAxis: {textPosition: 'in', maxAlternation: 1},
					vAxis: {textPosition: 'in', viewWindowMode: 'maximized'},
					explorer: {axis: 'horizontal', maxZoomIn: 0, maxZoomOut: 1, zoomDelta: 1.2, keepInBounds: true}
				})
		}
	</script>
{{end}}
</head>
<body>
	{{template "header" .Header}}
	<div class="page">
	{{if .Graph}}
		<div id="graph_div" class="main-content"></div>
	{{else if .Table}}
	{{with .Table}}
	<div class="main-content">
		<table class="list_table">
			<caption>{{.Title}}</caption>
			<thead>
				<tr>
					<th>Title</th>
					<th>Count</th>
					<th>Share</th>
					<th>Graph</th>
				</tr>
			</thead>
			<tbody>
			{{range .Rows}}
				<tr>
					<td class="title"><a href="{{.Link}}">{{.Title}}</a></td>
					<td>{{.Count}}</td>
					<td>{{.Share | printf "%.1f"}}%</td>
					<td><a href="{{.GraphLink}}">[last month]</a></td>
				</tr>
			{{end}}
			</tbody>
		</table>
	</div>
	{{end}}
	{{end}}
	<aside>
		<form>
			{{template "input-multi-text" .Regexps}}
			{{template "input-slider" .GraphMonths}}
			<input type="submit" name="show-graph" value="Show graph"/> <br />
		</form>
		<form>
			{{template "input-slider" .TableDays}}
			<input type="submit" name="show-crashers" value="Top crashers"/>
		</form>
	</aside>
	</div>
</body>
</html>