Skip to content

Commit

Permalink
#1410 Use the new case.extraData field to fetch stats in case list
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 28, 2020
1 parent e12a821 commit 46f67dc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
4 changes: 2 additions & 2 deletions frontend/app/scripts/controllers/case/CaseListCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@
loadAll: false,
pageSize: self.filtering.context.pageSize,
filter: this.filtering.buildQuery(),
withStats: true,
operations: [
{'_name': 'listCase'}
]
],
extraData: ["observableStats", "taskStats", "isOwner", "shareCount"]
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
this.streamObjectType = options.skipStream || options.objectType;
this.guard = options.guard || undefined;
this.withStats = options.withStats || undefined;
this.extraData = options.extraData || undefined;

this.operations = options.operations;

Expand Down Expand Up @@ -78,7 +79,7 @@
return _.extend({
from: from,
to: to
}, self.withStats ? {withStats: true} : {});
}, self.extraData ? {extraData: self.extraData} : {});
};

/*
Expand All @@ -101,7 +102,7 @@
if (angular.isFunction(self.onUpdate)) {
self.onUpdate(updates);
}
}
}
});

// get the total if not cached
Expand Down
31 changes: 13 additions & 18 deletions frontend/app/views/partials/case/case.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ <h3 class="box-title">List of cases ({{$vm.list.total || 0}} of {{$vm.caseStats.
<td class="p-0 bg-tlp-{{currentCase.tlp}} clickable" ng-click="$vm.addFilterValue('tlp', currentCase.tlp)"></td>
<td>
<div class="case-title wrap">
<span class="mr-xxs text-primary" ng-if="!!!currentCase.stats.isOwner"><i class="fa fa-share-square"
<span class="mr-xxs text-primary" ng-if="!!!currentCase.extraData.isOwner"><i class="fa fa-share-square"
uib-tooltip="Shared from another organisation" tooltip-placement="right"></i></span>
<span class="mr-xxs text-primary" ng-if="!!currentCase.stats.isOwner"><i class="fa fa-building-o"
<span class="mr-xxs text-primary" ng-if="!!currentCase.extraData.isOwner"><i class="fa fa-building-o"
uib-tooltip="Created by my organisation" tooltip-placement="right"></i></span>
<a ui-sref="app.case.details({caseId: currentCase._id})">#{{currentCase.number}} - {{currentCase.title}}</a>
</div>
Expand All @@ -82,37 +82,31 @@ <h3 class="box-title">List of cases ({{$vm.list.total || 0}} of {{$vm.caseStats.
</div>
</td>
<td align="center">
<span class="label label-danger">TODO</span>
<!-- TODO nadouani: not yet implemented -->
<!-- <a href ng-if="currentCase.stats.shareCount > 0" ui-sref="app.case.sharing({caseId: currentCase._id})" class="noline"
<a href ng-if="currentCase.extraData.shareCount > 0" ui-sref="app.case.sharing({caseId: currentCase._id})" class="noline"
uib-tooltip="{{ {
true: 'Current organisation has shared this Case with ' + currentCase.stats.shareCount + ' organisation(s)',
false: 'This Case has been shared by its owner with ' + currentCase.stats.shareCount + ' organisation(s)'
}[currentCase.stats.isOwner] }}"
true: 'Current organisation has shared this Case with ' + currentCase.extraData.shareCount + ' organisation(s)',
false: 'This Case has been shared by its owner with ' + currentCase.extraData.shareCount + ' organisation(s)'
}[currentCase.extraData.isOwner] }}"
tooltip-placement="left-middle">

<i class="fa fa-users"></i>
({{currentCase.stats.shareCount || 0}})
</a> -->
({{currentCase.extraData.shareCount || 0}})
</a>
</td>
<td align="center">
<div class="clickable" ng-click="$vm.addFilterValue('severity', currentCase.severity)">
<severity active="false" value="currentCase.severity"></severity>
</div>
</td>
<td>
<span class="label label-danger">TODO</span>
<!-- TODO nadouani: not yet implemented -->
<!-- <a ui-sref="app.case.tasks({caseId: currentCase._id})">
<ng-pluralize count="currentCase.stats.tasks.total" when="{'0': 'No Tasks', '1': '1 Task', 'other': '{} Tasks'}"></ng-pluralize>
<a ui-sref="app.case.tasks({caseId: currentCase._id})">
<ng-pluralize count="currentCase.extraData.taskStats.total" when="{'0': 'No Tasks', '1': '1 Task', 'other': '{} Tasks'}"></ng-pluralize>
</a>
<br>
<task-progress ng-show="currentCase.stats.tasks.total > 0" tasks="currentCase.stats.tasks"/> -->
<task-progress ng-show="currentCase.extraData.taskStats.total > 0" tasks="currentCase.extraData.taskStats"/>
</td>
<td>
<span class="label label-danger">TODO</span>
<!-- TODO nadouani: not yet implemented -->
<!-- <a ui-sref="app.case.observables({caseId: currentCase._id})">{{currentCase.stats.artifacts.count}}</a> -->
<a ui-sref="app.case.observables({caseId: currentCase._id})">{{currentCase.extraData.observableStats.count}}</a>
</td>
<td class="nowrap">
<user user-id="currentCase.assignee" icon-only="true" icon-size="m"></user>
Expand All @@ -128,6 +122,7 @@ <h3 class="box-title">List of cases ({{$vm.list.total || 0}} of {{$vm.caseStats.
</div>
</td>
<td if-permission="manageTask" allowed="{{userPermissions}}" ng-if="appConfig.connectors.cortex.enabled">

<span class="ml-xs" uib-dropdown>
<a href class="text-primary noline nowrap" ng-click="$vm.getCaseResponders(currentCase._id, true)" uib-dropdown-toggle>
<i class="text-primary fa fa-cog"></i>
Expand Down

0 comments on commit 46f67dc

Please sign in to comment.