Skip to content

Commit 36d0297

Browse files
committed
#86 Add filtering capabilities to MISP events' list
1 parent fe71d1a commit 36d0297

File tree

4 files changed

+39
-10
lines changed

4 files changed

+39
-10
lines changed

ui/app/scripts/controllers/misp/MispListCtrl.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
self.menu = {
1010
follow: false,
1111
unfollow: false,
12+
markAsRead: false,
1213
selectAll: false
1314
};
1415
self.filtering = new FilteringSrv('misp-section', {
@@ -218,6 +219,11 @@
218219

219220
self.menu.unfollow = temp.length === 1 && temp[0] === true;
220221
self.menu.follow = temp.length === 1 && temp[0] === false;
222+
223+
224+
temp = _.uniq(_.pluck(self.selection, 'eventStatus'));
225+
226+
self.menu.markAsRead = temp.indexOf('Ignore') === -1;
221227
};
222228

223229
self.select = function(event) {
@@ -325,14 +331,21 @@
325331
this.filter();
326332
};
327333

334+
this.filterByStatus = function(status) {
335+
self.filtering.clearFilters()
336+
.then(function(){
337+
self.addFilterValue('eventStatus', status);
338+
});
339+
};
340+
328341
this.sortBy = function(sort) {
329342
self.list.sort = sort;
330343
self.list.update();
331344
self.filtering.setSort(sort);
332345
};
333346

334347
this.getStatuses = function(query) {
335-
return MispSrv.statuses(query);
348+
return MispSrv.statuses(query);
336349
};
337350

338351
this.getSources = function(query) {

ui/app/views/partials/misp/list.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ <h4>List of MISP events ({{misp.list.total || 0}} of {{mispEvents.count}})</h4>
120120
<td class="text-center">{{::event.attributeCount}}</td>
121121
<td><a href ng-click="misp.addFilterValue('publishDate', event.publishDate)">{{event.publishDate | showDate}}</a></td>
122122
<td class="clearfix">
123-
<div class="pull-right">
123+
<div class="pull-left">
124124
<a class="btn btn-xs btn-icon btn-clear" href ng-click="misp.import(event)" uib-tooltip="Preview and Import" ng-if="!event.case">
125125
<i class="text-info text-20 fa fa-file-text-o"></i>
126126
</a>
@@ -130,7 +130,7 @@ <h4>List of MISP events ({{misp.list.total || 0}} of {{mispEvents.count}})</h4>
130130
<a class="btn btn-xs btn-icon btn-clear" href ng-click="misp.follow(event)" uib-tooltip="{{event.follow ? 'Ignore new updates' : 'Track new updates'}}">
131131
<i class="text-info text-20 fa" ng-class="{'fa-eye': event.follow, 'fa-eye-slash': !event.follow}"></i>
132132
</a>
133-
<a class="btn btn-xs btn-icon btn-clear" href ng-click="misp.ignore(event)" uib-tooltip="Mark as read">
133+
<a class="btn btn-xs btn-icon btn-clear" href ng-click="misp.ignore(event)" uib-tooltip="Mark as unread" ng-if="event.eventStatus !== 'Ignore' && !event.case">
134134
<i class="text-info text-20 fa fa-check"></i>
135135
</a>
136136
</div>

ui/app/views/partials/misp/list/toolbar.html

+22-6
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,30 @@
1313
<a ng-click="misp.bulkImport()">Import</a>
1414
</li>
1515
-->
16-
<li ng-show="misp.menu.follow" ng-click="misp.bulkFollow(true)">
17-
<a>Track new updates</a>
16+
<li ng-show="misp.menu.follow">
17+
<a href ng-click="misp.bulkFollow(true)">Track new updates</a>
1818
</li>
19-
<li ng-show="misp.menu.unfollow" ng-click="misp.bulkFollow(false)">
20-
<a>Ignore new updates</a>
19+
<li ng-show="misp.menu.unfollow">
20+
<a href ng-click="misp.bulkFollow(false)">Ignore new updates</a>
2121
</li>
22-
<li class="text-danger">
23-
<a ng-click="misp.bulkIgnore()">Mark as read</a>
22+
<li ng-show="misp.menu.markAsRead">
23+
<a href ng-click="misp.bulkIgnore()">Mark as read</a>
24+
</li>
25+
</ul>
26+
</div>
27+
28+
<div class="btn-group" uib-dropdown>
29+
<button class="btn btn-primary dropdown-toggle" uib-dropdown-toggle type="button">
30+
<i class="fa fa-filter"></i>
31+
Quick Filters
32+
<span class="caret"></span>
33+
</button>
34+
<ul class="dropdown-menu" uib-dropdown-menu>
35+
<li>
36+
<a ng-click="misp.filterByStatus('New')">New events ({{mispEvents.New.count || 0}})</a>
37+
</li>
38+
<li>
39+
<a ng-click="misp.filterByStatus('Update')">Updated events({{mispEvents.Update.count || 0}})</a>
2440
</li>
2541
</ul>
2642
</div>

ui/bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"bootstrap": "~3.3.7",
2020
"bootstrap-sass-official": "~3.3.7",
2121
"dropzone": "~4.3.0",
22-
"font-awesome": "fontawesome#~4.4.0",
22+
"font-awesome": "fontawesome#^4.7.0",
2323
"jquery": "~3.1.0",
2424
"moment": "~2.14.1",
2525
"ng-csv": "~0.3.6",

0 commit comments

Comments
 (0)