Skip to content

Commit

Permalink
#175 Display responder type in definitions list
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Apr 3, 2019
1 parent babc01c commit b641b09
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h4 class="media-heading">
<strong>Author:</strong> {{definition.author}}</small>
<small class="mr-xxs" ng-if="definition.license">
<strong>License:</strong> {{definition.license}}</small>
<small class="mr-xxs">
<small class="mr-xxs" ng-if="definition.runners.length > 0">
<strong>Type:</strong> {{definition.runners.join(', ')}}</small>
</h4>
<div class="mt-xs text-muted">{{definition.description}}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<div class="mb-s" ng-if="$ctrl.invalidResponders.length > 0">
<div class="callout callout-warning">
<h4>You have {{$ctrl.invalidResponders.length}} invalid
<ng-pluralize count="$ctrl.invalidResponders.length" when="{'1': 'responder', 'other': 'responders'}"></ng-pluralize>
<ng-pluralize count="$ctrl.invalidResponders.length" when="{'1': 'responder', 'other': 'responders'}">
</ng-pluralize>
</h4>
<p>Invalid responders have no definition and cannot be run on any observable. You have to remove them.</p>
</div>
Expand Down Expand Up @@ -41,19 +42,21 @@ <h4 class="media-heading">
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
<input type="text" class="form-control input-lg" ng-model="$ctrl.state.filterAvailable" placeholder="Filter available responders">
<input type="text" class="form-control input-lg" ng-model="$ctrl.state.filterAvailable"
placeholder="Filter available responders">
</div>
</div>
<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-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 text-center">Rate Limit</div>
<div class="flex-col flex-w-100"></div>
<div class="flex-col flex-w-100"></div>
</div>
<div class="flex-row media" ng-repeat="def in $ctrl.definitionsIds | filter:$ctrl.state.filterAvailable" ng-init="definition = $ctrl.responderDefinitions[def];">
<div class="flex-row media" ng-repeat="def in $ctrl.definitionsIds | filter:$ctrl.state.filterAvailable"
ng-init="definition = $ctrl.responderDefinitions[def];">
<!-- <div class="media-left">
<span class="label label-default" ng-class="{'Active': 'label-success'}[org.status]">{{org.status}}</span>
</div> -->
Expand All @@ -68,30 +71,41 @@ <h4 class="media-heading">
<strong>Author:</strong> {{definition.author}}</small>
<small class="mr-xxs" ng-if="definition.license">
<strong>License:</strong> {{definition.license}}</small>
<small class="mr-xxs" ng-if="definition.runners.length > 0">
<strong>Type:</strong> {{definition.runners.join(', ')}}</small>
</h4>
<div class="mt-xs text-muted">{{definition.description}}</div>
</div>
<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>
<tlp
value="$ctrl.activeResponders[def].configuration.check_tlp ? $ctrl.activeResponders[def].configuration.max_tlp : undefined">
</tlp>
</div>
<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>
<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">
<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>
<span ng-show="!$ctrl.activeResponders[def].rate || !$ctrl.activeResponders[def].rateUnit" class="label label-lg label-default">None</span>
<span ng-show="!$ctrl.activeResponders[def].rate || !$ctrl.activeResponders[def].rateUnit"
class="label label-lg label-default">None</span>
</div>
<div class="flex-col flex-icon flex-w-100 text-center" ng-if="$ctrl.activeResponders[def]" ng-click="$ctrl.edit('edit', $ctrl.responderDefinitions[def], $ctrl.activeResponders[def])">
<div class="flex-col flex-icon flex-w-100 text-center" ng-if="$ctrl.activeResponders[def]"
ng-click="$ctrl.edit('edit', $ctrl.responderDefinitions[def], $ctrl.activeResponders[def])">
<a href class="text-primary">
<i class="fa fa-edit"></i>Edit</a>
</div>
<div class="flex-col flex-icon flex-w-100 text-center" ng-if="$ctrl.activeResponders[def]" ng-click="$ctrl.disable($ctrl.activeResponders[def].id)">
<div class="flex-col flex-icon flex-w-100 text-center" ng-if="$ctrl.activeResponders[def]"
ng-click="$ctrl.disable($ctrl.activeResponders[def].id)">
<a href class="text-danger">
<i class="fa fa-ban"></i>Disable</a>
</div>
<div class="flex-col flex-icon flex-w-100 text-center" ng-click="$ctrl.enable(def)" ng-if="!$ctrl.activeResponders[def]">
<div class="flex-col flex-icon flex-w-100 text-center" ng-click="$ctrl.enable(def)"
ng-if="!$ctrl.activeResponders[def]">
<a href class="text-success">
<i class="fa fa-plus"></i>Enable</a>
</div>
Expand Down
1 change: 1 addition & 0 deletions www/src/app/pages/analyzers/analyzers.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default class AnalyzerService {
response => {
this.analyzerDefinitions = _.keyBy(response.data, 'id');

// Compute type (process/docker)
_.keys(this.analyzerDefinitions).forEach(key => {
let def = this.analyzerDefinitions[key];

Expand Down
15 changes: 15 additions & 0 deletions www/src/app/pages/responders/responders.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ export default class ResponderService {
response => {
this.responderDefinitions = _.keyBy(response.data, 'id');

// Compute type (process/docker)
_.keys(this.responderDefinitions).forEach(key => {
let def = this.responderDefinitions[key];

def.runners = [];

if (def.command && def.command !== null) {
def.runners.push('Process');
}

if (def.image && def.image !== null) {
def.runners.push('Docker');
}
});

defered.resolve(this.responderDefinitions);
},
response => {
Expand Down

0 comments on commit b641b09

Please sign in to comment.