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

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


The following commit(s) were added to refs/heads/master by this push:
     new 48d86f2  TP: empty / duplicate consistent hash query params for a ds 
need to be re… (#3662)
48d86f2 is described below

commit 48d86f218885fcdb2cef136997e59e701932611e
Author: Jeremy Mitchell <[email protected]>
AuthorDate: Mon Jun 10 10:22:17 2019 -0600

    TP: empty / duplicate consistent hash query params for a ds need to be re… 
(#3662)
    
    * empty / duplicate consistent hash query params for a ds need to be 
removed prior to ds request create update
    
    * gets rid of the use of the underscore method, _.compact
---
 traffic_portal/app/src/common/api/DeliveryServiceRequestService.js | 6 ++++++
 traffic_portal/app/src/common/api/DeliveryServiceService.js        | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/traffic_portal/app/src/common/api/DeliveryServiceRequestService.js 
b/traffic_portal/app/src/common/api/DeliveryServiceRequestService.js
index dd00ced..719de6a 100644
--- a/traffic_portal/app/src/common/api/DeliveryServiceRequestService.js
+++ b/traffic_portal/app/src/common/api/DeliveryServiceRequestService.js
@@ -26,6 +26,9 @@ var DeliveryServiceRequestService = function(Restangular, 
$http, $q, locationUti
        this.createDeliveryServiceRequest = function(dsRequest) {
                var request = $q.defer();
 
+               // strip out any falsy values or duplicates from 
consistentHashQueryParams
+               dsRequest.deliveryService.consistentHashQueryParams = 
Array.from(new 
Set(dsRequest.deliveryService.consistentHashQueryParams)).filter(function(i){return
 i;});
+
                $http.post(ENV.api['root'] + "deliveryservice_requests", 
dsRequest)
                        .then(
                                function(result) {
@@ -43,6 +46,9 @@ var DeliveryServiceRequestService = function(Restangular, 
$http, $q, locationUti
        this.updateDeliveryServiceRequest = function(id, dsRequest) {
                var request = $q.defer();
 
+               // strip out any falsy values or duplicates from 
consistentHashQueryParams
+               dsRequest.deliveryService.consistentHashQueryParams = 
Array.from(new 
Set(dsRequest.deliveryService.consistentHashQueryParams)).filter(function(i){return
 i;});
+
                $http.put(ENV.api['root'] + "deliveryservice_requests?id=" + 
id, dsRequest)
                        .then(
                                function() {
diff --git a/traffic_portal/app/src/common/api/DeliveryServiceService.js 
b/traffic_portal/app/src/common/api/DeliveryServiceService.js
index 93cd347..59152a9 100644
--- a/traffic_portal/app/src/common/api/DeliveryServiceService.js
+++ b/traffic_portal/app/src/common/api/DeliveryServiceService.js
@@ -31,7 +31,7 @@ var DeliveryServiceService = function(Restangular, $http, $q, 
locationUtils, htt
         var request = $q.defer();
 
         // strip out any falsy values or duplicates from 
consistentHashQueryParams
-        ds.consistentHashQueryParams = _.compact(Array.from(new 
Set(ds.consistentHashQueryParams)));
+        ds.consistentHashQueryParams = Array.from(new 
Set(ds.consistentHashQueryParams)).filter(function(i){return i;});
 
         $http.post(ENV.api['root'] + "deliveryservices", ds)
             .then(
@@ -50,7 +50,7 @@ var DeliveryServiceService = function(Restangular, $http, $q, 
locationUtils, htt
         var request = $q.defer();
 
         // strip out any falsy values or duplicates from 
consistentHashQueryParams
-        ds.consistentHashQueryParams = _.compact(Array.from(new 
Set(ds.consistentHashQueryParams)));
+        ds.consistentHashQueryParams = Array.from(new 
Set(ds.consistentHashQueryParams)).filter(function(i){return i;});
 
         $http.put(ENV.api['root'] + "deliveryservices/" + ds.id, ds)
             .then(

Reply via email to