-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.liquid
78 lines (70 loc) · 2.18 KB
/
index.liquid
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
---
layout: base.liquid
title: All logbooks
---
<h1>All log runs</h1>
<form>
<label class="ds-field-checkbox">
<input type="checkbox" name="filter-failing" id="filter_failing">
<span>Failing only</span>
</label>
</form>
<table class="ds-table" id="logbooks">
<thead>
<tr>
<th>Council ID</th>
<th>Status</th>
<th>Run times</th>
</tr>
</thead>
<tbody>
{% for logbook in logbooks %}
{% assign last_run = logbook.log_runs|last %}
<tr class="status-{{ last_run.status_code }}">
<td><a href="{{ '/logbooks/' | url }}{{ logbook.council_id }}">{{ logbook.council_id }}</a></td>
<td>
{% if last_run.status_code == 0 %}
OK
{% else %}
ERROR
{% endif %}
</td>
<td>
<div class="run-graph">
{% for run in logbook.log_runs %}
<a href="{{ '/logbooks/' | url }}{{ logbook.council_id }}#{{ run.start | date:"%Y-%m-%d-%H-%M" }}" class="status-{{ run.status_code }}">
<div class="duration" style="height:{{ run.duration | divided_by: 300 | times: 100 | at_most: 100 }}%"></div>
</a>
{% endfor %}
</div>
</td>
{% comment %}<td>{{ last_run.errors }}</td>{% endcomment %}
</tr>
{% endfor %}
</tbody>
</table>
<script>
function filter_table(filter_checkbox) {
// var input, filter, table, tr, td, i, txtValue;
table = document.getElementById("logbooks");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
txtValue = txtValue.replace(/[\n\r]+|[\s]{2,}/g, ' ').trim()
console.log(txtValue)
if (txtValue === "OK" && filter_checkbox.checked) {
tr[i].style.display = "none";
} else {
tr[i].style.display = "";
}
}
}
}
failing_checkbox = document.getElementById("filter_failing");
failing_checkbox.addEventListener('change', function() {
filter_table(this);
});
filter_table(failing_checkbox)
</script>