From c0be58aa3dfbb4397f10177e413fcd4309106e85 Mon Sep 17 00:00:00 2001 From: Paul Werther Date: Sun, 15 Mar 2020 18:38:51 +0100 Subject: [PATCH] Add "mark as reported" to results table (#1772) This commit adds the ability to mark a result as reported directly from the campaign results view. --- static/js/src/app/campaign_results.js | 34 ++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/static/js/src/app/campaign_results.js b/static/js/src/app/campaign_results.js index 36bb3bf6..62b28f35 100644 --- a/static/js/src/app/campaign_results.js +++ b/static/js/src/app/campaign_results.js @@ -777,7 +777,7 @@ function load() { if (reported) { return "" } - return "" + return "" } return reported }, @@ -916,7 +916,35 @@ function refresh() { setRefresh = setTimeout(refresh, 60000) }; - +function report_mail(rid, cid) { + Swal.fire({ + title: "Are you sure?", + text: "This result will be flagged as reported (RID: " + rid + ")", + type: "question", + animation: false, + showCancelButton: true, + confirmButtonText: "Continue", + confirmButtonColor: "#428bca", + reverseButtons: true, + allowOutsideClick: false, + showLoaderOnConfirm: true + }).then(function (result) { + if (result.value){ + api.campaignId.get(cid).success((function(c) { + report_url = c.url; + report_url += report_url.endsWith("/") ? "" : "/"; + report_url += "report?rid=" + rid; + $.ajax({ + url: report_url, + method: "GET", + success: function(data) { + refresh(); + } + }); + })); + } + }) +} $(document).ready(function () { Highcharts.setOptions({ @@ -928,4 +956,4 @@ $(document).ready(function () { // Start the polling loop setRefresh = setTimeout(refresh, 60000) -}) \ No newline at end of file +})