From 5cbc95e229d1aa67da18396a619875bb2ad23179 Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Tue, 25 Apr 2017 16:20:51 -0500 Subject: [PATCH] Show last update time for status --- webui/assets/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webui/assets/main.js b/webui/assets/main.js index 2adec2148..d5105c600 100644 --- a/webui/assets/main.js +++ b/webui/assets/main.js @@ -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')