Skip to content

Commit

Permalink
#1437 Add sharing quick info in tasks and observables lists
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jul 16, 2020
1 parent e0bd0d1 commit f9e02d2
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
sort: $scope.filtering.context.sort,
pageSize: $scope.filtering.context.pageSize,
filter: $scope.filtering.buildQuery(),
extraData: ['seen', 'permissions'],
extraData: ['seen', 'permissions', 'isOwner', 'shareCount'],
operations: [
{'_name': 'getCase', 'idOrName': $scope.caseId},
{'_name': 'observables'}
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/scripts/controllers/case/CaseTasksCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
.then(function() {
$scope.load();

$scope.$watchCollection('artifacts.pageSize', function (newValue) {
$scope.$watchCollection('tasks.pageSize', function (newValue) {
$scope.filtering.setPageSize(newValue);
});
});
Expand All @@ -47,7 +47,7 @@
version: 'v1',
scope: $scope,
sort: $scope.filtering.context.sort,
loadAll: true,
loadAll: false,
pageSize: $scope.filtering.context.pageSize,
filter: $scope.filtering.buildQuery(),
baseFilter: {
Expand All @@ -56,11 +56,11 @@
_value: 'Cancel'
}
},
//withStats: true,
operations: [
{'_name': 'getCase', "idOrName": $scope.caseId},
{'_name': 'tasks'}
],
extraData: ['isOwner', 'shareCount'],
onUpdate: function() {
$scope.buildTaskGroups($scope.tasks.values);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/scripts/filters/shortDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';
angular.module('theHiveFilters').filter('shortDate', function() {
return function(str) {
var format = ' MM/DD/YY H:mm';
var format = 'MM/DD/YY H:mm';
if (angular.isString(str) && str.length > 0) {
return moment(str, ['YYYYMMDDTHHmmZZ', 'DD-MM-YYYY HH:mm']).format(format);
} else if (angular.isNumber(str)) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/views/directives/updatable-date.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<span ng-hide="updatable.updating" ng-init="active = false" ng-mouseenter="active = true" ng-mouseleave="active = false">
<span ng-if="value!==null && value !==''" style="vertical-align:top" class="updatable-value" >{{value | shortDate}}</span>
<span ng-if="value!==null && value !==''" style="vertical-align:top" class="updatable-value">{{value | shortDate}}</span>
<span ng-if="value===null || value ===''" style="vertical-align: top; white-space: pre-wrap" class="updatable-value text-warning"><em>Not Specified</em></span>
<small ng-show="active">
<a style="cursor: pointer;" target="_self" tooltip-popup-delay='500' uib-tooltip="edit">
Expand Down
43 changes: 42 additions & 1 deletion frontend/app/views/partials/case/case.tasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ <h4>

<div class="row" ng-if="!state.showGrouped && tasks.total !== 0">
<div class="col-md-12">

<psearch control="tasks"></psearch>

<table class="table table-hover valigned tasks-table">
<thead>
<tr>
<th style="width: 20px"></th>
<th style="width: 40px"></th>
<th style="width: 250px">Group</th>
<th>Task</th>
<th style="width: 70px;"></th>
<th style="width: 150px">Date</th>
<th style="width: 150px">Assignee</th>
<th style="width: 250px" class="text-right" if-permission="manageTask" allowed="{{userPermissions}}">Actions</th>
Expand Down Expand Up @@ -89,6 +93,11 @@ <h4>
</td>
<td>
<div>
<!-- FIXME -->
<span class="mr-xxs text-primary clickable" ng-if="!!!task.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 clickable" ng-if="!!task.extraData.isOwner"><i class="fa fa-building-o"
uib-tooltip="Created by my organisation" tooltip-placement="right"></i></span>
<a href ui-sref="app.case.tasks-item({caseId: caseId, itemId:task._id})">{{task.title}}</a>
</div>
<div ng-show="task.status === 'Completed'" class="text-success">
Expand All @@ -98,7 +107,19 @@ <h4>
Started <em am-time-ago="task.startDate"></em>
</div>
</td>
<td>{{task.startDate | showDate}}</td>
<td align="center">
<a href ng-if="task.extraData.shareCount > 0" ui-sref="app.case.tasks-item({caseId: caseId, itemId:task._id})" class="noline"
uib-tooltip="{{ {
true: 'Current organisation has shared this Task with ' + task.extraData.shareCount + ' organisation(s)',
false: 'This Task has been shared by its owner with ' + task.extraData.shareCount + ' organisation(s)'
}[task.extraData.isOwner] }}"
tooltip-placement="left-middle">

<i class="fa fa-users"></i>
({{task.extraData.shareCount || 0}})
</a>
</td>
<td>{{task.startDate | shortDate}}</td>
<td ng-if="canEdit">
<span ng-show="task.assignee">
<updatable-user on-update="updateField('owner', newValue, task)" value="task.assignee"/>
Expand Down Expand Up @@ -149,11 +170,16 @@ <h4>
</tr>
</tbody>
</table>

<psearch control="tasks"></psearch>
</div>
</div>

<div class="row" ng-if="state.showGrouped && tasks.total !== 0">
<div class="col-md-12">

<psearch control="tasks"></psearch>

<div class="panel panel-default" ng-repeat="group in groupedTasks">
<div class="panel-heading">
<strong>{{group.group || 'Not Specified'}}</strong> <small>({{group.tasks.length}} task(s))</small>
Expand All @@ -166,6 +192,7 @@ <h4>
<th style="width: 40px"></th>
<th style="width: 250px">Group</th>
<th>Task</th>
<th style="width: 70px;"></th>
<th style="width: 150px">Date</th>
<th style="width: 150px">Assignee</th>
<th style="width: 250px" class="text-right" if-permission="manageTask" allowed="{{userPermissions}}">Actions</th>
Expand Down Expand Up @@ -203,6 +230,18 @@ <h4>
Started <em am-time-ago="task.startDate"></em>
</div>
</td>
<td align="center">
<a href ng-if="task.extraData.shareCount > 0" ui-sref="app.case.tasks-item({caseId: caseId, itemId:task._id})" class="noline"
uib-tooltip="{{ {
true: 'Current organisation has shared this Task with ' + task.extraData.shareCount + ' organisation(s)',
false: 'This Task has been shared by its owner with ' + task.extraData.shareCount + ' organisation(s)'
}[task.extraData.isOwner] }}"
tooltip-placement="left-middle">

<i class="fa fa-users"></i>
({{task.extraData.shareCount || 0}})
</a>
</td>
<td>{{task.startDate | shortDate}}</td>
<td ng-if="canEdit">
<span ng-show="task.assignee">
Expand Down Expand Up @@ -256,5 +295,7 @@ <h4>
</div>
</div>

<psearch control="tasks"></psearch>

</div>
</div>
6 changes: 3 additions & 3 deletions frontend/app/views/partials/case/case.tasks.item.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ <h4 class="mb-xs text-primary">

<div class="col-md-6">
<dl class="dl-horizontal">
<dt class="pull-left">Date</dt>
<dt class="pull-left">Start date</dt>
<dd ng-if="canEdit && task.status !== 'Waiting'">
<updatable-date on-update="updateField('startDate', newValue)" value="task.startDate"/>
</dd>
<dd ng-if="!canEdit && task.status !== 'Waiting'">
{{task.startDate | showDate}}
<span ng-bind="task.startDate | shortDate"></span>
</dd>
<dd ng-if="task.status === 'Waiting'">
<em class="text-warning">Not started yet</em>
Expand All @@ -115,7 +115,7 @@ <h4 class="mb-xs text-primary">
<dl class="dl-horizontal" ng-show="task.status == 'Completed'">
<dt class="pull-left">Close date</dt>
<dd>
<span ng-bind="task.endDate | showDate"></span>
<span ng-bind="task.endDate | shortDate"></span>
</dd>
</dl>

Expand Down
27 changes: 24 additions & 3 deletions frontend/app/views/partials/observables/list/observables.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ <h4>
<i ng-show="artifacts.sort === '-data'" class="fa fa-caret-down"></i>
</a>
</th>
<th style="width: 70px;"></th>
<th style="width: 120px">
<a href class="text-default" ng-click="sortByField('startDate')">
Date Added
Expand Down Expand Up @@ -82,8 +83,16 @@ <h4>
<a href ng-click="addFilterValue('dataType', artifact.dataType)"><span ng-bind="artifact.dataType"></span></a>
</td>
<td class="wrap">
<div class="wrap clickable" ng-click="openArtifact(artifact)" uib-tooltip="{{artifact.message}}" tooltip-placement="top-left">
{{(artifact.data | fang) || (artifact.attachment.name | fang)}}
<!-- FIXME -->
<div class="wrap clickable" ng-click="openArtifact(artifact)">
<span class="mr-xxs text-primary clickable" ng-if="!!!artifact.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 clickable" ng-if="!!artifact.extraData.isOwner"><i class="fa fa-building-o"
uib-tooltip="Created by my organisation" tooltip-placement="right"></i></span>
<span class="wrap clickable" uib-tooltip="{{artifact.message}}" tooltip-placement="top-left">
{{(artifact.data | fang) || (artifact.attachment.name | fang)}}
</span>

</div>
<div class="case-tags flexwrap mt-xxs">
<span class="mr-xxxs text-muted"><i class="fa fa-tags"></i></span>
Expand All @@ -97,6 +106,18 @@ <h4>

<mini-report-list observable="artifact" reports="artifact.reports" on-item-clicked="showReport(observable, analyzerId)"></mini-report-list>
</td>
<td align="center">
<a href ng-if="artifact.extraData.shareCount > 0" ui-sref="app.case.observables-item({itemId: artifact._id})" class="noline"
uib-tooltip="{{ {
true: 'Current organisation has shared this Observable with ' + artifact.extraData.shareCount + ' organisation(s)',
false: 'This Observable has been shared by its owner with ' + artifact.extraData.shareCount + ' organisation(s)'
}[artifact.extraData.isOwner] }}"
tooltip-placement="left-middle">

<i class="fa fa-users"></i>
({{artifact.extraData.shareCount || 0}})
</a>
</td>
<td>
<a href ng-click="addFilterValue('startDate', artifact.startDate)"><span uib-tooltip="{{artifact.startDate | showDate}}" tooltip-popup-delay="500" tooltip-placement="bottom">{{artifact.startDate | shortDate}}</span></a>
</td>
Expand All @@ -105,7 +126,7 @@ <h4>
<a href class="text-primary noline nowrap" ng-click="getObsResponders(artifact, true)" uib-dropdown-toggle>
<i class="text-primary fa fa-cog"></i>
</a>
</span>
</span>
</td>
</tr>
</tbody>
Expand Down

0 comments on commit f9e02d2

Please # to comment.