Skip to content

Commit

Permalink
#58 Refresh the misp events count when an event is imported
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Dec 12, 2016
1 parent d8842b9 commit c41bed2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ui/app/scripts/controllers/RootCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ angular.module('theHiveControllers').controller('RootCtrl',
});
});

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

$scope.$on('misp:status-updated', function(event, enabled) {
$scope.mispEnabled = enabled;
});
Expand Down
4 changes: 3 additions & 1 deletion ui/app/scripts/controllers/misp/MispBulkImportCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers')
.controller('MispBulkImportCtrl', function($q, $modalInstance, MispSrv, AlertSrv, events) {
.controller('MispBulkImportCtrl', function($rootScope, $q, $modalInstance, MispSrv, AlertSrv, events) {
var self = this;
self.events = events;
self.disableButtons = false;
Expand All @@ -18,6 +18,8 @@
$q.all(promises).then(function(response) {
AlertSrv.log('The selected events have been imported', 'success');

$rootScope.$broadcast('misp:event-imported');

$modalInstance.close(_.pluck(response, 'data'));
}, function(response) {
self.disableButtons = false;
Expand Down
5 changes: 4 additions & 1 deletion ui/app/scripts/controllers/misp/MispEventCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers')
.controller('MispEventCtrl', function($state, $modalInstance, MispSrv, AlertSrv, event) {
.controller('MispEventCtrl', function($rootScope, $state, $modalInstance, MispSrv, AlertSrv, event) {
var self = this;
var eventId = event.id;

Expand Down Expand Up @@ -42,6 +42,9 @@
self.loading = true;
MispSrv.create(self.event.id).then(function(response) {
$modalInstance.dismiss();

$rootScope.$broadcast('misp:event-imported');

$state.go('app.case.details', {
caseId: response.data.id
});
Expand Down

0 comments on commit c41bed2

Please sign in to comment.