Added table for displaying submitted data.

pull/123/head
Jordan Wright 2016-02-02 22:49:30 -06:00
parent 528d8525b1
commit 99da20abc0
2 changed files with 45 additions and 24 deletions

3
static/css/main.css vendored
View File

@ -445,3 +445,6 @@ table.dataTable thead .sorting_desc:after {
margin-top: 10px; margin-top: 10px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.timeline-event-table{
display:none;
}

View File

@ -38,7 +38,7 @@ var statuses = {
label: "label-default", label: "label-default",
icon: "fa-times" icon: "fa-times"
}, },
"Submitted Data":{ "Submitted Data": {
slice: "ct-slice-donut-clicked", slice: "ct-slice-donut-clicked",
legend: "ct-legend-clicked", legend: "ct-legend-clicked",
label: "label-danger", label: "label-danger",
@ -90,7 +90,9 @@ function exportAsCSV(scope) {
csvScope = campaign.timeline csvScope = campaign.timeline
break; break;
} }
if (!csvScope){return} if (!csvScope) {
return
}
$("#exportButton").html('<i class="fa fa-spinner fa-spin"></i>') $("#exportButton").html('<i class="fa fa-spinner fa-spin"></i>')
var csvString = Papa.unparse(csvScope, {}) var csvString = Papa.unparse(csvScope, {})
var csvData = new Blob([csvString], { var csvData = new Blob([csvString], {
@ -135,8 +137,10 @@ function renderTimeline(data) {
results += ' <table class="table table-condensed table-bordered table-striped">' results += ' <table class="table table-condensed table-bordered table-striped">'
results += ' <thead><tr><th>Parameter</th><th>Value(s)</tr></thead><tbody>' results += ' <thead><tr><th>Parameter</th><th>Value(s)</tr></thead><tbody>'
details = JSON.parse(event.details) details = JSON.parse(event.details)
$.each(Object.keys(details.payload), function(i, param){ $.each(Object.keys(details.payload), function(i, param) {
if (param == "rid") { return true; } if (param == "rid") {
return true;
}
results += ' <tr>' results += ' <tr>'
results += ' <td>' + param + '</td>' results += ' <td>' + param + '</td>'
results += ' <td>' + details.payload[param] + '</td>' results += ' <td>' + details.payload[param] + '</td>'
@ -161,6 +165,20 @@ $(document).ready(function() {
$("#page-title").text("Results for " + c.name) $("#page-title").text("Results for " + c.name)
// Setup tooltips // Setup tooltips
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
// Setup viewing the details of a result
$("#resultsTable").on("click", ".timeline-event-details", function() {
// Show the parameters
payloadTable = $(this).parent().find(".timeline-event-table")
if (payloadTable.is(":visible")) {
$(this).find("i").removeClass("fa-caret-down")
$(this).find("i").addClass("fa-caret-right")
payloadTable.hide()
} else {
$(this).find("i").removeClass("fa-caret-right")
$(this).find("i").addClass("fa-caret-down")
payloadTable.show()
}
})
// Setup our graphs // Setup our graphs
var timeline_data = { var timeline_data = {
series: [{ series: [{