diff --git a/traffic_ops/testing/api/v3/servers_to_deliveryservice_assignment_test.go b/traffic_ops/testing/api/v3/servers_to_deliveryservice_assignment_test.go index 29452291de..65d657595d 100644 --- a/traffic_ops/testing/api/v3/servers_to_deliveryservice_assignment_test.go +++ b/traffic_ops/testing/api/v3/servers_to_deliveryservice_assignment_test.go @@ -192,11 +192,11 @@ func AssignTopologyBasedDeliveryService(t *testing.T) { t.Fatal("Fetch DS information returned unknown ID") } alerts, reqInf, err := TOSession.AssignDeliveryServiceIDsToServerID(*server.ID, []int{*firstDS.ID}, false) - if err == nil { - t.Errorf("Expected bad assignment to fail, but it didn't! (alerts: %v)", alerts) + if err != nil { + t.Errorf("Expected assignment to succeed, but it didn't! (alerts: %v)", alerts) } - if reqInf.StatusCode < http.StatusBadRequest || reqInf.StatusCode >= http.StatusInternalServerError { - t.Fatalf("assigning Topology-based delivery service to server - expected: 400-level status code, actual: %d", reqInf.StatusCode) + if reqInf.StatusCode >= http.StatusBadRequest { + t.Fatalf("assigning Topology-based delivery service to server - expected: non-error status code, actual: %d", reqInf.StatusCode) } response, _, err := TOSession.GetServerIDDeliveryServices(*server.ID, nil) @@ -214,7 +214,7 @@ func AssignTopologyBasedDeliveryService(t *testing.T) { } } - if found { - t.Errorf(`Invalid Server/DS assignment was created!`) + if !found { + t.Errorf(`Valid Server/DS assignment was not created!`) } } diff --git a/traffic_ops/traffic_ops_golang/server/servers_assignment.go b/traffic_ops/traffic_ops_golang/server/servers_assignment.go index 53b1bf908b..8cfec3a5f6 100644 --- a/traffic_ops/traffic_ops_golang/server/servers_assignment.go +++ b/traffic_ops/traffic_ops_golang/server/servers_assignment.go @@ -96,15 +96,6 @@ func AssignDeliveryServicesToServerHandler(w http.ResponseWriter, r *http.Reques api.HandleErr(w, r, inf.Tx.Tx, status, usrErr, sysErr) return } - dses, sysErr := dbhelpers.GetDeliveryServicesWithTopologies(inf.Tx.Tx, dsList) - if sysErr != nil { - api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, sysErr) - return - } - if len(dses) > 0 { - api.HandleErr(w, r, inf.Tx.Tx, http.StatusBadRequest, fmt.Errorf("delivery services %v are already assigned to a topology", dses), nil) - return - } } // We already know the CDN exists because that's part of the serverInfo query above diff --git a/traffic_portal/app/src/common/modules/table/serverDeliveryServices/TableAssignDeliveryServicesController.js b/traffic_portal/app/src/common/modules/table/serverDeliveryServices/TableAssignDeliveryServicesController.js index fb3674c4e1..83c0821753 100644 --- a/traffic_portal/app/src/common/modules/table/serverDeliveryServices/TableAssignDeliveryServicesController.js +++ b/traffic_portal/app/src/common/modules/table/serverDeliveryServices/TableAssignDeliveryServicesController.js @@ -35,6 +35,9 @@ var TableAssignDeliveryServicesController = function(server, deliveryServices, a return parseInt($(this).attr('id')); }).get(); $scope.selectedDeliveryServices = _.map(deliveryServices, function(ds) { + if (ds.topology) { + return ds; + } if (visibleDSIds.includes(ds.id)) { ds['selected'] = selected; } diff --git a/traffic_portal/app/src/common/modules/table/serverDeliveryServices/table.assignDeliveryServices.tpl.html b/traffic_portal/app/src/common/modules/table/serverDeliveryServices/table.assignDeliveryServices.tpl.html index 7debe555b7..b532f4b1e3 100644 --- a/traffic_portal/app/src/common/modules/table/serverDeliveryServices/table.assignDeliveryServices.tpl.html +++ b/traffic_portal/app/src/common/modules/table/serverDeliveryServices/table.assignDeliveryServices.tpl.html @@ -33,7 +33,7 @@ - + {{::ds.xmlId}} {{::ds.displayName}} {{::ds.type}}