Skip to content

Commit 1db057e

Browse files
committed
#127 Update the observable details page to display mini reports based on the the observable summary
1 parent f61ad6a commit 1db057e

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
};
7777

78-
$scope.onJobsChange = function () {
78+
$scope.onJobsChange = function (updates) {
7979
$scope.analyzerJobs = {};
8080

8181
angular.forEach($scope.analyzers, function (analyzer, analyzerId) {
@@ -99,6 +99,26 @@
9999
*/
100100
}
101101
});
102+
103+
// Check it a job completed successfully and update the observableId
104+
if(updates && updates.length > 0) {
105+
106+
var statuses = _.pluck(_.map(updates, function(item) {
107+
return item.base.details;
108+
}), 'status');
109+
110+
console.log(statuses);
111+
if(statuses.indexOf('Success') > -1) {
112+
CaseArtifactSrv.api().get({
113+
'artifactId': observableId
114+
}, function (observable) {
115+
$scope.artifact = observable;
116+
}, function (response) {
117+
AlertSrv.error('artifactDetails', response.data, response.status);
118+
CaseTabsSrv.activateTab('observables');
119+
});
120+
}
121+
}
102122
};
103123

104124
$scope.showReport = function (jobId) {
@@ -113,7 +133,7 @@
113133
startDate: job.startDate,
114134
endDate: job.endDate
115135
};
116-
}, function(err) {
136+
}, function(/*err*/) {
117137
AlertSrv.log('An expected error occured while fetching the job report');
118138
});
119139
};

ui/app/scripts/services/PSearchSrv.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33
angular.module('theHiveServices')
44
.factory('PSearchSrv', function(SearchSrv, StreamSrv) {
5-
function update(objectType, control) {
5+
function update(objectType, control, updates) {
66
var range = '';
77
if (control.loadAll) {
88
range = 'all';
@@ -38,7 +38,7 @@
3838
control.values.push(d);
3939
});
4040
if (angular.isFunction(control.onUpdate)) {
41-
control.onUpdate();
41+
control.onUpdate(updates);
4242
}
4343
}
4444
control.total = total;
@@ -93,8 +93,8 @@
9393
}
9494

9595
if (control.skipStream !== true) {
96-
StreamSrv.listen(root, control.streamObjectType || objectType, function() {
97-
update(objectType, control);
96+
StreamSrv.listen(root, control.streamObjectType || objectType, function(updates) {
97+
update(objectType, control, updates);
9898
});
9999
}
100100

ui/app/views/partials/case/case.observables.item.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ <h4>
2525
</div>
2626
<!-- Observable analysers short reports -->
2727
<div class="col-md-11 col-md-offset-1">
28-
<report ng-if="jobs[0]"
29-
ng-repeat="(analyzerId, jobs) in analyzerJobs"
28+
<report ng-repeat="(analyzerId, summary) in artifact.reports"
3029
artifact="artifact"
31-
content="jobs[0].report.summary"
30+
content="summary"
3231
report-type="short"
3332
name="analyzerId"
34-
status="jobs[0].status"
35-
success="jobs[0].success"
33+
success="true"
3634
class="short-report"></report>
3735
</div>
3836
</div>

ui/app/views/reports/short.html

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Default Short Tpl

0 commit comments

Comments
 (0)