From 923b153b63d22c400f5d8406e3babf81d71bdcff Mon Sep 17 00:00:00 2001 From: Austin Clark Date: Tue, 11 Aug 2015 15:28:15 -0600 Subject: [PATCH] Added logging output to sunburst --- stackviz/static/js/log-dialog.js | 58 ++++++++++++++++++- .../static/js/{visuals.js => sunburst.js} | 7 ++- stackviz/templates/tempest/results.html | 10 +++- stackviz/templates/tempest/timeline.html | 14 ----- 4 files changed, 71 insertions(+), 18 deletions(-) rename stackviz/static/js/{visuals.js => sunburst.js} (97%) diff --git a/stackviz/static/js/log-dialog.js b/stackviz/static/js/log-dialog.js index 3b44d84..b815ee8 100644 --- a/stackviz/static/js/log-dialog.js +++ b/stackviz/static/js/log-dialog.js @@ -1,9 +1,65 @@ "use strict"; +var originalDetailsContent = null; -function addDialogButton(parentID) { +var detailsCache = null; +var detailsInProgress = false; +var detailsWaiting = []; +var runId = null; + +var loadDetails = function(callback) { + if (detailsCache === null) { + detailsWaiting.push(callback); + + if (!detailsInProgress) { + var url = "tempest_api_details_" + runId + ".json"; + if ("{{use_gzip}}" === "True") { + url += ".gz"; + } + + detailsInProgress = true; + + d3.json(url, function(error, data) { + if (error) { + throw error; + } + + detailsCache = data; + detailsWaiting.forEach(function(cb) { + cb(detailsCache); + }); + }); + } + } else { + callback(detailsCache); + } +}; + +var showDetails = function(item) { + var parent = $("#details-dialog"); + + loadDetails(function(details) { + if (!details.hasOwnProperty(item.name_full)) { + console.log("Details not found for item:", item.name_full); + return; + } + + if (originalDetailsContent === null) { + originalDetailsContent = parent.html(); + } + + parent.empty(); + for (var prop in details[item.name_full]) { + $("

").text(prop).appendTo(parent); + $("
").text(details[item.name_full][prop]).appendTo(parent);
+        }
+    });
+};
+
+function addDialogButton(parentID, run_id) {
     //parentID: A string contiaining the parent div id to which the button will be appended
+    runId=run_id;
     var button = $('