Adding colors for the timeline

pull/207/head
Jordan Wright 2016-03-08 21:37:30 -06:00
parent d04c562d7e
commit 1062d1b3b8
2 changed files with 76 additions and 15 deletions

38
static/css/main.css vendored
View File

@ -209,6 +209,36 @@
cursor:pointer; cursor:pointer;
} }
.ct-timeline-point{
cursor:pointer;
stroke:#ffffff;
stroke-width:1px;
}
.ct-point-sending {
fill:#428bca !important;
}
.ct-point-error {
fill:#6c7a89 !important;
}
.ct-point-clicked {
fill:#f05b4f !important;
}
.ct-point-opened {
fill:#eb9532 !important;
}
.ct-point-sent {
fill:#1abc9c !important;
}
.ct-point-success {
fill:#f05b4f !important;
}
.chartist-tooltip{ .chartist-tooltip{
position:absolute; position:absolute;
display:inline-block; display:inline-block;
@ -309,6 +339,10 @@
stroke:#f05b4f !important; stroke:#f05b4f !important;
} }
.ct-slice-donut.ct-slice-donut-sending{
stroke:#428bca !important;
}
.ct-legend-error { .ct-legend-error {
background-color: #6c7a89 !important; background-color: #6c7a89 !important;
} }
@ -329,6 +363,10 @@
background-color: #f05b4f !important; background-color: #f05b4f !important;
} }
.ct-legend-sending {
background-color: #428bca !important;
}
.gophish-editor { .gophish-editor {
font-family: 'Courier New',Monospace !important; font-family: 'Courier New',Monospace !important;
font-size: small !important; font-size: small !important;

View File

@ -6,55 +6,64 @@ var statuses = {
slice: "ct-slice-donut-sent", slice: "ct-slice-donut-sent",
legend: "ct-legend-sent", legend: "ct-legend-sent",
label: "label-success", label: "label-success",
icon: "fa-envelope" icon: "fa-envelope",
point: "ct-point-sent"
}, },
"Email Opened": { "Email Opened": {
slice: "ct-slice-donut-opened", slice: "ct-slice-donut-opened",
legend: "ct-legend-opened", legend: "ct-legend-opened",
label: "label-warning", label: "label-warning",
icon: "fa-envelope" icon: "fa-envelope",
point: "ct-point-opened"
}, },
"Clicked Link": { "Clicked Link": {
slice: "ct-slice-donut-clicked", slice: "ct-slice-donut-clicked",
legend: "ct-legend-clicked", legend: "ct-legend-clicked",
label: "label-danger", label: "label-danger",
icon: "fa-mouse-pointer" icon: "fa-mouse-pointer",
point: "ct-point-clicked"
}, },
"Success": { "Success": {
slice: "ct-slice-donut-clicked", slice: "ct-slice-donut-clicked",
legend: "ct-legend-clicked", legend: "ct-legend-clicked",
label: "label-danger", label: "label-danger",
icon: "fa-exclamation" icon: "fa-exclamation",
point: "ct-point-clicked"
}, },
"Error": { "Error": {
slice: "ct-slice-donut-error", slice: "ct-slice-donut-error",
legend: "ct-legend-error", legend: "ct-legend-error",
label: "label-default", label: "label-default",
icon: "fa-times" icon: "fa-times",
point: "ct-point-error"
}, },
"Error Sending Email": { "Error Sending Email": {
slice: "ct-slice-donut-error", slice: "ct-slice-donut-error",
legend: "ct-legend-error", legend: "ct-legend-error",
label: "label-default", label: "label-default",
icon: "fa-times" icon: "fa-times",
point: "ct-point-error"
}, },
"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",
icon: "fa-exclamation" icon: "fa-exclamation",
point: "ct-point-clicked"
}, },
"Unknown": { "Unknown": {
slice: "ct-slice-donut-error", slice: "ct-slice-donut-error",
legend: "ct-legend-error", legend: "ct-legend-error",
label: "label-default", label: "label-default",
icon: "fa-question" icon: "fa-question",
point: "ct-point-error"
}, },
"Sending": { "Sending": {
slice: "ct-slice-donut-error", slice: "ct-slice-donut-sending",
legend: "ct-legend-error", legend: "ct-legend-sending",
label: "label-primary", label: "label-primary",
icon: "fa-spinner" icon: "fa-spinner",
point: "ct-point-sending"
}, },
"Campaign Created": { "Campaign Created": {
label: "label-success", label: "label-success",
@ -412,23 +421,36 @@ function load() {
$("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + status + '</li>') $("#email_chart_legend").append('<li><span class="' + statuses[status].legend + '"></span>' + status + '</li>')
}) })
var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts) var timeline_chart = new Chartist.Line('#timeline_chart', timeline_data, timeline_opts)
timeline_chart.on('draw', function(data) {
if (data.type === "point") {
var point_style = statuses[campaign.timeline[data.meta].message].point
var circle = new Chartist.Svg("circle", {
cx: [data.x],
cy: [data.y],
r: 5,
fill: "#283F50",
meta: data.meta,
value: 1,
}, point_style + ' ct-timeline-point')
data.element.replace(circle)
}
})
// Setup the overview chart listeners // Setup the overview chart listeners
$chart = $("#timeline_chart") $chart = $("#timeline_chart")
var $toolTip = $chart var $toolTip = $chart
.append('<div class="chartist-tooltip"></div>') .append('<div class="chartist-tooltip"></div>')
.find('.chartist-tooltip') .find('.chartist-tooltip')
.hide(); .hide();
$chart.on('mouseenter', '.ct-point', function() { $chart.on('mouseenter', '.ct-timeline-point', function() {
var $point = $(this) var $point = $(this)
value = $point.attr('ct:value') cidx = $point.attr('meta')
cidx = $point.attr('ct:meta')
html = "Event: " + campaign.timeline[cidx].message html = "Event: " + campaign.timeline[cidx].message
if (campaign.timeline[cidx].email) { if (campaign.timeline[cidx].email) {
html += '<br>' + "Email: " + campaign.timeline[cidx].email html += '<br>' + "Email: " + campaign.timeline[cidx].email
} }
$toolTip.html(html).show() $toolTip.html(html).show()
}); });
$chart.on('mouseleave', '.ct-point', function() { $chart.on('mouseleave', '.ct-timeline-point', function() {
$toolTip.hide(); $toolTip.hide();
}); });
$chart.on('mousemove', function(event) { $chart.on('mousemove', function(event) {
@ -437,6 +459,7 @@ function load() {
top: (event.offsetY + 70 || event.originalEvent.layerY) - $toolTip.height() - 40 top: (event.offsetY + 70 || event.originalEvent.layerY) - $toolTip.height() - 40
}); });
}); });
var email_chart = new Chartist.Pie("#email_chart", email_data, email_opts) var email_chart = new Chartist.Pie("#email_chart", email_data, email_opts)
email_chart.on('draw', function(data) { email_chart.on('draw', function(data) {
data.element.addClass(statuses[data.meta].slice) data.element.addClass(statuses[data.meta].slice)