Added logging output to sunburst

This commit is contained in:
Austin Clark 2015-08-11 15:28:15 -06:00
parent e216d42597
commit 923b153b63
4 changed files with 71 additions and 18 deletions

View File

@ -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]) {
$("<h3>").text(prop).appendTo(parent);
$("<pre>").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 = $('<button/>',
{
text: 'View Log',

View File

@ -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,

View File

@ -6,11 +6,15 @@
{% block head-extra %}
<!-- Scripts for visualization-->
<script src="{% static 'js/visuals.js' %}"></script>
<script src="{% static 'js/sunburst.js' %}"></script>
{% endblock %}
{% block body %}
<div id="details-dialog" title="Details Output">
<p>This is some details output.</p>
</div>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Results from Run #{{run_id}}</h1>
@ -68,14 +72,16 @@
</div>
</div>
<script>
window.addEventListener('load', function() {
$("#details-dialog").hide();
var url = "tempest_api_tree_{{run_id}}.json";
if ("{{use_gzip}}" === "True") {
url += ".gz";
}
createSunburst( url );
createSunburst( url, {{run_id}} );
});
</script>
<script>

View File

@ -70,20 +70,6 @@
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-file-text fa-fw"></i> Log Output
</div>
<div id="timeline-details" class="panel-body">
<em>Click an item to view log details.</em>
</div>
</div>
</div>
</div>
<script src="{% static 'js/timeline.js' %}"></script>
<script>
var originalInfoContent = null;