Show last update time for status

This commit is contained in:
Alan Bernstein 2017-04-25 16:20:51 -05:00
parent 688f82cbdf
commit 5cbc95e229

View file

@ -229,10 +229,20 @@ function update_cluster_status() {
xhr.onload = function() {
status_formatted = JSON.stringify(JSON.parse(xhr.responseText), null, 4)
status_node.innerHTML = status_formatted
time_node.innerHTML = new Date().today() + " " + new Date().timeNow()
}
xhr.send(null)
}
Date.prototype.today = function () {
return this.getFullYear() +"/"+ (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ ((this.getDate() < 10)?"0":"") + this.getDate();
}
Date.prototype.timeNow = function () {
return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
}
const input = document.getElementById('query')
const output = document.getElementById('outputs')
const button = document.getElementById('query-btn')