Skip to content

Commit

Permalink
#127 Update the observable details page to display mini reports based…
Browse files Browse the repository at this point in the history
… on the the observable summary
  • Loading branch information
nadouani committed Mar 1, 2017
1 parent f61ad6a commit 1db057e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
24 changes: 22 additions & 2 deletions ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

};

$scope.onJobsChange = function () {
$scope.onJobsChange = function (updates) {
$scope.analyzerJobs = {};

angular.forEach($scope.analyzers, function (analyzer, analyzerId) {
Expand All @@ -99,6 +99,26 @@
*/
}
});

// Check it a job completed successfully and update the observableId
if(updates && updates.length > 0) {

var statuses = _.pluck(_.map(updates, function(item) {
return item.base.details;
}), 'status');

console.log(statuses);
if(statuses.indexOf('Success') > -1) {
CaseArtifactSrv.api().get({
'artifactId': observableId
}, function (observable) {
$scope.artifact = observable;
}, function (response) {
AlertSrv.error('artifactDetails', response.data, response.status);
CaseTabsSrv.activateTab('observables');
});
}
}
};

$scope.showReport = function (jobId) {
Expand All @@ -113,7 +133,7 @@
startDate: job.startDate,
endDate: job.endDate
};
}, function(err) {
}, function(/*err*/) {
AlertSrv.log('An expected error occured while fetching the job report');
});
};
Expand Down
8 changes: 4 additions & 4 deletions ui/app/scripts/services/PSearchSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';
angular.module('theHiveServices')
.factory('PSearchSrv', function(SearchSrv, StreamSrv) {
function update(objectType, control) {
function update(objectType, control, updates) {
var range = '';
if (control.loadAll) {
range = 'all';
Expand Down Expand Up @@ -38,7 +38,7 @@
control.values.push(d);
});
if (angular.isFunction(control.onUpdate)) {
control.onUpdate();
control.onUpdate(updates);
}
}
control.total = total;
Expand Down Expand Up @@ -93,8 +93,8 @@
}

if (control.skipStream !== true) {
StreamSrv.listen(root, control.streamObjectType || objectType, function() {
update(objectType, control);
StreamSrv.listen(root, control.streamObjectType || objectType, function(updates) {
update(objectType, control, updates);
});
}

Expand Down
8 changes: 3 additions & 5 deletions ui/app/views/partials/case/case.observables.item.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ <h4>
</div>
<!-- Observable analysers short reports -->
<div class="col-md-11 col-md-offset-1">
<report ng-if="jobs[0]"
ng-repeat="(analyzerId, jobs) in analyzerJobs"
<report ng-repeat="(analyzerId, summary) in artifact.reports"
artifact="artifact"
content="jobs[0].report.summary"
content="summary"
report-type="short"
name="analyzerId"
status="jobs[0].status"
success="jobs[0].success"
success="true"
class="short-report"></report>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion ui/app/views/reports/short.html
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Default Short Tpl

0 comments on commit 1db057e

Please sign in to comment.