Skip to content

Commit

Permalink
#124 Display PAP in analyzers and responders admin pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Sep 12, 2018
1 parent 60956ae commit fb78c1b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
13 changes: 8 additions & 5 deletions www/src/app/core/directives/tlp/tlp.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import _ from 'lodash/core';
import tpl from './tlp.html';
import './tlp.scss';

export default function(app) {
export default function (app) {
app.directive('tlp', tlp);

function tlp(Tlps) {
Expand All @@ -14,7 +14,8 @@ export default function(app) {
return {
templateUrl: tpl,
scope: {
value: '='
value: '=',
namespace: '@'
},
replace: true,
link: linkFn
Expand All @@ -26,12 +27,14 @@ export default function(app) {
scope.tlpClass = 'label-none';
scope.tlp = 'None';
} else {
const temp = (_.find(Tlps, { value: v }) || {}).key;
const temp = (_.find(Tlps, {
value: v
}) || {}).key;

scope.tlpClass = `label-${(temp || '').toLowerCase()}`;
scope.tlp = `TLP:${temp}`;
scope.tlp = `${scope.namespace || 'TLP'}:${temp}`;
}
});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ <h4 class="media-heading">
<div class="col-sm-12 flex-table">
<div class="flex-header media">
<div class="flex-col flex-1">Analyzer</div>
<div class="flex-col flex-w-200 text-center">Max TLP</div>
<div class="flex-col flex-w-200 text-center">Rate Limit</div>
<div class="flex-col flex-w-100 text-center">Max TLP</div>
<div class="flex-col flex-w-100 text-center">Max PAP</div>
<div class="flex-col flex-w-100 text-center">Rate Limit</div>
<div class="flex-col flex-w-100"></div>
<div class="flex-col flex-w-100"></div>
</div>
Expand All @@ -66,10 +67,13 @@ <h4 class="media-heading">
</h4>
<div class="mt-xs text-muted">{{definition.description}}</div>
</div>
<div class="flex-col flex-w-200 text-center vertical centered" ng-if="$ctrl.activeAnalyzers[def]">
<div class="flex-col flex-w-100 text-center vertical centered" ng-if="$ctrl.activeAnalyzers[def]">
<tlp value="$ctrl.activeAnalyzers[def].configuration.check_tlp ? $ctrl.activeAnalyzers[def].configuration.max_tlp : undefined"></tlp>
</div>
<div class="flex-col flex-w-200 text-center vertical centered" ng-if="$ctrl.activeAnalyzers[def]">
<div class="flex-col flex-w-100 text-center vertical centered" ng-if="$ctrl.activeAnalyzers[def]">
<tlp value="$ctrl.activeAnalyzers[def].configuration.check_pap ? $ctrl.activeAnalyzers[def].configuration.max_pap : undefined" namepace="PAP"></tlp>
</div>
<div class="flex-col flex-w-100 text-center vertical centered" ng-if="$ctrl.activeAnalyzers[def]">
<span ng-show="$ctrl.activeAnalyzers[def].rate && $ctrl.activeAnalyzers[def].rateUnit" class="label label-lg label-primary">
{{$ctrl.activeAnalyzers[def].rate}} per {{$ctrl.activeAnalyzers[def].rateUnit}}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ <h4 class="media-heading">
<div class="col-sm-12 flex-table">
<div class="flex-header media">
<div class="flex-col flex-1">Responders</div>
<div class="flex-col flex-w-200 text-center">Max TLP</div>
<div class="flex-col flex-w-200 text-center">Rate Limit</div>
<div class="flex-col flex-w-100 text-center">Max TLP</div>
<div class="flex-col flex-w-100 text-center">Max PAP</div>
<div class="flex-col flex-w-100 text-center">Rate Limit</div>
<div class="flex-col flex-w-100"></div>
<div class="flex-col flex-w-100"></div>
</div>
Expand All @@ -70,10 +71,13 @@ <h4 class="media-heading">
</h4>
<div class="mt-xs text-muted">{{definition.description}}</div>
</div>
<div class="flex-col flex-w-200 text-center vertical centered" ng-if="$ctrl.activeResponders[def]">
<div class="flex-col flex-w-100 text-center vertical centered" ng-if="$ctrl.activeResponders[def]">
<tlp value="$ctrl.activeResponders[def].configuration.check_tlp ? $ctrl.activeResponders[def].configuration.max_tlp : undefined"></tlp>
</div>
<div class="flex-col flex-w-200 text-center vertical centered" ng-if="$ctrl.activeResponders[def]">
<div class="flex-col flex-w-100 text-center vertical centered" ng-if="$ctrl.activeResponders[def]">
<tlp value="$ctrl.activeResponders[def].configuration.check_pap ? $ctrl.activeResponders[def].configuration.max_pap : undefined" namespace="PAP"></tlp>
</div>
<div class="flex-col flex-w-100 text-center vertical centered" ng-if="$ctrl.activeResponders[def]">
<span ng-show="$ctrl.activeResponders[def].rate && $ctrl.activeResponders[def].rateUnit" class="label label-lg label-primary">
{{$ctrl.activeResponders[def].rate}} per {{$ctrl.activeResponders[def].rateUnit}}
</span>
Expand Down
2 changes: 1 addition & 1 deletion www/src/app/pages/jobs/components/job.details.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<strong>PAP</strong>
<p>
<tlp value="$ctrl.job.pap"></tlp>
<tlp value="$ctrl.job.pap" namespace="PAP"></tlp>
</p>
<hr>

Expand Down

0 comments on commit fb78c1b

Please sign in to comment.