mirror of https://github.com/gophish/gophish
Fixed event timeline chart - should work fairly well
parent
0c71c8982e
commit
4f03224d98
|
@ -37,11 +37,17 @@ $(document).ready(function(){
|
||||||
campaign = c
|
campaign = c
|
||||||
if (campaign){
|
if (campaign){
|
||||||
// Setup our graphs
|
// Setup our graphs
|
||||||
var timeline_chart = {labels:[],series:[[]]}
|
var timeline_data = {labels:[],series:[]}
|
||||||
var email_chart = {series:[]}
|
var email_data = {series:[]}
|
||||||
var timeline_opts = {
|
var timeline_opts = {
|
||||||
axisX: {
|
axisX: {
|
||||||
showGrid: false
|
showGrid: false,
|
||||||
|
},
|
||||||
|
axisY: {
|
||||||
|
type: Chartist.FixedScaleAxis,
|
||||||
|
ticks: [0, 1, 2],
|
||||||
|
low: 0,
|
||||||
|
showLabel: false
|
||||||
},
|
},
|
||||||
showArea: true,
|
showArea: true,
|
||||||
plugins: []
|
plugins: []
|
||||||
|
@ -52,8 +58,7 @@ $(document).ready(function(){
|
||||||
chartPadding: 0,
|
chartPadding: 0,
|
||||||
showLabel: false
|
showLabel: false
|
||||||
}
|
}
|
||||||
$("#loading").hide()
|
// Setup the results table
|
||||||
$("#campaignResults").show()
|
|
||||||
resultsTable = $("#resultsTable").DataTable();
|
resultsTable = $("#resultsTable").DataTable();
|
||||||
$.each(campaign.results, function(i, result){
|
$.each(campaign.results, function(i, result){
|
||||||
label = labels[result.status] || "label-default";
|
label = labels[result.status] || "label-default";
|
||||||
|
@ -65,6 +70,42 @@ $(document).ready(function(){
|
||||||
"<span class=\"label " + label + "\">" + result.status + "</span>"
|
"<span class=\"label " + label + "\">" + result.status + "</span>"
|
||||||
]).draw()
|
]).draw()
|
||||||
})
|
})
|
||||||
|
// Setup the graphs
|
||||||
|
$.each(campaign.timeline, function(i, event){
|
||||||
|
timeline_data.labels.push(moment(event.time).format('MMMM Do YYYY h:mm'))
|
||||||
|
timeline_data.series.push([{meta : i, value: 1}])
|
||||||
|
})
|
||||||
|
var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts)
|
||||||
|
|
||||||
|
// Setup the overview chart listeners
|
||||||
|
$chart = $("#timeline_chart")
|
||||||
|
var $toolTip = $chart
|
||||||
|
.append('<div class="chartist-tooltip"></div>')
|
||||||
|
.find('.chartist-tooltip')
|
||||||
|
.hide();
|
||||||
|
|
||||||
|
$chart.on('mouseenter', '.ct-point', function() {
|
||||||
|
var $point = $(this)
|
||||||
|
value = $point.attr('ct:value')
|
||||||
|
cidx = $point.attr('ct:meta')
|
||||||
|
html = "Event: " + campaign.timeline[cidx].message
|
||||||
|
if (campaign.timeline[cidx].email) {
|
||||||
|
html += '<br>' + "Email: " + campaign.timeline[cidx].email
|
||||||
|
}
|
||||||
|
$toolTip.html(html).show()
|
||||||
|
});
|
||||||
|
|
||||||
|
$chart.on('mouseleave', '.ct-point', function() {
|
||||||
|
$toolTip.hide();
|
||||||
|
});
|
||||||
|
$chart.on('mousemove', function(event) {
|
||||||
|
$toolTip.css({
|
||||||
|
left: (event.offsetX || event.originalEvent.layerX) - $toolTip.width() / 2 - 10,
|
||||||
|
top: (event.offsetY + 0 || event.originalEvent.layerY) - $toolTip.height() - 40
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#loading").hide()
|
||||||
|
$("#campaignResults").show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.error(function(){
|
.error(function(){
|
||||||
|
|
Loading…
Reference in New Issue