Skip to content

Commit

Permalink
#68 Add an editable field to the observable details page, to allow se…
Browse files Browse the repository at this point in the history
…tting an observable as IOC
  • Loading branch information
nadouani committed Dec 30, 2016
1 parent 1d1a9e1 commit a92d3c8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
20 changes: 10 additions & 10 deletions ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

$scope.artifact = {};
$scope.artifact.tlp = $scope.artifact.tlp || -1;
$scope.analysisEnabled = VersionSrv.hasCortex();
$scope.analysisEnabled = VersionSrv.hasCortex();

$scope.editorOptions = {
lineNumbers: true,
Expand Down Expand Up @@ -105,7 +105,7 @@
startDate: job.startDate,
endDate: job.endDate
};
}
};

$scope.similarArtifacts = CaseArtifactSrv.api().similar({
'artifactId': observableId
Expand All @@ -114,7 +114,7 @@

$scope.openArtifact = function (a) {
$state.go('app.case.observables-item', {
caseId: a["case"].id,
caseId: a['case'].id,
itemId: a.id
});
};
Expand All @@ -135,18 +135,20 @@

return CaseArtifactSrv.api().update({
artifactId: $scope.artifact.id
}, field, function () {}, function (response) {
}, field, function (response) {
$scope.artifact = response.toJSON();
}, function (response) {
AlertSrv.error('artifactDetails', response.data, response.status);
});
};

$scope._runAnalyzer = function (serverId, analyzerId, artifactId) {
return CortexSrv.createJob({
cortexId: serverId,
artifactId: $scope.artifact.id,
artifactId: artifactId,
analyzerId: analyzerId
});
}
};

$scope.runAnalyzer = function (analyzerId) {
var artifactName = $scope.artifact.data || $scope.artifact.attachment.name;
Expand All @@ -168,7 +170,7 @@
var artifactId = $scope.artifact.id;
var artifactName = $scope.artifact.data || $scope.artifact.attachment.name;
var analyzerIds = _.pluck(_.filter($scope.analyzers, function (a) {
return a.active = true;
return a.active === true;
}), 'id');

CortexSrv.getServers(analyzerIds)
Expand All @@ -179,9 +181,7 @@
})
.then(function () {
AlertSrv.log('Analyzers has been successfully started for observable: ' + artifactName, 'success');
}, function () {

})
});
};

}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/case/case.observables.item.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col-md-11 col-md-offset-1" ng-show="artifact.data != undefined">
<div class="col-md-12">
<h4>
<span class="text-muted glyphicon " ng-class="{true:'text-primary glyphicon-star'}[artifact.ioc]" tooltip-placement="bottom" tooltip-popup-delay="500" tooltip="is an IOC"></span>
<span class="text-muted fa " ng-class="{true:'text-primary fa-star'}[artifact.ioc]" tooltip-placement="bottom" tooltip-popup-delay="500" tooltip="is an IOC"></span>
[<span ng-bind="artifact.dataType" style="text-transform: uppercase;"></span>]: <em><span class="wrap">{{artifact.data | fang}}</span></em>
</h4>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ <h3 class="vpad10 text-primary">Observable Information</h3>
<dd>{{artifact.startDate | showDate}}</dd>
</dl>

<dl class="dl-horizontal clear">
<dt class="pull-left">Is IOC</dt>
<dd>
<span ng-init="iocActive = false" ng-mouseenter="iocActive = true" ng-mouseleave="iocActive = false" ng-click="updateField('ioc', !artifact.ioc)">
<i class="text-primary fa" ng-class="{'true': 'fa-star', 'false': 'fa-star-o'}[artifact.ioc]"></i>
<small ng-show="iocActive">
<a href class="clickable" tooltip="edit">
<i class="glyphicon glyphicon-pencil"></i>
</a>
</small>
</span>
</dd>
</dl>

<dl class="dl-horizontal clear">
<dt class="pull-left">Labels</dt>
<dd>
Expand Down

0 comments on commit a92d3c8

Please sign in to comment.