diff --git a/frontend/app/scripts/components/alert/AlertSimilarCaseListCmp.js b/frontend/app/scripts/components/alert/AlertSimilarCaseListCmp.js index c557b16bca..e45c5db953 100644 --- a/frontend/app/scripts/components/alert/AlertSimilarCaseListCmp.js +++ b/frontend/app/scripts/components/alert/AlertSimilarCaseListCmp.js @@ -1,9 +1,9 @@ -(function() { +(function () { 'use strict'; angular.module('theHiveComponents') .component('alertSimilarCaseList', { - controller: function($scope, AlertingSrv, FilteringSrv, PaginatedQuerySrv, CaseResolutionStatus, UiSettingsSrv) { + controller: function ($scope, AlertingSrv, FilteringSrv, PaginatedQuerySrv, CaseResolutionStatus, UiSettingsSrv) { var self = this; self.CaseResolutionStatus = CaseResolutionStatus; @@ -35,7 +35,7 @@ defaultAlertSimilarCaseFilter: UiSettingsSrv.defaultAlertSimilarCaseFilter() }; - self.$onInit = function() { + self.$onInit = function () { this.filtering = new FilteringSrv('case', 'alert.dialog.similar-cases', { version: 'v1', defaults: { @@ -48,11 +48,11 @@ }); self.filtering.initContext('alert.dialog.similar-cases') - .then(function() { + .then(function () { var defaultFilter = AlertingSrv.getSimilarityFilter(self.state.defaultAlertSimilarCaseFilter); - if(_.isEmpty(self.filtering.context.filters) && defaultFilter && defaultFilter.length > 0) { - _.each(defaultFilter, function(item) { + if (_.isEmpty(self.filtering.context.filters) && defaultFilter && defaultFilter.length > 0) { + _.each(defaultFilter, function (item) { self.filtering.addFilter(item); }); } @@ -64,12 +64,12 @@ }); $scope.$watch('$cmp.list.total', function (total) { - self.onListLoad({count: total}); + self.onListLoad({ count: total }); }); }); }; - this.load = function() { + this.load = function () { this.list = new PaginatedQuerySrv({ name: 'alert-similar-cases', skipStream: true, @@ -77,11 +77,11 @@ loadAll: true, //pageSize: self.filtering.context.pageSize, operations: [ - {'_name': 'getAlert', 'idOrName': this.alertId}, - {'_name': 'similarCases', 'caseFilter': this.filtering.buildQuery()} + { '_name': 'getAlert', 'idOrName': this.alertId }, + { '_name': 'similarCases', 'caseFilter': this.filtering.buildQuery() } ], - onUpdate: function(data) { - _.each(data, function(item) { + onUpdate: function (data) { + _.each(data, function (item) { item.fTitle = item.case.title; item.fMatches = _.keys(item.observableTypes); item.fObservables = Math.floor((item.similarObservableCount / item.observableCount) * 100); @@ -90,21 +90,21 @@ item.sCreatedAt = item.case._createdAt; }); - self.matches = _.uniq(_.flatten(_.map(data, function(item){ + self.matches = _.uniq(_.flatten(_.map(data, function (item) { return _.keys(item.observableTypes); }))).sort(); } }); }; - self.merge = function(caseId) { + self.merge = function (caseId) { this.onMergeIntoCase({ caseId: caseId }); }; // Frontend filter methods - this.clearLocalFilters = function() { + this.clearLocalFilters = function () { self.similarityFilters = { fTitle: undefined }; @@ -119,14 +119,14 @@ }; }; - this.greaterThan = function(prop){ - return function(item){ + this.greaterThan = function (prop) { + return function (item) { return !self.rateFilters[prop] || item[prop] >= self.rateFilters[prop]; }; }; - this.matchFilter = function() { - return function(item){ + this.matchFilter = function () { + return function (item) { return !self.matchFilters.fMatches || self.matchFilters.fMatches.length === 0 || _.intersection(self.matchFilters.fMatches, item.fMatches).length > 0; }; @@ -159,20 +159,20 @@ .then(self.search); }; - this.filterBy = function(field, value) { + this.filterBy = function (field, value) { self.filtering.clearFilters() - .then(function(){ + .then(function () { self.addFilterValue(field, value); }); }; - this.applyDefaultFilter = function() { + this.applyDefaultFilter = function () { self.filtering.clearFilters() - .then(function(){ + .then(function () { var defaultFilter = AlertingSrv.getSimilarityFilter(self.state.defaultAlertSimilarCaseFilter); - if(defaultFilter && defaultFilter.length > 0) { - _.each(defaultFilter, function(item) { + if (defaultFilter && defaultFilter.length > 0) { + _.each(defaultFilter, function (item) { self.filtering.addFilter(item); }); @@ -181,17 +181,17 @@ }); }; - this.filterSimilarities = function(data) { + this.filterSimilarities = function (data) { return data; }; - this.sortByField = function(field) { + this.sortByField = function (field) { var sort = null; - if(this.sortField.substr(1) !== field) { + if (this.sortField.substr(1) !== field) { sort = '+' + field; } else { - sort = (this.sortField === '+' + field) ? '-'+field : '+'+field; + sort = (this.sortField === '+' + field) ? '-' + field : '+' + field; } this.sortField = sort; @@ -203,6 +203,7 @@ templateUrl: 'views/components/alert/similar-case-list.component.html', bindings: { alertId: '<', + readonly: '<', onListLoad: '&', onMergeIntoCase: '&' } diff --git a/frontend/app/scripts/controllers/alert/AlertListCtrl.js b/frontend/app/scripts/controllers/alert/AlertListCtrl.js index 39480f529b..6d377eadde 100755 --- a/frontend/app/scripts/controllers/alert/AlertListCtrl.js +++ b/frontend/app/scripts/controllers/alert/AlertListCtrl.js @@ -185,7 +185,7 @@ }); }; - self.import = function (event) { + self.import = function (event, readonly) { var modalInstance = $uibModal.open({ templateUrl: 'views/partials/alert/event.dialog.html', controller: 'AlertEventCtrl', @@ -198,7 +198,7 @@ templates: function () { return CaseTemplateSrv.list(); }, - readonly: false + readonly: readonly } }); diff --git a/frontend/app/scripts/services/api/AlertingSrv.js b/frontend/app/scripts/services/api/AlertingSrv.js index ed28e2662f..bee21da350 100644 --- a/frontend/app/scripts/services/api/AlertingSrv.js +++ b/frontend/app/scripts/services/api/AlertingSrv.js @@ -145,7 +145,7 @@ operations: [ { '_name': 'listAlert' } ], - extraData: ['importDate'] + extraData: ['importDate', 'caseNumber'] }); }, diff --git a/frontend/app/views/components/alert/similar-case-list.component.html b/frontend/app/views/components/alert/similar-case-list.component.html index 7a28cb291e..2762a1cb63 100644 --- a/frontend/app/views/components/alert/similar-case-list.component.html +++ b/frontend/app/views/components/alert/similar-case-list.component.html @@ -2,13 +2,13 @@
-
+
-
@@ -22,9 +22,8 @@
-
@@ -33,7 +32,8 @@
Title - + @@ -41,7 +41,8 @@
Created At - + @@ -49,7 +50,8 @@
Observables - + @@ -70,61 +72,79 @@
- - + +
- - + +
- - + +
- +
-
-
+
+
-
+
- None - + None +
- (Closed at {{item.case.endDate | shortDate}} as {{$cmp.CaseResolutionStatus[item.case.resolutionStatus]}}) + (Closed at {{item.case.endDate | shortDate}} as + {{$cmp.CaseResolutionStatus[item.case.resolutionStatus]}})
@@ -137,20 +157,26 @@
- {{item.fObservables | number:0}} % ({{item.similarObservableCount}} / {{item.observableCount}}) - + {{item.fObservables + | number:0}} % ({{item.similarObservableCount}} / + {{item.observableCount}}) +
- {{item.fIocs | number:0}} % ({{item.similarIocCount}} / {{item.iocCount}}) - + {{item.fIocs | number:0}} + % ({{item.similarIocCount}} / {{item.iocCount}}) +
N/A @@ -158,12 +184,15 @@
-
{{match}} ({{count}})
+
{{match}} + ({{count}})
- +
diff --git a/frontend/app/views/partials/alert/event.dialog.html b/frontend/app/views/partials/alert/event.dialog.html index 9ab978f49f..c9e593c535 100644 --- a/frontend/app/views/partials/alert/event.dialog.html +++ b/frontend/app/views/partials/alert/event.dialog.html @@ -125,7 +125,7 @@

-
diff --git a/frontend/app/views/partials/alert/list.html b/frontend/app/views/partials/alert/list.html index 36eaacb50d..f878ea300f 100644 --- a/frontend/app/views/partials/alert/list.html +++ b/frontend/app/views/partials/alert/list.html @@ -40,17 +40,34 @@

- - - Reference - + + Severity + - - + + + Read + + + + + + + Title + + + # Case + Type @@ -62,15 +79,7 @@

class="fa fa-caret-down"> - - Imported - - - Read - - - Title - + Source @@ -82,17 +91,18 @@

class="fa fa-caret-down"> - - - Severity - + + Reference + - - + Observables @@ -139,32 +149,16 @@

- - - {{::event.sourceRef}} - - - - - - - - - - {{::event.type}} - - - {{event.caseId - ? - 'Imported' : 'New'}} + +
+ +
{{event.read ? 'Read' : 'Unread'}} @@ -180,14 +174,39 @@

- +
+ None +
+
+ + + + + {{::event.type}} + + + + {{event.source}} - -
- -
+ + + {{::event.sourceRef}} + + + + + + + + {{::event.observableCount || 0}} @@ -238,15 +257,19 @@

- - + + +