You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ra...@apache.org on 2020/10/26 22:45:43 UTC

[trafficcontrol] branch 4.1.x updated: TP: do not mark DSR (ds request) complete if ds update fails due to validation error (#5198) (#5200)

This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch 4.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/4.1.x by this push:
     new 2dfe525  TP: do not mark DSR (ds request) complete if ds update fails due to validation error (#5198) (#5200)
2dfe525 is described below

commit 2dfe525e2a33200c30ebed1761842d886f6eac44
Author: Rawlin Peters <ra...@apache.org>
AuthorDate: Mon Oct 26 16:44:58 2020 -0600

    TP: do not mark DSR (ds request) complete if ds update fails due to validation error (#5198) (#5200)
    
    * do not mark dsr complete is ds update fails due to validation error
    
    * adds CHANGELOG.md entry
    
    * updates comment
    
    (cherry picked from commit eff7c18fd31d861e0a8e83781dacccb387b3dc05)
    
    Co-authored-by: Jeremy Mitchell <mi...@users.noreply.github.com>
---
 CHANGELOG.md                                            |  1 +
 .../edit/FormEditDeliveryServiceController.js           | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fae20d..ea22362 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - Added `--traffic_ops_insecure=<0|1>` optional option to traffic_ops_ort.pl
 
 ### Fixed
+- Fixed #5188 - DSR (delivery service request) incorrectly marked as complete and error message not displaying when DSR fulfilled and DS update fails in Traffic Portal. [Related Github issues](https://github.com/apache/trafficcontrol/issues/5188)
 - Fixed #5006 - Traffic Ops now generates the Monitoring on-the-fly if the snapshot doesn't exist, and logs an error. This fixes upgrading to 4.x to not break the CDN until a Snapshot is done.
 - Fixed #5074 - Traffic Monitor logging "CreateStats not adding availability data for server: not found in DeliveryServices" for MID cachces
 - Fixed an issue that causes Traffic Router to mistakenly route to caches that had recently been set from ADMIN_DOWN to OFFLINE
diff --git a/traffic_portal/app/src/common/modules/form/deliveryService/edit/FormEditDeliveryServiceController.js b/traffic_portal/app/src/common/modules/form/deliveryService/edit/FormEditDeliveryServiceController.js
index ec64d7d..81fa5e1 100644
--- a/traffic_portal/app/src/common/modules/form/deliveryService/edit/FormEditDeliveryServiceController.js
+++ b/traffic_portal/app/src/common/modules/form/deliveryService/edit/FormEditDeliveryServiceController.js
@@ -144,8 +144,8 @@ var FormEditDeliveryServiceController = function(deliveryService, origin, type,
 					if (autoFulfilled) {
 						// assign the ds request
 						promises.push(deliveryServiceRequestService.assignDeliveryServiceRequest(response.id, userModel.user.id));
-						// set the status to 'complete'
-						promises.push(deliveryServiceRequestService.updateDeliveryServiceRequestStatus(response.id, 'complete'));
+						// set the status to 'submitted'
+						promises.push(deliveryServiceRequestService.updateDeliveryServiceRequestStatus(response.id, 'submitted'));
 					}
 				}
 			);
@@ -205,13 +205,20 @@ var FormEditDeliveryServiceController = function(deliveryService, origin, type,
 							deliveryServiceService.updateDeliveryService(deliveryService).
 								then(
 									function() {
+										// upon successful update of ds, set the dsr to 'complete'
+										deliveryServiceRequestService.getDeliveryServiceRequests({ xmlId: deliveryService.xmlId, status: 'submitted' }).then(
+											function(response) {
+												deliveryServiceRequestService.updateDeliveryServiceRequestStatus(response[0].id, 'complete');
+											}
+										);
 										$state.reload(); // reloads all the resolves for the view
 										messageModel.setMessages([ { level: 'success', text: 'Delivery Service [ ' + deliveryService.xmlId + ' ] updated' } ], false);
 									}
 								).catch(function(fault) {
-									$anchorScroll(); // scrolls window to top
-									messageModel.setMessages(fault.data.alerts, false);
-								});
+									// if the ds update fails, send to dsr view w/ error message
+									locationUtils.navigateToPath('/delivery-service-requests');
+									messageModel.setMessages(fault.data.alerts, true);
+							});
 						}).catch(function(fault) {
 							$anchorScroll(); // scrolls window to top
 							messageModel.setMessages(fault.data.alerts, false);