summaryrefslogtreecommitdiffstats
path: root/var/www/build.alpinelinux.org/htdocs/errors/index.lua
blob: a2d9897890ff3e2d18f61babc3f3a81a2dbb32f4 (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
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
#!/usr/bin/haserl --shell=lua
Content-type: text/html

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Alpine Linux - build errors</title>

	<!-- jquery dataTables -->
	<script type="text/javascript" src="jquery/dataTables/js/jquery.js"></script>
	<script type="text/javascript" src="jquery/dataTables/js/jquery.dataTables.min.js"></script>
	<link rel="stylesheet" type="text/css" href="jquery/dataTables/css/jquery.dataTables.min.css">
	<link rel="stylesheet" type="text/css" href="styles.css">

	<script>
		function filterGlobal () {
			$('#list_table').DataTable().search(
				$('#global_filter').val(),
				$('#global_regex').prop('checked'),
				$('#global_smart').prop('checked')
			).draw();
		}

		function filterColumn ( i ) {
			$('#list_table').DataTable().column( i ).search(
				$('#col'+i+'_filter').val(),
				$('#col'+i+'_regex').prop('checked'),
				$('#col'+i+'_smart').prop('checked')
			).draw();
		}

		$(document).ready(function(){
			var table = $('#list_table').DataTable( {
				"order": [[ 5, "desc" ], [ 0, "asc" ], [ 1, "asc" ]],
				"paging":   false,
				"aoColumns": [
							{ "bSortable": false },
							null,
							null,
							null,
							{ "bSortable": false },
							null
				]
			} );

			$('input.global_filter').on( 'keyup click', function () {
				filterGlobal();
			} );

			$('input.column_filter').on( 'keyup click', function () {
				filterColumn( $(this).parents('tr').attr('data-column') );
			} );
		});
	</script>
</head>
<body>
	<h1>Alpine Linux - build errors</h1>
	<div id="search_table_container">
	<!--
	<table id="search_table">
		<thead>
			<tr>
				<th>Target</th>
				<th>Search text</th>
				<th>Treat as regex</th>
				<th>Use smart search</th>
			</tr>
		</thead>
		<tbody>
			<tr id="filter_global">
				<td class="left">Global search</td>
				<td class="left"><input type="text" class="global_filter text" id="global_filter"></td>
				<td class="center"><input type="checkbox" class="global_filter" id="global_regex"></td>
				<td class="center"><input type="checkbox" class="global_filter" id="global_smart" checked="checked"></td>
			</tr>
			<tr id="filter_col1" data-column="0">
				<td class="left">hostname</td>
				<td class="left"><input type="text" class="column_filter text" id="col0_filter"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col0_regex"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col0_smart" checked="checked"></td>
			</tr>
			<tr id="filter_col2" data-column="1">
				<td class="left">pkgname</td>
				<td class="left"><input type="text" class="column_filter text text" id="col1_filter"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col1_regex"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col1_smart" checked="checked"></td>
			</tr>
			<tr id="filter_col3" data-column="2">
				<td class="left">reponame</td>
				<td class="left"><input type="text" class="column_filter text" id="col2_filter"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col2_regex"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col2_smart" checked="checked"></td>
			</tr>
			<tr id="filter_col5" data-column="5">
				<td class="left">date</td>
				<td class="left"><input type="text" class="column_filter text" id="col5_filter"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col5_regex"></td>
				<td class="center"><input type="checkbox" class="column_filter" id="col5_smart" checked="checked"></td>
			</tr>
		</tbody>
	</table>
	-->
	<table id="list_table" class="hover stripe order-column row-border cell-border">
		<thead>
			<tr class="head">
				<th>hostname</th>
				<th>pkgname</th>
				<th>reponame</th>
				<th>logurl</th>
				<th>date (UTC)</th>
				<th>comment</th>
			</tr>
		</thead>
		<thead>
		<tbody>
		<%
		sqlite3 = require "lsqlite3"
		local dbfile = '/var/lib/build-errors/sqlite/build-errors.db'
		local db = sqlite3.open(dbfile)
		for r in db:nrows('select * from build_errors') do
			tr = '\
				<tr><!-- id: '..r.id..' -->\
					<td class="nowrap">'..r.hostname..'</td>\
					<td class="nowrap">'..r.pkgname..'</td>\
					<td class="nowrap">'..r.reponame..'</td>\
					<td class="nowrap"><a href="'..r.logurl..'">logurl</a></td>\
					<td class="nowrap">'..r.datetime..'</td>\
					<td class="nowrap">'..r.comment..'</td>\
				</tr>\
			'
			print(tr)
		end
		db:close()
		%>
		</tbody>
	</table>
	</div>
</body>
</html>