Skip to content

Commit

Permalink
#1410 Fix the case attachments section
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jul 15, 2020
1 parent 6cc0d8c commit 2934fe9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
43 changes: 14 additions & 29 deletions frontend/app/scripts/controllers/case/CaseDetailsCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';

angular.module('theHiveControllers').controller('CaseDetailsCtrl', function($scope, $state, $uibModal, CaseTabsSrv, UserSrv, TagSrv, PSearchSrv) {
angular.module('theHiveControllers').controller('CaseDetailsCtrl', function($scope, $state, $uibModal, PaginatedQuerySrv, CaseTabsSrv, UserSrv, TagSrv, PSearchSrv) {

CaseTabsSrv.activateTab($state.current.data.tab);

Expand All @@ -11,36 +11,22 @@
'isCollapsed': true
};

$scope.attachments = PSearchSrv($scope.caseId, 'case_task_log', {
scope: $scope,
$scope.attachments = new PaginatedQuerySrv({
skipStream: true,
version: 'v1',
loadAll: false,
filter: {
'_and': [
{
'_not': {
'status': 'Deleted'
}
}, {
'_contains': 'attachment.id'
}, {
'_parent': {
'_type': 'case_task',
'_query': {
'_parent': {
'_type': 'case',
'_query': {
'_id': $scope.caseId
}
}
}
}
}
]
'_contains': 'attachment'
},
extraData: ['taskId'],
pageSize: 100,
nparent: 1
operations: [
{ '_name': 'getCase', 'idOrName': $scope.caseId },
{ '_name': 'tasks' },
{ '_name': 'logs' },
]
});


var connectors = $scope.appConfig.connectors;
if(connectors.cortex && connectors.cortex.enabled) {
$scope.actions = PSearchSrv(null, 'connector/cortex/action', {
Expand Down Expand Up @@ -70,10 +56,9 @@
}

$scope.openAttachment = function(attachment) {
// TODO fix me attachment.case_task is not defined
$state.go('app.case.tasks-item', {
caseId: $scope.caze.id,
itemId: attachment.case_task.id
caseId: $scope.caze._id,
itemId: attachment.extraData.taskId
});
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/views/partials/case/case.details.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h4 class="vpad10 text-primary">Attachments</h4>
<tbody>
<tr ng-repeat="attachment in attachments.values" style="cursor: pointer;" tooltip-placement="bottom" tooltip-popup-delay="500" uib-tooltip="{{attachment.message}}">
<td ng-click="openAttachment(attachment)">{{attachment.attachment.name}}</td>
<td ng-click="openAttachment(attachment)">{{attachment.startDate | shortDate}}</td>
<td ng-click="openAttachment(attachment)">{{attachment.date | shortDate}}</td>
<td ng-click="openAttachment(attachment)">{{attachment.attachment.contentType}}</td>
<td ng-click="openAttachment(attachment)">{{attachment.attachment.size}}</td>
<td style="text-align:center">
Expand Down

0 comments on commit 2934fe9

Please sign in to comment.