You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/04/15 20:18:15 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5740: TP changes to support new api/4.x DSR changes

ocket8888 commented on a change in pull request #5740:
URL: https://github.com/apache/trafficcontrol/pull/5740#discussion_r614352511



##########
File path: traffic_portal/app/src/common/api/DeliveryServiceRequestService.js
##########
@@ -33,9 +33,11 @@ var DeliveryServiceRequestService = function($http, locationUtils, messageModel,
 	this.createDeliveryServiceRequest = function(dsRequest) {
 
 		// strip out any falsy values or duplicates from consistentHashQueryParams
-		dsRequest.deliveryService.consistentHashQueryParams = Array.from(new Set(dsRequest.deliveryService.consistentHashQueryParams)).filter(function(i){return i;});
+		if (dsRequest.requested) {
+			dsRequest.requested.consistentHashQueryParams = Array.from(new Set(dsRequest.requested.consistentHashQueryParams)).filter(function(i){return i;});

Review comment:
       What does this filter do?

##########
File path: traffic_portal/app/src/common/modules/form/deliveryService/new/FormNewDeliveryServiceController.js
##########
@@ -45,7 +45,8 @@ var FormNewDeliveryServiceController = function(deliveryService, origin, topolog
 						then(
 							function() {
 								if (!autoFulfilled) {
-									messageModel.setMessages([ { level: 'success', text: 'Created request to ' + dsRequest.changeType + ' the ' + dsRequest.deliveryService.xmlId + ' delivery service' } ], true);
+									let xmlId = (dsRequest.requested) ? dsRequest.requested.xmlId : dsRequest.original.xmlId;

Review comment:
       `xmlId` is never reassigned, could be `const`

##########
File path: traffic_portal/app/src/common/modules/form/deliveryService/edit/FormEditDeliveryServiceController.js
##########
@@ -140,7 +141,8 @@ var FormEditDeliveryServiceController = function(deliveryService, origin, topolo
 						then(
 							function() {
 								if (!autoFulfilled) {
-									messageModel.setMessages([ { level: 'success', text: 'Created request to ' + dsRequest.changeType + ' the ' + dsRequest.deliveryService.xmlId + ' delivery service' } ], true);
+									let xmlId = (dsRequest.requested) ? dsRequest.requested.xmlId : dsRequest.original.xmlId;

Review comment:
       `xmlId` is never reassigned, could be `const`

##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceRequests/TableDeliveryServiceRequestsController.js
##########
@@ -529,8 +539,11 @@ var TableDeliveryServicesRequestsController = function (tableName, dsRequests, $
 
 	$scope.fulfillRequest = function (request, $event) {
 		$event.stopPropagation(); // this kills the click event so it doesn't trigger anything else
-		var path = '/delivery-service-requests/' + request.id + '?type=';
-		typeService.getType(request.deliveryService.typeId)
+
+		let path = '/delivery-service-requests/' + request.id + '?type=',
+			typeId = (request.requested) ? request.requested.typeId : request.original.typeId;
+

Review comment:
       same as above RE typeId and one declaration at a time

##########
File path: traffic_portal/app/src/common/modules/table/deliveryServices/TableDeliveryServicesController.js
##########
@@ -560,7 +560,8 @@ var TableDeliveryServicesController = function(tableName, deliveryServices, filt
                             deliveryServiceRequestService.createDeliveryServiceRequestComment(comment).
                                 then(
                                     function() {
-                                        messageModel.setMessages([ { level: 'success', text: 'Created request to ' + dsRequest.changeType + ' the ' + dsRequest.deliveryService.xmlId + ' delivery service' } ], true);
+                                        let xmlId = (dsRequest.requested) ? dsRequest.requested.xmlId : dsRequest.original.xmlId;

Review comment:
       `xmlId` is never reassigned, could be `const`

##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceRequests/TableDeliveryServiceRequestsController.js
##########
@@ -503,9 +512,10 @@ var TableDeliveryServicesRequestsController = function (tableName, dsRequests, $
 
 	$scope.deleteRequest = function (request, $event) {
 		$event.stopPropagation(); // this kills the click event so it doesn't trigger anything else
+		let xmlId = (request.requested) ? request.requested.xmlId : request.original.xmlId;

Review comment:
       `xmlId` is never reassigned, could be `const`

##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceRequests/TableDeliveryServiceRequestsController.js
##########
@@ -136,12 +142,15 @@ var TableDeliveryServicesRequestsController = function (tableName, dsRequests, $
 		onRowClicked: function(params) {
 			const selection = window.getSelection().toString();
 			if(selection === "" || selection === $scope.mouseDownSelectionText) {
-				let path = '/delivery-service-requests/' + params.data.id + '?type=';
-				typeService.getType(params.data.deliveryService.typeId)
+				let path = '/delivery-service-requests/' + params.data.id + '?type=',
+					typeId = (params.data.requested) ? params.data.requested.typeId : params.data.original.typeId;

Review comment:
       `typeId` is never reassigned, could be `const` - also one declaration at a time is easier to read

##########
File path: traffic_portal/app/src/common/modules/form/deliveryService/edit/FormEditDeliveryServiceController.js
##########
@@ -114,7 +114,8 @@ var FormEditDeliveryServiceController = function(deliveryService, origin, topolo
 							deliveryServiceRequestService.createDeliveryServiceRequestComment(comment).
 								then(
 									function() {
-										messageModel.setMessages([ { level: 'success', text: 'Created request to ' + dsRequest.changeType + ' the ' + dsRequest.deliveryService.xmlId + ' delivery service' } ], true);
+										let xmlId = (dsRequest.requested) ? dsRequest.requested.xmlId : dsRequest.original.xmlId;

Review comment:
       `xmlId` is never reassigned, could be `const`

##########
File path: traffic_portal/app/src/modules/private/deliveryServiceRequests/edit/FormEditDeliveryServiceRequestController.js
##########
@@ -167,7 +176,7 @@ var FormEditDeliveryServiceRequestController = function(deliveryServiceRequest,
 					deliveryServiceService.deleteDeliveryService(ds).
 						then(
 							function() {
-								let promises = updateDeliveryServiceRequest(); // after a successful delete, update the ds request, assignee and status and navigate to ds requests page
+								let promises = updateDeliveryServiceRequest('pending'); // after a successful delete, update the ds request, assignee and status and navigate to ds requests page

Review comment:
       `promises` is never reassigned, could be `const`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org