-
Notifications
You must be signed in to change notification settings - Fork 72
/
finished.html
146 lines (140 loc) · 4.56 KB
/
finished.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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>ArchiveBot finished jobs</title>
<link rel="stylesheet" type="text/css" href="/assets/jquery.dataTables.min.css">
<style>
html, body {
background-color: #D4D6E9;
color: black;
}
.cell_warn_higlight {
background-color: #FFC2E3 !important;
font-weight: bold;
}
</style>
</head>
<body>
<noscript>Please enable JavaScript or request this resource
as application/json for raw data.</noscript>
<table id="finished_table" class="display">
<thead>
<tr>
<th>Ident</th>
<th>URL</th>
<th>Pipeline</th>
<th>Queued at</th>
<th id="queued_by" style="display: none">Queued by</th>
<th>Started at</th>
<th>Finished at</th>
<th>Size</th>
<th>Responses</th>
<th>Remaining</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script type="text/javascript" src="/assets/jquery-3.4.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="/assets/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/assets/jquery.timeago.js"></script>
<script>
var table;
var reloadInterval = 600 * 1000; // 10 minutes
var timestampThreshold = 60 * 5 * 1000;
var showNicks = (location.search.indexOf("?showNicks=") != -1) || (location.search.indexOf("&showNicks=") != -1);
function initTable() {
if (showNicks) $('#queued_by').show();
table = $('#finished_table').DataTable({
"paging" : false,
"ajax" : {
"url" : "/finished",
"dataSrc": ""
},
"columns" : [ {
"data" : "ident"
}, {
"data" : "url"
}, {
"data" : "pipeline_id"
}, {
"data" : "queued_at",
"createdCell" : function(td, cellData, rowData, row, col) {
var cellDate = new Date(cellData * 1000);
var dateNow = new Date();
$(td).attr('title', cellDate.toLocaleString());
$(td).text(jQuery.timeago(cellDate));
},
"className" : "dateFormatable"
}, {
"data" : function (row) { return showNicks ? row["started_by"] : ""; },
"createdCell" : function(td, cellData, rowData, row, col) { if (!showNicks) $(td).hide(); }
}, {
"data" : "started_at",
"createdCell" : function(td, cellData, rowData, row, col) {
var cellDate = new Date(cellData * 1000);
var dateNow = new Date();
$(td).attr('title', cellDate.toLocaleString());
$(td).text(jQuery.timeago(cellDate));
},
"className" : "dateFormatable"
}, {
"data" : "finished_at",
"createdCell" : function(td, cellData, rowData, row, col) {
var cellDate = new Date(cellData * 1000);
var dateNow = new Date();
$(td).attr('title', cellDate.toLocaleString());
$(td).text(jQuery.timeago(cellDate));
},
"className" : "dateFormatable"
}, {
"data" : "bytes_downloaded",
"createdCell" : function(td, cellData, rowData, row, col) {
var units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
var unit = null;
var value = cellData;
for (var i = 0; i < units.length - 1; ++i) {
if (value < 1024) {
unit = units[i];
break;
}
value /= 1024.0;
}
if (!unit) unit = units[units.length - 1];
$(td).attr('title', cellData + ' bytes');
$(td).text(value.toLocaleString(undefined, { maximumSignificantDigits: 4 }) + "\xA0" + unit);
}
}, {
"data" : function (row) { return (row["r1xx"] + row["r2xx"] + row["r3xx"] + row["r4xx"] + row["r5xx"] + row["runk"]); },
"createdCell" : function(td, cellData, rowData, row, col) {
$(td).attr('title', '1xx: ' + rowData['r1xx'] + '\n' +
'2xx: ' + rowData['r2xx'] + '\n' +
'3xx: ' + rowData['r3xx'] + '\n' +
'4xx: ' + rowData['r4xx'] + '\n' +
'5xx: ' + rowData['r5xx'] + '\n' +
'Unknown: ' + rowData['runk'] + '\n' +
'(Errors: ' + rowData['error_count'] + ')');
}
}, {
"data" : function (row) { return row["items_queued"] - row["items_downloaded"]; },
"createdCell" : function (td, cellData, rowData, row, col) {
if (cellData > 0.01 * rowData["items_queued"])
$(td).addClass('cell_warn_higlight');
$(td).attr('title', rowData['items_queued'] + ' queued\n' + rowData['items_downloaded'] + ' downloaded');
}
}],
"order": [[6, "desc"]]
});
setTimeout(reloadTable, reloadInterval);
$('.dateFormatable').timeago();
}
function reloadTable() {
table.ajax.reload(function() {
setTimeout(reloadTable, reloadInterval);
})
}
$(document).ready(initTable);
</script>
</body>
</html>