Skip to content

Commit

Permalink
#1293 Display responder action error messages when an job fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Apr 29, 2020
1 parent 0ac9feb commit 2b41bd1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
8 changes: 7 additions & 1 deletion frontend/app/scripts/directives/responder-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
actions: '=',
header: '@'
},
templateUrl: 'views/directives/responder-actions.html',
templateUrl: 'views/directives/responder-actions.html',
controller: function($scope, $uibModal) {
_.each($scope.actions.values, function(action) {
if (action.status === 'Failure') {
action.errorMessage = (JSON.parse(action.report) || {}).errorMessage;
}
});

$scope.showResponderJob = function(action) {
$uibModal.open({
scope: $scope,
Expand Down
10 changes: 10 additions & 0 deletions frontend/app/styles/case.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,13 @@ table.case-list .case-tags .label,
font-size: 12px !important;
font-weight: normal;
}

pre.error-trace {
color: #a94442;
border: none;
font-size: 10px;
word-wrap: break-word;
word-break: break-all;
white-space: pre-wrap;
background-color: #f9f1f1;
}
6 changes: 3 additions & 3 deletions frontend/app/styles/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ dashboard-item .box {

.dashboard-period > div{
height: 34px;
display:flex;
justify-content:flex-start;
align-items:stretch;
display: flex;
justify-content: flex-start;
align-items: stretch;
}

.dashboard-period .label{
Expand Down
11 changes: 9 additions & 2 deletions frontend/app/views/directives/responder-actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ <h4 class="text-primary">{{header}}</h4>
<tbody>
<tr ng-repeat="action in actions.values">
<td class="text-center">
<span class="label label-default" ng-class="{
<span class="label label-default" ng-class="{
'Success': 'label-success',
'InProgress': 'label-warning',
'Failure': 'label-danger'}[action.status]">{{action.status}}</span>
</td>
<td>{{action.responderName}}</td>
<td>
<div>{{action.responderName}}</div>
<div ng-if="action.status === 'Failure'" class="text-danger wrap mt-xxs">
<a class="text-danger" href ng-click="action.showError = !!!action.showError">{{action.showError ? 'Hide' : 'Show'}} error</a>
<pre ng-show="action.showError" class="error-trace">{{action.errorMessage}}</pre>
</div>
</td>
<td>{{action.cortexId}}</td>
<td>{{action.startDate | shortDate}}</td>
<td class="text-center">
<a href class="noline" ng-click="showResponderJob(action)"><i class="fa fa-search"></i></a>
<a href class="noline" ng-click="showResponderJob(action)" ng-if="action.status !== 'Failure'" uib-tooltip="Show action report" tooltip-placement="left-middle"><i class="fa fa-search"></i></a>
</td>
</tr>
</tbody>
Expand Down

0 comments on commit 2b41bd1

Please sign in to comment.