aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-05-28 03:20:27 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-05-28 03:20:27 +0200
commit392ad3284d9e686ee49b51565490d665ca7e4284 (patch)
tree11ee393eb179cbd62b77c29936d1983e53ec7982 /web/js
parent6cab3bad114fd0806fd1d3feb562a53138c91708 (diff)
front: More visual tweaks and tuneups
- Time in oplog is now localtime and properly padded (00:10, not 0:10) - Health map instead of combo/aggregated - Tweak the menu slightly - Rotate and resize the random switch in guess_placement
Diffstat (limited to 'web/js')
-rw-r--r--web/js/nms-info-box.js3
-rw-r--r--web/js/nms-map-handlers.js26
-rw-r--r--web/js/nms-oplog.js7
-rw-r--r--web/js/nms.js2
4 files changed, 22 insertions, 16 deletions
diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js
index 772f711..cd5594e 100644
--- a/web/js/nms-info-box.js
+++ b/web/js/nms-info-box.js
@@ -837,7 +837,8 @@ var switchCommentsPanel = function () {
tr.className =
td1 = tr.insertCell(0);
td2 = tr.insertCell(1);
- td1.textContent = logs[v]['timestamp'];
+ var date = new Date(logs[v]['timestamp']);
+ td1.textContent = date.toString();
td2.textContent = "[" + logs[v]['username'] + "] " + logs[v]['log'];
}
domObj.appendChild(table);
diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js
index dea0b6e..61a5a05 100644
--- a/web/js/nms-map-handlers.js
+++ b/web/js/nms-map-handlers.js
@@ -69,11 +69,11 @@ var handler_cpu = {
name:"CPU utilization"
};
-var handler_combo = {
- init:comboInit,
- getInfo:comboInfo,
- tag:"combo",
- name:"Aggregated health"
+var handler_health = {
+ init:healthInit,
+ getInfo:healthInfo,
+ tag:"health",
+ name:"Health"
};
var handler_mgmt = {
@@ -112,7 +112,7 @@ var handlerInfo = function(tag,desc) {
* Order matches what's seen in the infobox
*/
var handlers = [
- handler_combo,
+ handler_health,
handler_mgmt,
handler_uplinks,
handler_temp,
@@ -591,12 +591,12 @@ function cpuInit() {
setLegend(5,"white","N/A");
}
-function comboInfo(sw) {
- var worst = new handlerInfo("combo", "Combo");
+function healthInfo(sw) {
+ var worst = new handlerInfo("health", "Health");
worst.score = 0;
worst.why = "All good";
for (var h in handlers) {
- if (handlers[h].tag== "combo")
+ if (handlers[h].tag== "health")
continue;
if (handlers[h].getInfo == undefined)
continue;
@@ -612,18 +612,18 @@ function comboInfo(sw) {
return worst;
}
-function comboUpdater() {
+function healthUpdater() {
if (nmsData.switches == undefined || nmsData.switches.switches == undefined)
return;
for (var sw in nmsData.switches.switches) {
- var worst = comboInfo(sw);
+ var worst = healthInfo(sw);
nmsMap.setSwitchColor(sw, nmsColor.getColorStop(worst.score));
nmsMap.setSwitchInfo(sw, worst.tag);
}
}
-function comboInit() {
- nmsData.addHandler("ping", "mapHandler", comboUpdater);
+function healthInit() {
+ nmsData.addHandler("ping", "mapHandler", healthUpdater);
nmsColor.drawGradient([nmsColor.green,nmsColor.orange,nmsColor.red]);
setLegend(1,nmsColor.getColorStop(0),"All good");
setLegend(2,nmsColor.getColorStop(250),"Ok-ish");
diff --git a/web/js/nms-oplog.js b/web/js/nms-oplog.js
index 8fe50a4..83bda69 100644
--- a/web/js/nms-oplog.js
+++ b/web/js/nms-oplog.js
@@ -85,7 +85,12 @@ nmsOplog._updateComments = function(limit,prefix,timefield) {
tr = table.insertRow(-1);
td1 = tr.insertCell(0);
td2 = tr.insertCell(1);
- td1.textContent = nmsData['oplog']['oplog'][v][timefield];
+ var date = new Date(nmsData.oplog.oplog[v]['timestamp']);
+ if (timefield == "time") {
+ td1.textContent = date.toTimeString().replace(/:\d\d .*$/,"");
+ } else {
+ td1.textContent = date.toString();
+ }
td2.textContent = "[" + nmsData['oplog']['oplog'][v]['username'] + "] " + nmsData['oplog']['oplog'][v]['log'];
td2.hiddenthing = v;
td2.onclick = function(e){ var x = document.getElementById("searchbox"); var v = e.path[0].hiddenthing; x.value = nmsData['oplog']['oplog'][v]['systems']; x.oninput(); }
diff --git a/web/js/nms.js b/web/js/nms.js
index d76fa8f..eb0942a 100644
--- a/web/js/nms.js
+++ b/web/js/nms.js
@@ -650,7 +650,7 @@ function setMapModeFromN(e,key)
setUpdater(handler_dhcp);
break;
case '4':
- setUpdater(handler_combo);
+ setUpdater(handler_health);
break;
case '5':
setUpdater(handler_temp);