diff --git a/frontend/app/scripts/controllers/case/procedure/AddProcedureModalCtrl.js b/frontend/app/scripts/controllers/case/procedure/AddProcedureModalCtrl.js index a0eb17c6a4..3f2ae4a0cb 100644 --- a/frontend/app/scripts/controllers/case/procedure/AddProcedureModalCtrl.js +++ b/frontend/app/scripts/controllers/case/procedure/AddProcedureModalCtrl.js @@ -1,77 +1,77 @@ /** * Controller for About TheHive modal page */ -(function() { +(function () { 'use strict'; - angular.module('theHiveControllers').controller('AddProcedureModalCtrl', function($rootScope, $scope, $uibModalInstance, NotificationSrv, ProcedureSrv, AttackPatternSrv, caseId) { - var self = this; + angular.module('theHiveControllers').controller('AddProcedureModalCtrl', function ($rootScope, $scope, $uibModalInstance, NotificationSrv, ProcedureSrv, AttackPatternSrv, caseId) { + var self = this; - this.caseId = caseId; + this.caseId = caseId; - this.close = function() { - $uibModalInstance.close(); - }; - - this.cancel = function() { - if($rootScope.markdownEditorObjects.procedure) { - $rootScope.markdownEditorObjects.procedure.hidePreview(); - } + this.close = function () { + $uibModalInstance.close(); + }; - $uibModalInstance.dismiss(); - }; + this.cancel = function () { + if ($rootScope.markdownEditorObjects && $rootScope.markdownEditorObjects.procedure) { + $rootScope.markdownEditorObjects.procedure.hidePreview(); + } - this.addProcedure = function() { - self.state.loading = true; + $uibModalInstance.dismiss(); + }; - ProcedureSrv.create({ - caseId: self.caseId, - tactic: self.procedure.tactic, - description: self.procedure.description, - patternId: self.procedure.patternId, - occurDate: self.procedure.occurDate - }).then(function(/*response*/) { - self.state.loading = false; - $uibModalInstance.close(); - NotificationSrv.log('Tactic, Technique and Procedure added successfully', 'success'); - }).catch(function(err) { - NotificationSrv.error('Add TTP', err.data, err.status); - self.state.loading = false; - }); - }; + this.addProcedure = function () { + self.state.loading = true; - this.showTechniques = function() { - AttackPatternSrv.getByTactic(self.procedure.tactic) - .then(function(techniques) { - self.state.techniques = techniques; + ProcedureSrv.create({ + caseId: self.caseId, + tactic: self.procedure.tactic, + description: self.procedure.description, + patternId: self.procedure.patternId, + occurDate: self.procedure.occurDate + }).then(function (/*response*/) { + self.state.loading = false; + $uibModalInstance.close(); + NotificationSrv.log('Tactic, Technique and Procedure added successfully', 'success'); + }).catch(function (err) { + NotificationSrv.error('Add TTP', err.data, err.status); + self.state.loading = false; + }); + }; - self.procedure.patternId = null; - }); - }; + this.showTechniques = function () { + AttackPatternSrv.getByTactic(self.procedure.tactic) + .then(function (techniques) { + self.state.techniques = techniques; - this.$onInit = function() { - this.markdownEditorOptions = { - iconlibrary: 'fa', - addExtraButtons: true, - resize: 'vertical' - }; + self.procedure.patternId = null; + }); + }; - this.procedure = { - tactic: null, - description: null, - patternId: null - }; + this.$onInit = function () { + this.markdownEditorOptions = { + iconlibrary: 'fa', + addExtraButtons: true, + resize: 'vertical' + }; - this.tactics = AttackPatternSrv.tactics; + this.procedure = { + tactic: null, + description: null, + patternId: null + }; - this.state = { - loading: false, - selectedTactic: null, - techniques: null - }; + this.tactics = AttackPatternSrv.tactics; - $scope.$broadcast('beforeProcedureModalShow'); + this.state = { + loading: false, + selectedTactic: null, + techniques: null }; - } + + $scope.$broadcast('beforeProcedureModalShow'); + }; + } ); })(); diff --git a/frontend/app/views/partials/case/procedures/add-procedure.modal.html b/frontend/app/views/partials/case/procedures/add-procedure.modal.html index 8aef297d59..a3eedacee0 100644 --- a/frontend/app/views/partials/case/procedures/add-procedure.modal.html +++ b/frontend/app/views/partials/case/procedures/add-procedure.modal.html @@ -1,4 +1,4 @@ -