diff --git a/static/css/main.css b/static/css/main.css index 89abd3af..64c02f39 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -445,3 +445,6 @@ table.dataTable thead .sorting_desc:after { margin-top: 10px; margin-bottom: 10px; } +.timeline-event-table{ + display:none; +} diff --git a/static/js/app/campaign_results.js b/static/js/app/campaign_results.js index a5249855..5330fb93 100644 --- a/static/js/app/campaign_results.js +++ b/static/js/app/campaign_results.js @@ -38,7 +38,7 @@ var statuses = { label: "label-default", icon: "fa-times" }, - "Submitted Data":{ + "Submitted Data": { slice: "ct-slice-donut-clicked", legend: "ct-legend-clicked", label: "label-danger", @@ -83,14 +83,16 @@ function exportAsCSV(scope) { exportHTML = $("#exportButton").html() var csvScope = null switch (scope) { - case "results": - csvScope = campaign.results - break; - case "events": - csvScope = campaign.timeline - break; + case "results": + csvScope = campaign.results + break; + case "events": + csvScope = campaign.timeline + break; + } + if (!csvScope) { + return } - if (!csvScope){return} $("#exportButton").html('') var csvString = Papa.unparse(csvScope, {}) var csvData = new Blob([csvString], { @@ -129,22 +131,24 @@ function renderTimeline(data) { ' ' + '
' } }) @@ -161,6 +165,20 @@ $(document).ready(function() { $("#page-title").text("Results for " + c.name) // Setup tooltips $('[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 var timeline_data = { series: [{