diff --git a/frontend/app/index.html b/frontend/app/index.html index d3d1b3c24b..35e7900ca0 100644 --- a/frontend/app/index.html +++ b/frontend/app/index.html @@ -142,6 +142,7 @@ + diff --git a/frontend/app/scripts/components/common/task-flags.component.js b/frontend/app/scripts/components/common/task-flags.component.js new file mode 100644 index 0000000000..f075df2575 --- /dev/null +++ b/frontend/app/scripts/components/common/task-flags.component.js @@ -0,0 +1,22 @@ +(function() { + 'use strict'; + + angular.module('theHiveComponents') + .component('taskFlags', { + controller: function() { + this.filterBy = function(fieldName, newValue) { + this.onFilter({ + fieldName: fieldName, + value: newValue + }); + }; + }, + controllerAs: '$ctrl', + templateUrl: 'views/components/common/task-flags.component.html', + bindings: { + task: '<', + inline: '<', + onFilter: '&' + } + }); +})(); diff --git a/frontend/app/scripts/controllers/case/CaseTasksCtrl.js b/frontend/app/scripts/controllers/case/CaseTasksCtrl.js index 7618d83dfc..f9140f7abc 100755 --- a/frontend/app/scripts/controllers/case/CaseTasksCtrl.js +++ b/frontend/app/scripts/controllers/case/CaseTasksCtrl.js @@ -98,6 +98,18 @@ $scope.menu.unflag = temp.length === 1 && temp[0] === true; $scope.menu.flag = temp.length === 1 && temp[0] === false; + // Handle start menu item + temp = _.uniq(_.pluck($scope.selection, 'status')); + $scope.menu.start = temp.length === 1 && temp[0] === 'Waiting'; + + // Handle close menu item + temp = _.uniq(_.pluck($scope.selection, 'status')); + $scope.menu.close = temp.indexOf('Completed') === -1; + + // Handle reopen menu item + 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'; @@ -278,18 +290,28 @@ }); }; - $scope.bulkFlag = function(flag) { - var ids = _.pluck($scope.selection, '_id'); - - return CaseTaskSrv.bulkUpdate(ids, {flag: flag}) + $scope.bulkUpdate = function(ids, patch) { + return CaseTaskSrv.bulkUpdate(ids, patch) .then(function(/*responses*/) { NotificationSrv.log('Selected tasks have been updated successfully', 'success'); }) .catch(function(err) { - NotificationSrv.error('Bulk flag tasks', err.data, err.status); + NotificationSrv.error('Bulk update tasks', err.data, err.status); }); } + $scope.bulkFlag = function(flag) { + var ids = _.pluck($scope.selection, '_id'); + + return $scope.bulkUpdate(ids, {flag: flag}); + } + + $scope.bulkStatus = function(status) { + var ids = _.pluck($scope.selection, '_id'); + + return $scope.bulkUpdate(ids, {status: status}); + } + // open task tab with its details $scope.startTask = function(task) { var taskId = task._id; diff --git a/frontend/app/styles/main.css b/frontend/app/styles/main.css index 0966ce592f..60388c9b10 100644 --- a/frontend/app/styles/main.css +++ b/frontend/app/styles/main.css @@ -737,6 +737,7 @@ table tr td.task-actions span.action-button { /*background: rgba(0,0,0,0.2) !important;*/ } +.task-flags.inline div, .observable-flags.inline div { display: inline; } diff --git a/frontend/app/views/components/common/task-flags.component.html b/frontend/app/views/components/common/task-flags.component.html new file mode 100644 index 0000000000..7e1afefc11 --- /dev/null +++ b/frontend/app/views/components/common/task-flags.component.html @@ -0,0 +1,30 @@ +
- | - | + | Group | Task | Date | Assignee | -Actions | +Actions | ||
---|---|---|---|---|---|---|---|---|---|---|
- | - - - - |
-
-
-
+ |
{{task.group}} |
- | - - - Delete - - - - - - - - - + + + + + + + + + + + + + + + | - | - | + | Group | Task | Date | Assignee | -Actions | +Actions | -
- | - - - - | +
-
+ |
|
+
+
+
@@ -288,12 +276,12 @@
- + - + diff --git a/frontend/app/views/partials/case/tasks/toolbar.html b/frontend/app/views/partials/case/tasks/toolbar.html index ad5cd717c0..7e3628d0c4 100644 --- a/frontend/app/views/partials/case/tasks/toolbar.html +++ b/frontend/app/views/partials/case/tasks/toolbar.html @@ -14,15 +14,18 @@ |