Skip to content

Commit

Permalink
#1625 Add the ignoreSimilarity flag to the observable bulk update dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani authored and To-om committed Nov 13, 2020
1 parent 2f01e60 commit e3de16f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
14 changes: 13 additions & 1 deletion frontend/app/scripts/controllers/case/ObservableUpdateCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
enableTlp: false,
enableIoc: false,
enableSighted: false,
enableIgnoreSimilarity: false,
enableAddTags: false,
enableRemoveTags: false
};
Expand All @@ -18,6 +19,7 @@
this.params = {
ioc: false,
sighted: false,
ignoreSimilarity: false,
tlp: 2,
addTagNames: '',
removeTagNames: ''
Expand All @@ -30,6 +32,7 @@
this.state.enableTlp = this.state.all;
this.state.enableIoc = this.state.all;
this.state.enableSighted = this.state.all;
this.state.enableIgnoreSimilarity = this.state.all;
this.state.enableAddTags = this.state.all;
this.state.enableRemoveTags = this.state.all;
};
Expand All @@ -52,7 +55,7 @@
};

this.buildOperations = function(postData) {
var flags = _.pick(postData, 'ioc', 'sighted', 'tlp');
var flags = _.pick(postData, 'ioc', 'sighted', 'ignoreSimilarity', 'tlp');

// Handle updates without tag changes
if(!postData.addTags && !postData.removeTags) {
Expand Down Expand Up @@ -110,6 +113,10 @@
postData.sighted = this.params.sighted;
}

if(this.state.enableIgnoreSimilarity) {
postData.ignoreSimilarity = this.params.ignoreSimilarity;
}

if(this.state.enableTlp) {
postData.tlp = this.params.tlp;
}
Expand Down Expand Up @@ -143,6 +150,11 @@
this.state.enableSighted = true;
};

this.toogleIgnoreSimilarity = function() {
this.params.ignoreSimilarity = !this.params.ignoreSimilarity;
this.state.enableIgnoreSimilarity = true;
};

this.toggleTlp = function(value) {
this.params.tlp = value;
this.activeTlp = 'active';
Expand Down
11 changes: 11 additions & 0 deletions frontend/app/views/partials/observables/observable.update.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ <h3 class="modal-title">Update observable(s)</h3>
</div>
</div>

<div class="form-group">
<label class="col-md-3 control-label">Ignored from similarity <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enableIgnoreSimilarity"></label>
<div class="col-md-9">
<p class="form-control-static">
<a href ng-click="$dialog.toogleIgnoreSimilarity()">
<i class="text-primary fa" ng-class="{ 'fa-chain-broken' : $dialog.params.ignoreSimilarity, 'fa-chain' : !$dialog.params.ignoreSimilarity }"></i>
</a>
</p>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : observableForm.addTags.$invalid && !observableForm.addTagsInput.$pristine }">
<label class="col-md-3 control-label">Add Tags <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enableAddTags"></label>
<div class="col-md-9">
Expand Down

0 comments on commit e3de16f

Please sign in to comment.