From 1e0c2d4785f3eacc0aa62c80ef1582dc9730cb09 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Thu, 8 Jun 2017 08:46:02 +0000
Subject: [PATCH] Task #10898: unschedule error-tasks and observations as well

---
 .../static/app/controllers/gridcontroller.js  | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js
index 22ef3636b5a..67df0cd4d04 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js
+++ b/SAS/ResourceAssignment/ResourceAssignmentEditor/lib/static/app/controllers/gridcontroller.js
@@ -851,36 +851,36 @@ gridControllerMod.directive('contextMenu', ['$document', '$window', function($do
                 });
             }
 
-            var approved_selected_cep4_tasks = selected_cep4_tasks.filter(function(t) { return t.status == 'approved'; });
+            var schedulable_cep4_tasks = selected_cep4_tasks.filter(function(t) { return t.status == 'approved' || t.status == 'conflict' || t.status == 'error'; });
 
-            if(approved_selected_cep4_tasks.length > 0) {
-                var liContent = '<li><a href="#">Schedule approved CEP4 task(s)</a></li>'
+            if(schedulable_cep4_tasks.length > 0) {
+                var liContent = '<li><a href="#">Schedule CEP4 task(s)</a></li>'
                 var liElement = angular.element(liContent);
                 ulElement.append(liElement);
                 liElement.on('click', function() {
                     closeContextMenu();
-                    for(var pl of approved_selected_cep4_tasks) {
+                    for(var pl of schedulable_cep4_tasks) {
                         var newTask = { id: pl.id, status: 'prescheduled' };
                         dataService.putTask(newTask);
                     }
                 });
             }
 
-            var scheduled_selected_cep4_tasks = selected_cep4_tasks.filter(function(t) { return (t.status == 'prescheduled' || t.status == 'scheduled' || t.status == 'queued') });
+            var unschedulable_selected_cep4_tasks = selected_cep4_tasks.filter(function(t) { return t.status == 'prescheduled' || t.status == 'scheduled' || t.status == 'queued' || t.status == 'error'; });
 
-            if(scheduled_selected_cep4_tasks.length > 0) {
-                var liContent = '<li><a href="#">Unschedule (pre)scheduled/queued CEP4 tasks</a></li>'
+            if(unschedulable_selected_cep4_tasks.length > 0) {
+                var liContent = '<li><a href="#">Unschedule (pre)scheduled/queued/error tasks</a></li>'
                 var liElement = angular.element(liContent);
                 ulElement.append(liElement);
                 liElement.on('click', function() {
                     closeContextMenu();
-                    for(var t of scheduled_selected_cep4_tasks) {
-                        if(t.status == 'queued') {
-                            var newTask = { id: t.id, status: 'aborted' };
+                    for(var pl of unschedulable_selected_cep4_tasks) {
+                        if(pl.status == 'queued') {
+                            var newTask = { id: pl.id, status: 'aborted' };
                             dataService.putTask(newTask);
                         }
 
-                        var newTask = { id: t.id, status: 'approved' };
+                        var newTask = { id: pl.id, status: 'approved' };
                         dataService.putTask(newTask);
                     }
                 });
-- 
GitLab