blob: 8dcf0f024b4a3f9e38353617fb6874954e036a99 (
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
|
function reqListener() {
var recs = JSON.parse(this.responseText);
var table = document.querySelector('#cert-table');
var tbody = table.querySelector("#list");
while (tbody.rows.length > 0) {
tbody.deleteRow(0);
}
issuedList.clear();
recs.forEach(function makeTable(el, i, arr) {
var row = tbody.insertRow(-1);
row.insertCell(0).innerHTML = el.key_id;
row.insertCell(1).innerHTML = el.created_at;
row.insertCell(2).innerHTML = el.expires;
row.insertCell(3).innerHTML = el.principals;
row.insertCell(4).innerHTML = el.revoked;
// Index keyid and principals.
row.cells[0].classList = ["keyid"];
row.cells[3].classList = ["principals"];
row.insertCell(5)
if (!el.revoked) {
row.cells[5].innerHTML = '<input style="margin:0;" type="checkbox" value="'+ el.key_id + '" name="cert_id" id="cert_id" />';
}
tbody.appendChild(row);
});
issuedList.reIndex();
}
function loadCerts(all) {
var r = new XMLHttpRequest();
var endpoint = '/admin/certs.json';
if (all) {
endpoint += '?all=true';
}
r.open('GET', endpoint);
r.addEventListener('load', reqListener);
r.send()
}
var SHOW_ALL = false;
function toggleExpired() {
var button = document.querySelector("#toggle-certs");
SHOW_ALL = !SHOW_ALL;
loadCerts(SHOW_ALL);
if (SHOW_ALL == false) {
button.innerHTML = "Show Expired";
} else {
button.innerHTML = "Hide Expired";
}
}
|