Skip to content

Commit

Permalink
#369 Add support to case template import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Nov 16, 2017
1 parent 15a5541 commit c1e514b
Show file tree
Hide file tree
Showing 14 changed files with 315 additions and 213 deletions.
2 changes: 1 addition & 1 deletion ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
<script src="scripts/services/CaseSrv.js"></script>
<script src="scripts/services/CaseTabsSrv.js"></script>
<script src="scripts/services/CaseTaskSrv.js"></script>
<script src="scripts/services/CaseTemplate.js"></script>
<script src="scripts/services/CasesUISrv.js"></script>
<script src="scripts/services/ChartSrv.js"></script>
<script src="scripts/services/Constants.js"></script>
Expand Down Expand Up @@ -262,7 +263,6 @@
<script src="scripts/services/StreamStatSrv.js"></script>
<script src="scripts/services/TagSrv.js"></script>
<script src="scripts/services/TaskLogSrv.js"></script>
<script src="scripts/services/TemplateSrv.js"></script>
<script src="scripts/services/UserInfoSrv.js"></script>
<script src="scripts/services/UserSrv.js"></script>
<script src="scripts/services/UtilsSrv.js"></script>
Expand Down
8 changes: 7 additions & 1 deletion ui/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ngSanitize', 'ui.bootstra
url: '/case-templates',
templateUrl: 'views/partials/admin/case-templates.html',
controller: 'AdminCaseTemplatesCtrl',
title: 'Templates administration'
controllerAs: '$vm',
title: 'Templates administration',
resolve: {
templates: function(CaseTemplateSrv) {
return CaseTemplateSrv.list();
}
}
})
.state('app.administration.report-templates', {
url: '/report-templates',
Expand Down
12 changes: 8 additions & 4 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, AuthenticationSrv, AlertingSrv, StreamSrv, StreamStatSrv, TemplateSrv, CustomFieldsCacheSrv, MetricsCacheSrv, NotificationSrv, AppLayoutSrv, currentUser, appConfig) {
function($scope, $rootScope, $uibModal, $location, $state, AuthenticationSrv, AlertingSrv, StreamSrv, StreamStatSrv, CaseTemplateSrv, CustomFieldsCacheSrv, MetricsCacheSrv, NotificationSrv, AppLayoutSrv, currentUser, appConfig) {
'use strict';

if(currentUser === 520) {
Expand All @@ -26,7 +26,9 @@ angular.module('theHiveControllers').controller('RootCtrl',
StreamSrv.init();
$scope.currentUser = currentUser;

$scope.templates = TemplateSrv.query();
CaseTemplateSrv.list().then(function(templates) {
$scope.templates = templates;
});

$scope.myCurrentTasks = StreamStatSrv({
scope: $scope,
Expand Down Expand Up @@ -62,8 +64,10 @@ angular.module('theHiveControllers').controller('RootCtrl',
// Get Alert counts
$scope.alertEvents = AlertingSrv.stats($scope);

$scope.$on('templates:refresh', function(){
$scope.templates = TemplateSrv.query();
$scope.$on('templates:refresh', function(){
CaseTemplateSrv.list().then(function(templates) {
$scope.templates = templates;
});
});

$scope.$on('metrics:refresh', function() {
Expand Down
Loading

0 comments on commit c1e514b

Please sign in to comment.