You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by el...@apache.org on 2017/01/24 15:39:29 UTC

[07/10] incubator-trafficcontrol git commit: correctly display DS Statuses

correctly display DS Statuses


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/476c7ad8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/476c7ad8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/476c7ad8

Branch: refs/heads/master
Commit: 476c7ad82b6ea4974ac3a038c15357066283b558
Parents: bfdb478
Author: David Neuman <da...@gmail.com>
Authored: Mon Jan 23 10:09:59 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Tue Jan 24 08:38:45 2017 -0700

----------------------------------------------------------------------
 .../experimental/traffic_monitor/static/index.html    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/476c7ad8/traffic_monitor/experimental/traffic_monitor/static/index.html
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/static/index.html b/traffic_monitor/experimental/traffic_monitor/static/index.html
index b3d6227..401cc6e 100644
--- a/traffic_monitor/experimental/traffic_monitor/static/index.html
+++ b/traffic_monitor/experimental/traffic_monitor/static/index.html
@@ -216,7 +216,7 @@ under the License.
 
 		 var lastEvent = 0;
 		 function getEvents() {
-			 /// \todo add /api/events-since/{index} (and change Traffic Monitor to keep latest 
+			 /// \todo add /api/events-since/{index} (and change Traffic Monitor to keep latest
 			 ajax("/publish/EventLog", function(r) {
 				 var jdata = JSON.parse(r);
 				 for (i = jdata.events.length - 1; i >= 0; i--) {
@@ -358,7 +358,9 @@ under the License.
 				 var j = JSON.parse(r);
 				 var jds = j.deliveryService
 				 var deliveryServiceNames = Object.keys(jds); //debug
-				 for (i = 0; i < deliveryServiceNames.length; i++) {
+				 //decrementing for loop so DsNames are alphabetical A-Z
+				 //TODO allow for filtering of columns so this isn't necessary
+					for (var i = deliveryServiceNames.length - 1; i >= 0; i--) {
 					 var deliveryService = deliveryServiceNames[i];
 
 					 if (!document.getElementById("deliveryservice-stats-" + deliveryService)) {
@@ -385,7 +387,7 @@ under the License.
 
 					 // \todo check that array has a member before dereferencing [0]
 					 if (jds[deliveryService].hasOwnProperty("isAvailable")) {
-						 document.getElementById("deliveryservice-stats-" + deliveryService + "-status").textContent = jds[deliveryService]["isAvailable"][0].value ? "available" : "unavailable";
+						 document.getElementById("deliveryservice-stats-" + deliveryService + "-status").textContent = jds[deliveryService]["isAvailable"][0].value == "true" ? " available" : "unavailable - " + jds[deliveryService]["error-string"][0].value;
 					 }
 					 if (jds[deliveryService].hasOwnProperty("caches-reporting") && jds[deliveryService].hasOwnProperty("caches-available") && jds[deliveryService].hasOwnProperty("caches-configured")) {
 						 document.getElementById("deliveryservice-stats-" + deliveryService + "-caches-reporting").textContent = jds[deliveryService]['caches-reporting'][0].value + " / " + jds[deliveryService]['caches-available'][0].value + " / " + jds[deliveryService]['caches-configured'][0].value;
@@ -419,11 +421,11 @@ under the License.
 					 // \todo implement disabled locations
 
 					 var row = document.getElementById("deliveryservice-stats-" + deliveryService);
-					 if (jds[deliveryService]["isAvailable"][0].value) {
+					 if (jds[deliveryService]["isAvailable"][0].value == "true") {
 						 row.classList.add("stripes");
-						 row.classList.remove("unavailable");
+						 row.classList.remove("error");
 					 } else {
-						 row.classList.add("unavailable");
+						 row.classList.add("error");
 						 row.classList.remove("stripes");
 					 }
 				 }