aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-testbed/templates/table.html
blob: e6da9dda282c22b47b901a76375d693e19c6fc73 (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
{{define "PrintValue"}}
	{{if or (lt . -100.0) (gt . 100.0)}}
		{{printf "%.0f" .}}
	{{else}}
		{{printf "%.1f" .}}
	{{end}}
{{end}}

{{define "PrintExtra"}}
	{{if .PercentChange}}
		{{$numVal := (dereference .PercentChange)}}
		{{if ge $numVal 0.0}}
			<span class="positive-delta">
		{{else}}
			<span class="negative-delta">
		{{end}}
		{{printf "%+.1f" $numVal}}%
		</span>
	{{end}}
	{{if .PValue}}
		p={{printf "%.2f" (dereference .PValue)}}
	{{end}}
{{end}}

{{$uiTable := .}}
{{if .Table}}
{{if $uiTable.AlignedBy}}
	The data are aligned by {{$uiTable.AlignedBy}} <br />
{{end}}
<table class="list_table">
	<thead><tr>
	<th>{{.Table.TopLeftHeader}}</th>
	{{range $c := .Table.ColumnHeaders}}
		<th>
		{{$url := ""}}
                {{if $uiTable.ColumnURL}}{{$url = (call $uiTable.ColumnURL $c)}}{{end}}
			{{if $url}}<a href="{{$url}}">{{$c}}</a>
			{{else}}
			{{$c}}
			{{end}}
		</th>
		{{if $uiTable.Extra}}
		<th>Δ</th>
		{{end}}
	{{end}}
	</tr></thead>
	<tbody>
	{{range $r := .Table.SortedRows}}
	<tr>
		<td>
		{{$url := ""}}
                {{if $uiTable.RowURL}}{{$url = (call $uiTable.RowURL $r)}}{{end}}
			{{if $url}}<a href="{{$url}}">{{$r}}</a>
			{{else}}
			{{$r}}
			{{end}}
		</td>
		{{range $c := $uiTable.Table.ColumnHeaders}}
			{{$cell := ($uiTable.Table.Get $r $c)}}
			{{if and $cell $uiTable.Extra}}
			<td>{{template "PrintValue" $cell.Value}}</td>
			<td>{{template "PrintExtra" $cell}}</td>
			{{else}}
			<td>{{$cell}}</td>
			{{end}}
		{{end}}
	</tr>
	{{end}}
	{{if $uiTable.HasFooter}}
		<tr>
			<td>-</td>
			{{range $c := $uiTable.Table.ColumnHeaders}}
				<td>{{$uiTable.Table.GetFooterValue $c}}</td>
			{{end}}
		</tr>
	{{end}}
	</tbody>
</table>
{{end}}