Updated dashboard diagrams

pull/24/head
Jordan 2014-07-05 22:57:17 -05:00
parent 02c7c4b5b1
commit c9d00059b0
2 changed files with 30 additions and 17 deletions

View File

@ -6,6 +6,7 @@ import (
"io/ioutil" "io/ioutil"
) )
// SMTPServer represents the SMTP configuration details
type SMTPServer struct { type SMTPServer struct {
Host string `json:"host"` Host string `json:"host"`
User string `json:"user"` User string `json:"user"`

View File

@ -1,4 +1,5 @@
app.controller('DashboardCtrl', function($scope, CampaignService, ngTableParams, $http) { app.controller('DashboardCtrl', function($scope, $filter, $location, CampaignService, ngTableParams, $http) {
$scope.campaigns = []
$scope.mainTableParams = new ngTableParams({ $scope.mainTableParams = new ngTableParams({
page: 1, // show first page page: 1, // show first page
count: 10, // count per page count: 10, // count per page
@ -11,26 +12,26 @@ app.controller('DashboardCtrl', function($scope, CampaignService, ngTableParams,
CampaignService.query(function(campaigns) { CampaignService.query(function(campaigns) {
$scope.campaigns = campaigns $scope.campaigns = campaigns
var campaign_series = [] var campaign_series = []
angular.copy(campaigns, campaign_series)
angular.forEach(campaigns, function(campaign, key) { angular.forEach(campaigns, function(campaign, key) {
campaign_series.push({ campaign.x = new Date(campaign.created_date)
y: 0 campaign.y = 0
})
angular.forEach(campaign.results, function(result, r_key) { angular.forEach(campaign.results, function(result, r_key) {
if (result.status == "Clicked Link") { if (result.status == "Clicked Link") {
campaign_series[campaign_series.length - 1].y++; campaign.y++;
} }
}) })
campaign_series[campaign_series.length - 1].y = Math.floor((campaign_series[campaign_series.length - 1].y / campaign.results.length)*100) campaign.y = Math.floor((campaign.y / campaign.results.length) * 100)
console.log(campaign_series)
}); });
$scope.overview_chart = { $scope.overview_chart = {
options: { options: {
chart: { chart: {
type: 'area' type: 'area',
zoomType: "x"
}, },
tooltip: { tooltip: {
formatter: function() { formatter: function() {
return "Successful Phishes: " + this.point.y + "%" return "Name: " + this.point.name + "<br/>Successful Phishes: " + this.point.y + "%<br/>Date: " + $filter("date")(this.point.x, "medium")
}, },
style: { style: {
padding: 10, padding: 10,
@ -38,18 +39,29 @@ app.controller('DashboardCtrl', function($scope, CampaignService, ngTableParams,
} }
}, },
plotOptions: { plotOptions: {
pie: { series: {
allowPointSelect: true,
cursor: 'pointer', cursor: 'pointer',
dataLabels: { point: {
enabled: false events: {
}, click: function(e) {
showInLegend: true console.log(this)
$location.path("/campaigns/" + this.id)
$scope.$apply()
}
}
}
} }
} },
xAxis: {
type: 'datetime',
max: Date.now(),
title: {
text: 'Date'
}
},
}, },
series: [{ series: [{
data: campaign_series data: $scope.campaigns
}], }],
title: { title: {
text: 'Phishing Success Overview' text: 'Phishing Success Overview'