Skip to content

Commit

Permalink
#1733 Add an alert-duration compnent to display the time took to impo…
Browse files Browse the repository at this point in the history
…rt or merge and alert into a case.
  • Loading branch information
nadouani committed Jan 11, 2021
1 parent 90bc190 commit 4283406
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
<script src="scripts/controllers/SearchCtrl.js"></script>
<script src="scripts/controllers/SettingsCtrl.js"></script>
<script src="scripts/directives/affixer.js"></script>
<script src="scripts/directives/alert-duration.js"></script>
<script src="scripts/directives/auto-focus.js"></script>
<script src="scripts/directives/case-duration.js"></script>
<script src="scripts/directives/charts/c3Chart.js"></script>
Expand Down
15 changes: 15 additions & 0 deletions frontend/app/scripts/directives/alert-duration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function() {
'use strict';
angular.module('theHiveDirectives').directive('alertDuration', function() {
return {
restrict: 'E',
scope: {
start: '=',
end: '=',
icon: '@',
indicator: '='
},
templateUrl: 'views/directives/alert-duration.html'
};
});
})();
3 changes: 2 additions & 1 deletion frontend/app/scripts/services/api/AlertingSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@
onUpdate: callback || undefined,
operations: [
{'_name': 'listAlert'}
]
],
extraData: ['importDate']
});
},

Expand Down
8 changes: 8 additions & 0 deletions frontend/app/views/directives/alert-duration.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<span>
<strong ng-if="end" class="text-success" uib-tooltip="Imported after">
<i class="fa" ng-class="icon"></i> {{indicator ? 'During ' : ''}}{{start | duration:end}}
</strong>
<strong ng-if="!end" class="text-danger" uib-tooltip="Created since">
<i class="fa" ng-class="icon"></i> {{start | duration}} {{indicator ? 'ago' : ''}}
</strong>
</span>
3 changes: 3 additions & 0 deletions frontend/app/views/partials/alert/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ <h3 class="box-title">List of alerts ({{$vm.list.total || 0}} of {{$vm.alertList
<td class="text-center">{{::event.observableCount || 0}}</td>
<td>
<a href ng-click="$vm.addFilterValue('date', event.date)">{{event.date | shortDate}}</a>
<div ng-if="!!event.caseId">
<alert-duration start="event._createdAt" end="event.extraData.importDate" icon="fa-clock-o"></alert-duration>
</div>
</td>
<td class="clearfix">
<div class="pull-right" if-permission="manageAlert">
Expand Down

0 comments on commit 4283406

Please sign in to comment.