Adding the JS to handle submitting the "ignore cert errors" with a campaign.

Adding JS to handle showing errors on email submissions
pull/146/head
Jordan Wright 2016-02-12 21:25:49 -06:00
parent 26577bc3c3
commit 12975bf0c3
2 changed files with 27 additions and 18 deletions

View File

@ -139,21 +139,28 @@ function renderTimeline(data) {
' <span class="timeline-date">' + moment(event.time).format('MMMM Do YYYY h:mm') + '</span>' ' <span class="timeline-date">' + moment(event.time).format('MMMM Do YYYY h:mm') + '</span>'
if (event.details) { if (event.details) {
results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> View Details</div>' results += '<div class="timeline-event-details"><i class="fa fa-caret-right"></i> View Details</div>'
results += '<div class="timeline-event-table">'
results += ' <table class="table table-condensed table-bordered table-striped">'
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) { if (details.payload) {
if (param == "rid") { results += '<div class="timeline-event-results">'
return true; results += ' <table class="table table-condensed table-bordered table-striped">'
} results += ' <thead><tr><th>Parameter</th><th>Value(s)</tr></thead><tbody>'
results += ' <tr>' $.each(Object.keys(details.payload), function(i, param) {
results += ' <td>' + param + '</td>' if (param == "rid") {
results += ' <td>' + details.payload[param] + '</td>' return true;
results += ' </tr>' }
}) results += ' <tr>'
results += ' </tbody></table>' results += ' <td>' + param + '</td>'
results += '</div>' results += ' <td>' + details.payload[param] + '</td>'
results += ' </tr>'
})
results += ' </tbody></table>'
results += '</div>'
}
if (details.error) {
results += '<div class="timeline-event-results">'
results += '<span class="label label-default">Error</span> ' + details.error
results += '</div>'
}
} }
results += '</div></div>' results += '</div></div>'
} }
@ -174,15 +181,15 @@ $(document).ready(function() {
// Setup viewing the details of a result // Setup viewing the details of a result
$("#resultsTable").on("click", ".timeline-event-details", function() { $("#resultsTable").on("click", ".timeline-event-details", function() {
// Show the parameters // Show the parameters
payloadTable = $(this).parent().find(".timeline-event-table") payloadResults = $(this).parent().find(".timeline-event-results")
if (payloadTable.is(":visible")) { if (payloadResults.is(":visible")) {
$(this).find("i").removeClass("fa-caret-down") $(this).find("i").removeClass("fa-caret-down")
$(this).find("i").addClass("fa-caret-right") $(this).find("i").addClass("fa-caret-right")
payloadTable.hide() payloadResults.hide()
} else { } else {
$(this).find("i").removeClass("fa-caret-right") $(this).find("i").removeClass("fa-caret-right")
$(this).find("i").addClass("fa-caret-down") $(this).find("i").addClass("fa-caret-down")
payloadTable.show() payloadResults.show()
} }
}) })
// Setup our graphs // Setup our graphs

View File

@ -35,6 +35,7 @@ function launch() {
host: $("input[name=host]").val(), host: $("input[name=host]").val(),
username: $("input[name=username]").val(), username: $("input[name=username]").val(),
password: $("input[name=password]").val(), password: $("input[name=password]").val(),
ignore_cert_errors: $("#ignore_cert_errors").prop("checked")
}, },
groups: groups groups: groups
} }
@ -73,6 +74,7 @@ function sendTestEmail() {
host: $("input[name=host]").val(), host: $("input[name=host]").val(),
username: $("input[name=username]").val(), username: $("input[name=username]").val(),
password: $("input[name=password]").val(), password: $("input[name=password]").val(),
ignore_cert_errors: $("#ignore_cert_errors").prop("checked")
} }
} }
btnHtml = $("#sendTestModalSubmit").html() btnHtml = $("#sendTestModalSubmit").html()