Skip to content

Commit

Permalink
#170 Replace the MISP listing page, with an alert listing page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Apr 10, 2017
1 parent cb13057 commit b337888
Show file tree
Hide file tree
Showing 45 changed files with 740 additions and 187 deletions.
5 changes: 4 additions & 1 deletion ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
<script src="scripts/controllers/admin/AdminObservablesCtrl.js"></script>
<script src="scripts/controllers/admin/AdminReportTemplatesCtrl.js"></script>
<script src="scripts/controllers/admin/AdminUsersCtrl.js"></script>
<script src="scripts/controllers/alert/AlertListCtrl.js"></script>
<script src="scripts/controllers/alert/AlertStatsCtrl.js"></script>
<script src="scripts/controllers/case/CaseCloseModalCtrl.js"></script>
<script src="scripts/controllers/case/CaseCreationCtrl.js"></script>
<script src="scripts/controllers/case/CaseDetailsCtrl.js"></script>
Expand All @@ -149,7 +151,6 @@
<script src="scripts/controllers/cortex/CortexInstanceDialogCtrl.js"></script>
<script src="scripts/controllers/misp/MispBulkImportCtrl.js"></script>
<script src="scripts/controllers/misp/MispEventCtrl.js"></script>
<script src="scripts/controllers/misp/MispListCtrl.js"></script>
<script src="scripts/controllers/misp/MispStatsCtrl.js"></script>
<script src="scripts/directives/charts/c3Chart.js"></script>
<script src="scripts/directives/charts/chart.js"></script>
Expand Down Expand Up @@ -195,6 +196,7 @@
<script src="scripts/filters/showDate.js"></script>
<script src="scripts/services/AfkSrv.js"></script>
<script src="scripts/services/AlertSrv.js"></script>
<script src="scripts/services/AlertingSrv.js"></script>
<script src="scripts/services/AnalyzerInfoSrv.js"></script>
<script src="scripts/services/AnalyzerSrv.js"></script>
<script src="scripts/services/AppLayoutSrv.js"></script>
Expand All @@ -215,6 +217,7 @@
<script src="scripts/services/ListSrv.js"></script>
<script src="scripts/services/MetricsCacheSrv.js"></script>
<script src="scripts/services/MispSrv.js"></script>
<script src="scripts/services/NotificationSrv.js"></script>
<script src="scripts/services/ObservablesUISrv.js"></script>
<script src="scripts/services/PSearchSrv.js"></script>
<script src="scripts/services/ReportTemplateSrv.js"></script>
Expand Down
20 changes: 10 additions & 10 deletions ui/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router
return VersionSrv.get();
},
appLayout: function($q, $rootScope, AppLayoutSrv) {
AppLayoutSrv.init();
AppLayoutSrv.init();
return $q.resolve();
}
}
Expand Down Expand Up @@ -143,7 +143,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router
controller: 'CaseMainCtrl',
title: 'Case',
resolve: {
caze: function($q, $rootScope, $stateParams, CaseSrv, AlertSrv) {
caze: function($q, $rootScope, $stateParams, CaseSrv, NotificationSrv) {
var deferred = $q.defer();

CaseSrv.get({
Expand All @@ -156,7 +156,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router
}, function(response) {
deferred.reject(response);

AlertSrv.error('CaseMainCtrl', response.data, response.status);
NotificationSrv.error('CaseMainCtrl', response.data, response.status);
});

return deferred.promise;
Expand Down Expand Up @@ -189,7 +189,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router
templateUrl: 'views/partials/case/case.tasks.item.html',
controller: 'CaseTasksItemCtrl',
resolve: {
task: function($q, $stateParams, CaseTaskSrv, AlertSrv) {
task: function($q, $stateParams, CaseTaskSrv, NotificationSrv) {
var deferred = $q.defer();

CaseTaskSrv.get({
Expand All @@ -198,7 +198,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router
deferred.resolve(data);
}, function(response) {
deferred.reject(response);
AlertSrv.error('taskDetails', response.data, response.status);
NotificationSrv.error('taskDetails', response.data, response.status);
});

return deferred.promise;
Expand All @@ -223,11 +223,11 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ui.bootstrap', 'ui.router
}
}
})
.state('app.misp-list', {
url: 'misp/list',
templateUrl: 'views/partials/misp/list.html',
controller: 'MispListCtrl',
controllerAs: 'misp'
.state('app.alert-list', {
url: 'alert/list',
templateUrl: 'views/partials/alert/list.html',
controller: 'AlertListCtrl',
controllerAs: '$vm'
});
})
.config(function($httpProvider) {
Expand Down
4 changes: 2 additions & 2 deletions ui/app/scripts/controllers/AboutCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
'use strict';

angular.module('theHiveControllers').controller('AboutCtrl',
function($rootScope, $scope, $uibModalInstance, VersionSrv, AlertSrv) {
function($rootScope, $scope, $uibModalInstance, VersionSrv, NotificationSrv) {
VersionSrv.get().then(function(response) {
$scope.version = response.versions;
}, function(data, status) {
AlertSrv.error('AboutCtrl', data, status);
NotificationSrv.error('AboutCtrl', data, status);
});

$scope.close = function() {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/scripts/controllers/AuthenticationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(function() {
'use strict';
angular.module('theHiveControllers')
.controller('AuthenticationCtrl', function($scope, $state, $uibModalStack, AuthenticationSrv, AlertSrv) {
.controller('AuthenticationCtrl', function($scope, $state, $uibModalStack, AuthenticationSrv, NotificationSrv) {
$scope.params = {};

$uibModalStack.dismissAll();
Expand All @@ -15,9 +15,9 @@
$state.go('app.cases');
}, function(data, status) {
if (status === 520) {
AlertSrv.error('AuthenticationCtrl', data, status);
NotificationSrv.error('AuthenticationCtrl', data, status);
} else {
AlertSrv.log(data.message, 'error');
NotificationSrv.log(data.message, 'error');
}
});
};
Expand Down
4 changes: 2 additions & 2 deletions ui/app/scripts/controllers/MigrationCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers').controller('MigrationCtrl',
function($rootScope, $scope, $http, $state, $timeout, $window, AlertSrv, StreamSrv, UserSrv) {
function($rootScope, $scope, $http, $state, $timeout, $window, NotificationSrv, StreamSrv, UserSrv) {
$rootScope.title = 'Database migration';
$scope.migrationStatus = {};
$scope.showUserForm = false;
Expand Down Expand Up @@ -49,7 +49,7 @@
console.log('Migration started');
}).error(function(response) {
if (angular.isObject(response)) {
AlertSrv.error('UserMgmtCtrl', response.data, response.status);
NotificationSrv.error('UserMgmtCtrl', response.data, response.status);
} else {
console.log("Migration timeout");
}
Expand Down
21 changes: 11 additions & 10 deletions ui/app/scripts/controllers/RootCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Controller for main page
*/
angular.module('theHiveControllers').controller('RootCtrl',
function($scope, $rootScope, $uibModal, $location, $state, $base64, AuthenticationSrv, MispSrv, StreamSrv, StreamStatSrv, TemplateSrv, MetricsCacheSrv, AlertSrv, AppLayoutSrv, appConfig) {
function($scope, $rootScope, $uibModal, $location, $state, $base64, AuthenticationSrv, AlertingSrv, StreamSrv, StreamStatSrv, TemplateSrv, MetricsCacheSrv, NotificationSrv, AppLayoutSrv, appConfig) {
'use strict';

$rootScope.layoutSrv = AppLayoutSrv;
Expand Down Expand Up @@ -50,10 +50,10 @@ angular.module('theHiveControllers').controller('RootCtrl',
$scope.metricsCache = list;
});

// Get MISP counts
$scope.mispEvents = MispSrv.stats($scope);
// Get Alert counts
$scope.alertEvents = AlertingSrv.stats($scope);
}, function(data, status) {
AlertSrv.error('RootCtrl', data, status);
NotificationSrv.error('RootCtrl', data, status);
});

$scope.$on('templates:refresh', function(){
Expand All @@ -67,13 +67,14 @@ angular.module('theHiveControllers').controller('RootCtrl',
});
});

$scope.$on('misp:event-imported', function() {
$scope.mispEvents = MispSrv.stats($scope);
$scope.$on('alert:event-imported', function() {
$scope.alertEvents = AlertingSrv.stats($scope);
});

$scope.$on('misp:status-updated', function(event, enabled) {
$scope.mispEnabled = enabled;
});
// FIXME
// $scope.$on('misp:status-updated', function(event, enabled) {
// $scope.mispEnabled = enabled;
// });

$scope.isAdmin = function(user) {
var u = user;
Expand All @@ -92,7 +93,7 @@ angular.module('theHiveControllers').controller('RootCtrl',
AuthenticationSrv.logout(function() {
$state.go('login');
}, function(data, status) {
AlertSrv.error('RootCtrl', data, status);
NotificationSrv.error('RootCtrl', data, status);
});
};

Expand Down
2 changes: 1 addition & 1 deletion ui/app/scripts/controllers/SearchCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers')
.controller('SearchCtrl', function($scope, $stateParams, $base64, PSearchSrv, CaseTaskSrv, AlertSrv, EntitySrv, UserInfoSrv) {
.controller('SearchCtrl', function($scope, $stateParams, $base64, PSearchSrv, CaseTaskSrv, NotificationSrv, EntitySrv, UserInfoSrv) {
$scope.filter = {
type: {
values: [
Expand Down
10 changes: 5 additions & 5 deletions ui/app/scripts/controllers/SettingsCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers').controller('SettingsCtrl',
function($scope, $state, UserSrv, AlertSrv, resizeService, readLocalPicService, UserInfoSrv, appConfig) {
function($scope, $state, UserSrv, NotificationSrv, resizeService, readLocalPicService, UserInfoSrv, appConfig) {
$scope.appConfig = appConfig;

$scope.basicData = {
Expand Down Expand Up @@ -34,11 +34,11 @@

UserInfoSrv.update(data._id, data);

AlertSrv.log('Your basic information have been successfully updated', 'success');
NotificationSrv.log('Your basic information have been successfully updated', 'success');

$state.reload();
}, function(response) {
AlertSrv.error('SettingsCtrl', response.data, response.status);
NotificationSrv.error('SettingsCtrl', response.data, response.status);
});
};

Expand All @@ -57,10 +57,10 @@
UserSrv.changePass({
userId: $scope.currentUser.id
}, updatedFields, function( /*data*/ ) {
AlertSrv.log('Your password has been successfully updated', 'success');
NotificationSrv.log('Your password has been successfully updated', 'success');
$state.reload();
}, function(response) {
AlertSrv.error('SettingsCtrl', response.data, response.status);
NotificationSrv.error('SettingsCtrl', response.data, response.status);
});
} else {
$state.go('app.cases');
Expand Down
12 changes: 6 additions & 6 deletions ui/app/scripts/controllers/admin/AdminCaseTemplatesCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

angular.module('theHiveControllers').controller('AdminCaseTemplatesCtrl',
function($scope, $uibModal, TemplateSrv, AlertSrv, UtilsSrv, ListSrv, MetricsCacheSrv) {
function($scope, $uibModal, TemplateSrv, NotificationSrv, UtilsSrv, ListSrv, MetricsCacheSrv) {
$scope.task = '';
$scope.tags = [];
$scope.templates = [];
Expand Down Expand Up @@ -112,7 +112,7 @@
metrics.push(metric.name);
$scope.template.metricNames = metrics;
} else {
AlertSrv.log('The metric [' + metric.title + '] has already been added to the template', 'warning');
NotificationSrv.log('The metric [' + metric.title + '] has already been added to the template', 'warning');
}
};

Expand Down Expand Up @@ -145,9 +145,9 @@

$scope.$emit('templates:refresh');

AlertSrv.log('The template [' + $scope.template.name + '] has been successfuly created', 'success');
NotificationSrv.log('The template [' + $scope.template.name + '] has been successfuly created', 'success');
}, function(response) {
AlertSrv.error('TemplateCtrl', response.data, response.status);
NotificationSrv.error('TemplateCtrl', response.data, response.status);
});
};

Expand All @@ -160,9 +160,9 @@

$scope.$emit('templates:refresh');

AlertSrv.log('The template [' + $scope.template.name + '] has been successfuly updated', 'success');
NotificationSrv.log('The template [' + $scope.template.name + '] has been successfuly updated', 'success');
}, function(response) {
AlertSrv.error('TemplateCtrl', response.data, response.status);
NotificationSrv.error('TemplateCtrl', response.data, response.status);
});
};

Expand Down
6 changes: 3 additions & 3 deletions ui/app/scripts/controllers/admin/AdminMetricsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

angular.module('theHiveControllers').controller('AdminMetricsCtrl',
function($scope, ListSrv, MetricsCacheSrv, AlertSrv) {
function($scope, ListSrv, MetricsCacheSrv, NotificationSrv) {
$scope.metrics = [];

$scope.initMetrics = function() {
Expand All @@ -21,7 +21,7 @@
});

}, function(response) {
AlertSrv.error('AdminMetricsCtrl', response.data, response.status);
NotificationSrv.error('AdminMetricsCtrl', response.data, response.status);
});
};
$scope.initMetrics();
Expand All @@ -39,7 +39,7 @@
$scope.$emit('metrics:refresh');
},
function(response) {
AlertSrv.error('AdminMetricsCtrl', response.data, response.status);
NotificationSrv.error('AdminMetricsCtrl', response.data, response.status);
});
};
});
Expand Down
10 changes: 5 additions & 5 deletions ui/app/scripts/controllers/admin/AdminObservablesCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

angular.module('theHiveControllers').controller('AdminObservablesCtrl',
function($scope, ListSrv, AlertSrv) {
function($scope, ListSrv, NotificationSrv) {
$scope.dataTypeList = [];
$scope.params = {
newDataType: null
Expand All @@ -22,7 +22,7 @@
};
});
}, function(response) {
AlertSrv.error('AdminObservablesCtrl', response.data, response.status);
NotificationSrv.error('AdminObservablesCtrl', response.data, response.status);
});
};
$scope.load();
Expand All @@ -36,7 +36,7 @@
$scope.load();
},
function(response) {
AlertSrv.error('ListSrv', response.data, response.status);
NotificationSrv.error('ListSrv', response.data, response.status);
});

$scope.params.newDataType = '';
Expand All @@ -47,10 +47,10 @@
'listId': datatype.id
}, function(data) {
console.log(data);
AlertSrv.log('The datatype ' + datatype.value + ' has been removed', 'success');
NotificationSrv.log('The datatype ' + datatype.value + ' has been removed', 'success');
$scope.load();
}, function(response) {
AlertSrv.error('ListSrv', response.data, response.status);
NotificationSrv.error('ListSrv', response.data, response.status);
});
};
});
Expand Down
Loading

0 comments on commit b337888

Please sign in to comment.