Skip to content

Commit

Permalink
#195 Add file artifact download link to job report page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 5, 2019
1 parent 9072f3e commit 85e7bb9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
7 changes: 6 additions & 1 deletion www/src/app/pages/jobs/job.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ export default class JobController {

this.$log = $log;
}
}

$onInit() {
this.protectDownloadsWith = this.main.config.config.protectDownloadsWith;
this.hasFileArtifact = this.job.report.artifacts.find(item => item.dataType === 'file');
}
}
14 changes: 12 additions & 2 deletions www/src/app/pages/jobs/job.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ <h5 class="text-primary mt-xs">Report</h5>

<div ng-if="$ctrl.job.report.artifacts.length > 0">
<h5 class="text-primary mt-xs">Artifacts</h5>
<div class="mv-xxs" ng-if="$ctrl.hasFileArtifact">
<small class="text-danger">Zip are protected with password "{{$ctrl.protectDownloadsWith}}"</small>
</div>
<table class="table table-striped">
<tr>
<th width="20">#</th>
Expand All @@ -40,8 +43,15 @@ <h5 class="text-primary mt-xs">Artifacts</h5>
<td>{{$index + 1}}</td>
<td>{{artifact.dataType}}</td>
<td>
<div class="wrap">
{{(artifact.attachment.name || artifact.data) | fang}}
<div class="wrap" ng-if="artifact.dataType === 'file'">
{{artifact.attachment.name| fang}}
<a href="./api/datastorezip/{{artifact.attachment.id}}?name={{artifact.attachment.name}}"
target="_blank">
(Download)
</a>
</div>
<div class="wrap" ng-if="artifact.dataType !== 'file'">
{{artifact.data | fang}}
</div>
<div ng-if="artifact.tags.length > 0">
<span class="label label-primary"
Expand Down
11 changes: 6 additions & 5 deletions www/src/app/pages/jobs/jobs.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ const jobsModule = angular
url: 'jobs',
component: 'jobsPage',
resolve: {
datatypes: ($q, AnalyzerService) => {
return AnalyzerService.list()
.then(() => $q.resolve(AnalyzerService.getTypes()))
.catch(err => $q.reject(err));
},
datatypes: ($q, AnalyzerService) => AnalyzerService.list()
.then(() => $q.resolve(AnalyzerService.getTypes()))
.catch(err => $q.reject(err)),
jobtypes: () => ['analyzer', 'responder'],
analyzers: AnalyzerService =>
AnalyzerService.list().then(analyzers =>
Expand Down Expand Up @@ -97,6 +95,9 @@ const jobsModule = angular
templateUrl: jobTpl,
bindings: {
job: '<'
},
require: {
main: '^^mainPage'
}
})
.component('jobDetails', {
Expand Down

0 comments on commit 85e7bb9

Please sign in to comment.