diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-09-10 20:16:28 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-09-11 20:41:32 +0100 |
commit | 65151dd29dc01c6d1f6ff79ab6f8e049e925ce25 (patch) | |
tree | 2db5267b573f2a58ffff94de7f9b9af5f9767d82 /server/static | |
parent | 2e7c8c2f521c9e50bb3aea4df16771c22fe70e58 (diff) |
Add a toggle for unexpired certs
Diffstat (limited to 'server/static')
-rw-r--r-- | server/static/js/table.js | 49 | ||||
-rw-r--r-- | server/static/static.go | 22 |
2 files changed, 70 insertions, 1 deletions
diff --git a/server/static/js/table.js b/server/static/js/table.js new file mode 100644 index 0000000..da0da39 --- /dev/null +++ b/server/static/js/table.js @@ -0,0 +1,49 @@ +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"]; + if (el.revoked) { + row.insertCell(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"; + } +} diff --git a/server/static/static.go b/server/static/static.go index 16f1c72..28719ca 100644 --- a/server/static/static.go +++ b/server/static/static.go @@ -296,7 +296,7 @@ AAD//7viGWrCLAAA "/static/js/list.min.js": { local: "server/static/js/list.min.js", size: 15785, - modtime: 1472412760, + modtime: 1472414777, compressed: ` H4sIAAAJbogA/6x7bZPbNpLwX5H4uLRABHGkxMnuksaovI5TT65i++rsvS8UvQUCIMUxRcokNGOfxP3t V3gjQYrjnezlywzx1mh0N/oNrXl6KqnIq3JGQIIoYvDc9XCQoT085ymY0yiL9Veivu5JPcuxZ6d6GIuv @@ -389,6 +389,26 @@ FG1iGP5vAAAA//84G4UUqT0AAA== `, }, + "/static/js/table.js": { + local: "server/static/js/table.js", + size: 1414, + modtime: 1473620952, + compressed: ` +H4sIAAAJbogA/3xU3W4aPRC95ynm21ysUYghX9qb0k1VRai0Io0UkFopipBZD+Bi7I3t5UcV717Zy/4k +0N4g1j5n5szxzMxzlTqhFRh8GQnrUKEhbfjdAtgwAwZTCwl8Gz98pxkzFolbCksN2kwrixPcuXb/iHVs +JhES4DrN16gcfcnR7McoMXXakPgiReOuAiquSTPN95AU5DeM6EIK66KA3S6FRCABTo3eWipRLdwSbqFX +yIUiFuUo0eGj3pJeYB5aAMLaHLmvj6YSmSHhxhdH59oMWLoklRFrtsKJV0NQdkB0gBlTZgiW6K3XG3IJ +ZdE4n+vqOoQEf308vkMpSa9NhVJohpP7ESSAkq5wPxX8LPj6BJwaZA75lLmzhP9PCLjLhEF7Fn1zgs6M +UKnImDxPeHdCMLjRKzyq73bhq+K4gxXuBQemONQBaRUwRSntU++ZppJZ6x8BEniKAil67r/B3bzF1SFL +sJgDqbWUb3Oi/v1r9fFHobLcgXV7iUm0ZmYh1IdePwK3zzCJ0iWmq5neRbBhMsckii/r54JLiCNQbO2B +aNxU8AgEb3x0b+NC3aHRiyzLUPG7pZCcGL0t+jH8NjrSYHDR9+Sh1ar6UGrG79A4S5iUjYmEBBRu4ef9 +aOhc9ogvOVpHqoFCxTMtlPcu7jK+FqrrNVr6y2oVJHr7qpBQEy4TiD8xKRNncozL0TFUZ6hI/GUwiTsV +uJgfyjgfbFC5anPEXnXcaW6TI9Si4qTtK/Qqx8OHH9PPI/8ucyYt9huFO71YSByERuaNXTTLndPq7wsm +uiiYV6HeYm008vxX/vfntbnlabu0pqYctZVGFflf9VQ0XuotHKVGwTJAafEfjKHg+JrROrT+BAAA//+v +G1KqhgUAAA== +`, + }, + "/": { isDir: true, local: "server", |