Skip to content

Commit

Permalink
#1831 Add bulk delete and use task flags in waiting/my tasks pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Mar 12, 2021
1 parent 7de1f61 commit 4ad7589
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 57 deletions.
32 changes: 26 additions & 6 deletions frontend/app/scripts/controllers/case/CaseTasksCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@
temp = _.uniq(_.pluck($scope.selection, 'status'));
$scope.menu.reopen = temp.length === 1 && temp[0] === 'Completed';

// Handle close menu item
// temp = _.uniq(_.pluck($scope.selection, 'status'));
// $scope.menu.close = temp.length === 1 && temp[0] === 'Open';
// $scope.menu.reopen = temp.length === 1 && temp[0] === 'Resolved';

// $scope.menu.delete = $scope.selection.length > 0;
$scope.menu.delete = $scope.selection.length > 0;
};

$scope.select = function(task) {
Expand Down Expand Up @@ -312,6 +307,31 @@
return $scope.bulkUpdate(ids, {status: status});
}

$scope.bulkRemove = function() {
var ids = _.pluck($scope.selection, '_id');

ModalUtilsSrv.confirm('Delete selected tasks', 'Are you sure you want to delete the selected tasks?', {
okText: 'Yes, proceed',
flavor: 'danger'
}).then(function() {
return CaseTaskSrv.bulkUpdate(ids, {status: 'Cancel'})
.then(function(/*responses*/) {
NotificationSrv.log('Selected tasks have been successfully removed', 'success');

_.each($scope.selection, function(task) {
$scope.$emit('tasks:task-removed', task);
});
})
.catch(function(err) {
NotificationSrv.error('Bulk remove tasks', err.data, err.status);
});
}).catch(function(err) {
if(err && !_.isString(err)) {
NotificationSrv.error('Bulk remove tasks', err.data, err.status);
}
})
}

// open task tab with its details
$scope.startTask = function(task) {
var taskId = task._id;
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/views/partials/case/tasks/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<li ng-if="menu.close">
<a href ng-click="bulkStatus('Completed')"><i class="fa fa-folder"></i> Close</a>
</li>
<!-- <li ng-if="menu.delete" class="divider"></li>
<li ng-if="menu.delete" class="divider"></li>
<li>
<a href ng-click="bulkRemove()"><i class="fa fa-trash"></i> Delete</a>
</li> -->
</li>
</ul>
</div>

Expand Down
86 changes: 45 additions & 41 deletions frontend/app/views/partials/main/index-mytasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,53 @@
<div class="empty-message" ng-show="$vm.list.total === 0">No records</div>

<table class="table table-striped table-hover" ng-show="$vm.list.total > 0">
<thead>
<tr>
<th class="text-center" style="width: 60px;">Severity</th>
<th style="width: 200px;">Group</th>
<th>Task</th>
<th width="250px;">Date</th>
</tr>
</thead>
<thead>
<tr>
<th width="70px"></th>
<th class="text-center" style="width: 60px;">Severity</th>
<th style="width: 200px;">Group</th>
<th>Task</th>
<th width="250px;">Date</th>
</tr>
</thead>

<tbody>
<tr class="pointer task-row"
ng-repeat="value in $vm.list.values"
ng-class="{'warning': (value.flag == true)}"
ng-click="$vm.openEntity(value)">
<td class="text-center">
<severity active="false" value="value.extraData.case.severity"></severity>
</td>
<td>{{value.group}}</td>
<td>
<div>
<span class="text-primary mr-xxxs" ng-if="value.flag">
<i class="glyphicon glyphicon-flag"></i>
</span>
<tbody>
<tr class="pointer task-row"
ng-repeat="item in $vm.list.values"
ng-class="{'warning': (item.flag == true)}"
ng-click="$vm.openEntity(value)">
<td>
<task-flags task="item" inline="true"></task-flags>
</td>
<td class="text-center">
<severity active="false" value="item.extraData.case.severity"></severity>
</td>
<td>{{item.group}}</td>
<td>
<div>
<span class="text-primary mr-xxxs" ng-if="item.flag">
<i class="glyphicon glyphicon-flag"></i>
</span>

<a href ui-sref="app.case.tasks-item({caseId: value.extraData.case._id, itemId:value._id})" ng-class="{'text-danger': !!value.extraData.actionRequired}">
<span ng-if="!!value.extraData.actionRequired" class="text-danger noline mr-xxxs" uib-tooltip="Action Required" tooltip-placement="left-middle">
<i class="fa fa-exclamation-triangle"></i>
</span>
{{value.title}}
</a>
</div>
<div ng-show="value.status === 'InProgress'" class="text-warning">
Started <em am-time-ago="value.startDate"></em>
</div>
<div>
<small><entity-link value="value.extraData.case"></entity-link></small>
</div>
</td>
<td>
{{value.startDate | shortDate}}
</td>
</tr>
</tbody>
<a href ui-sref="app.case.tasks-item({caseId: item.extraData.case._id, itemId:item._id})" ng-class="{'text-danger': !!item.extraData.actionRequired}">
<span ng-if="!!item.extraData.actionRequired" class="text-danger noline mr-xxxs" uib-tooltip="Action Required" tooltip-placement="left-middle">
<i class="fa fa-exclamation-triangle"></i>
</span>
{{item.title}}
</a>
</div>
<div ng-show="item.status === 'InProgress'" class="text-warning">
Started <em am-time-ago="item.startDate"></em>
</div>
<div>
<small><entity-link value="item.extraData.case"></entity-link></small>
</div>
</td>
<td>
{{item.startDate | shortDate}}
</td>
</tr>
</tbody>

</table>

Expand Down
20 changes: 12 additions & 8 deletions frontend/app/views/partials/main/index-waitingtasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<table class="table table-striped table-hover" ng-show="$vm.list.total > 0">
<thead>
<tr>
<th width="70px"></th>
<th class="text-center" style="width: 60px;">Severity</th>
<th width="200px;">Group</th>
<th>Task</th>
Expand All @@ -14,26 +15,29 @@

<tbody>
<tr class="task-row"
ng-repeat="value in $vm.list.values">
ng-repeat="item in $vm.list.values">
<td>
<task-flags task="item" inline="true"></task-flags>
</td>
<td class="text-center">
<severity active="false" value="value.extraData.case.severity"></severity>
<severity active="false" value="item.extraData.case.severity"></severity>
</td>
<td>{{value.group}}</td>
<td>{{item.group}}</td>
<td>
<div>
<span class="text-primary mr-xxxs" ng-if="value.flag">
<span class="text-primary mr-xxxs" ng-if="item.flag">
<i class="glyphicon glyphicon-flag"></i>
</span>

<a href ui-sref="app.case.tasks-item({caseId: value.extraData.case._id, itemId:value._id})" ng-class="{'text-danger': !!value.extraData.actionRequired}">
<span ng-if="!!value.extraData.actionRequired" class="text-danger noline mr-xxxs" uib-tooltip="Action Required" tooltip-placement="left-middle">
<a href ui-sref="app.case.tasks-item({caseId: item.extraData.case._id, itemId:item._id})" ng-class="{'text-danger': !!item.extraData.actionRequired}">
<span ng-if="!!item.extraData.actionRequired" class="text-danger noline mr-xxxs" uib-tooltip="Action Required" tooltip-placement="left-middle">
<i class="fa fa-exclamation-triangle"></i>
</span>
{{value.title}}
{{item.title}}
</a>
</div>
<div>
<small><entity-link value="value.extraData.case"></entity-link></small>
<small><entity-link value="item.extraData.case"></entity-link></small>
</div>
</td>
<td>
Expand Down

0 comments on commit 4ad7589

Please sign in to comment.