Skip to content

Commit

Permalink
#166 Add render function to TLP filter in case list page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Apr 7, 2017
1 parent 9631f52 commit 6775270
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
6 changes: 5 additions & 1 deletion ui/app/scripts/controllers/case/CaseListCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
angular.module('theHiveControllers')
.controller('CaseListCtrl', CaseListCtrl);

function CaseListCtrl($scope, $q, $state, $window, CasesUISrv, StreamStatSrv, PSearchSrv, EntitySrv, UserInfoSrv, TagSrv, UserSrv, AuthenticationSrv, CaseResolutionStatus, Severity) {
function CaseListCtrl($scope, $q, $state, $window, CasesUISrv, StreamStatSrv, PSearchSrv, EntitySrv, UserInfoSrv, TagSrv, UserSrv, AuthenticationSrv, CaseResolutionStatus, Severity, Tlp) {
var self = this;

this.showFlow = true;
Expand Down Expand Up @@ -205,6 +205,10 @@
self.addFilterValue('severity', Severity.values[numericSev]);
};

this.filterByTlp = function(value) {
self.addFilterValue('tlp', Tlp.values[value]);
};

this.sortBy = function(sort) {
this.list.sort = sort;
this.list.update();
Expand Down
8 changes: 6 additions & 2 deletions ui/app/scripts/services/CasesUISrv.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveServices')
.factory('CasesUISrv', function($q, localStorageService, Severity) {
.factory('CasesUISrv', function($q, localStorageService, Severity, Tlp) {
var defaultFilter = {
status: {
field: 'status',
Expand Down Expand Up @@ -56,7 +56,11 @@
tlp: {
field: 'tlp',
type: 'number',
defaultValue: null
defaultValue: null,
convert: function(value) {
// Convert the text value to its numeric representation
return Tlp.keys[value];
}
},
title: {
field: 'title',
Expand Down
11 changes: 7 additions & 4 deletions ui/app/scripts/services/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
values: ['Unknown', 'Low', 'Medium', 'High']
})
.value('Tlp', {
RED: 3,
AMBER: 2,
GREEN: 1,
WHITE: 1
keys: {
Red: 3,
Amber: 2,
Green: 1,
White: 0
},
values: ['White', 'Green', 'Amber', 'Red']
});
})();
3 changes: 3 additions & 0 deletions ui/app/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ pre.clearpre {
border-color: #a94442;
}

.label {
font-weight: normal !important;
}
.label.label-lg {
font-size: 100% !important;
font-weight: normal !important;
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/case/case.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h3 class="box-title">List of cases ({{$vm.list.total || 0}} of {{$vm.caseStats.
<tbody>
<tr ng-class="{true:'tr-warning'}[currentCase.flag]" ng-repeat="currentCase in $vm.list.values">

<td class="p-0 bg-tlp-{{currentCase.tlp}} clickable" ng-click="$vm.addFilterValue('tlp', currentCase.tlp)"></td>
<td class="p-0 bg-tlp-{{currentCase.tlp}} clickable" ng-click="$vm.filterByTlp(currentCase.tlp)"></td>
<td>
<div class="case-title">
<a ui-sref="app.case.details({caseId: currentCase.id})">#{{currentCase.caseId}} - {{currentCase.title}}</a>
Expand Down

0 comments on commit 6775270

Please sign in to comment.