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(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 = $('',
{
text: 'View Log',
diff --git a/stackviz/static/js/visuals.js b/stackviz/static/js/sunburst.js
similarity index 97%
rename from stackviz/static/js/visuals.js
rename to stackviz/static/js/sunburst.js
index 5a5e662..5d014c7 100644
--- a/stackviz/static/js/visuals.js
+++ b/stackviz/static/js/sunburst.js
@@ -16,6 +16,8 @@
"use strict";
+var runId = null;
+
function populateTable(d, textColor) {
var oldtbl = document.getElementById("result-table-div");
oldtbl.innerHTML = "";
@@ -34,6 +36,8 @@ function populateTable(d, textColor) {
}
document.getElementById("result-table-div").appendChild(tbl);
document.getElementById("table-heading").innerHTML=d.name;
+ addDialogButton("#result-table-div",runId);
+ showDetails(d);
}
else {
for (var j in d.children) {
@@ -100,7 +104,8 @@ function displayFailingTests(d) {
}
-function createSunburst(url) {
+function createSunburst(url, run_id) {
+ runId = run_id;
var width = 700,
height = 500,
diff --git a/stackviz/templates/tempest/results.html b/stackviz/templates/tempest/results.html
index 68a8bf0..e668946 100644
--- a/stackviz/templates/tempest/results.html
+++ b/stackviz/templates/tempest/results.html
@@ -6,11 +6,15 @@
{% block head-extra %}
-
+
{% endblock %}
{% block body %}
+
+ This is some details output.
+
+
Results from Run #{{run_id}}
@@ -68,14 +72,16 @@
+