Skip to content

Commit

Permalink
Minor tp bugfixes
Browse files Browse the repository at this point in the history
Updated based on review comment as well as removed deleteServerCapability button(DS table) and menu-option(right click)
Updated TP field names based on TO changes from ATC PRs #7806, #7718
Updated TP field name (cdn) in server capability and updated changelog
Updated broken links in DS's right click menu
  • Loading branch information
rimashah25 committed Jan 3, 2024
1 parent 608c78e commit 0f6e475
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 110 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7814](https://github.com/apache/trafficcontrol/issues/7814) All Go components: Updated the module path to [`github.com/apache/trafficcontrol/v8`](https://pkg.go.dev/github.com/apache/trafficcontrol/v8). Module https://pkg.go.dev/github.com/apache/trafficcontrol will not receive further updates.

### Fixed
- [#7879](https://github.com/comcast-cdn/trafficcontrol/pull/7879) *Traffic Ops, Traffic Portal*: Fixed broken capability links for delivery service and added required capability as a column in DS table.
- [#7878](https://github.com/apache/trafficcontrol/pull/7878) *Traffic Ops, Traffic Portal*: Fixed the case where TO was failing to assign delivery services to a server, due to a bug in the way the list of preexisting delivery services was being returned.
- [#7819](https://github.com/apache/trafficcontrol/pull/7819) *Traffic Ops*: API v5 routes should not use `privLevel` comparisons.
- [#7802](https://github.com/apache/trafficcontrol/pull/7802) *Traffic Control Health Client*: Fixed ReadMe.md typos and duplicates.
Expand Down
76 changes: 39 additions & 37 deletions docs/source/api/v5/deliveryservices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,45 @@ Request Structure
-----------------
.. table:: Request Query Parameters

+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Name | Required | Description |
+===================+==========+=========================================================================================================================================+
| cdn | no | Show only the :term:`Delivery Services` belonging to the :ref:`ds-cdn` identified by this integral, unique identifier |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| id | no | Show only the :term:`Delivery Service` that has this integral, unique identifier |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| logsEnabled | no | Show only the :term:`Delivery Services` that have :ref:`ds-logs-enabled` set or not based on this boolean |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| profile | no | Return only :term:`Delivery Services` using the :term:`Profile` that has this :ref:`profile-id` |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| tenant | no | Show only the :term:`Delivery Services` belonging to the :term:`Tenant` identified by this integral, unique identifier |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| topology | no | Show only the :term:`Delivery Services` assigned to the :term:`Topology` identified by this unique name |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| type | no | Return only :term:`Delivery Services` of the :term:`Delivery Service` :ref:`ds-types` identified by this integral, unique identifier |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| accessibleTo | no | Return the :term:`Delivery Services` accessible from a :term:`Tenant` *or it's children* identified by this integral, unique identifier |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| serviceCategory | no | Show only the :term:`Delivery Services` belonging to the :term:`Service Category` that has this name |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| xmlId | no | Show only the :term:`Delivery Service` that has this text-based, unique identifier |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| orderby | no | Choose the ordering of the results - must be the name of one of the fields of the objects in the ``response`` |
| | | array |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| sortOrder | no | Changes the order of sorting. Either ascending (default or "asc") or descending ("desc") |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| limit | no | Choose the maximum number of results to return |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| offset | no | The number of results to skip before beginning to return results. Must use in conjunction with limit |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| page | no | Return the n\ :sup:`th` page of results, where "n" is the value of this parameter, pages are ``limit`` long and the first page is 1. |
| | | If ``offset`` was defined, this query parameter has no effect. ``limit`` must be defined to make use of ``page``. |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| active | no | Show only the :term:`Delivery Services` that have :ref:`ds-active` set or not based on this boolean (whether or not they are active) |
+-------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Name | Required | Description |
+=======================+==========+=========================================================================================================================================+
| cdn | no | Show only the :term:`Delivery Services` belonging to the :ref:`ds-cdn` identified by this integral, unique identifier |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| id | no | Show only the :term:`Delivery Service` that has this integral, unique identifier |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| logsEnabled | no | Show only the :term:`Delivery Services` that have :ref:`ds-logs-enabled` set or not based on this boolean |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| profile | no | Return only :term:`Delivery Services` using the :term:`Profile` that has this :ref:`profile-id` |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| tenant | no | Show only the :term:`Delivery Services` belonging to the :term:`Tenant` identified by this integral, unique identifier |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| topology | no | Show only the :term:`Delivery Services` assigned to the :term:`Topology` identified by this unique name |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| type | no | Return only :term:`Delivery Services` of the :term:`Delivery Service` :ref:`ds-types` identified by this integral, unique identifier |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| accessibleTo | no | Return the :term:`Delivery Services` accessible from a :term:`Tenant` *or it's children* identified by this integral, unique identifier |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| serviceCategory | no | Show only the :term:`Delivery Services` belonging to the :term:`Service Category` that has this name |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| requiredCapability | no | Return the :term:`Delivery Services` belonging to the :term:`Server Capability` identified by this unique name |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| xmlId | no | Show only the :term:`Delivery Service` that has this text-based, unique identifier |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| orderby | no | Choose the ordering of the results - must be the name of one of the fields of the objects in the ``response`` |
| | | array |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| sortOrder | no | Changes the order of sorting. Either ascending (default or "asc") or descending ("desc") |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| limit | no | Choose the maximum number of results to return |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| offset | no | The number of results to skip before beginning to return results. Must use in conjunction with limit |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| page | no | Return the n\ :sup:`th` page of results, where "n" is the value of this parameter, pages are ``limit`` long and the first page is 1. |
| | | If ``offset`` was defined, this query parameter has no effect. ``limit`` must be defined to make use of ``page``. |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+
| active | no | Show only the :term:`Delivery Services` that have :ref:`ds-active` set or not based on this boolean (whether or not they are active) |
+-----------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+

.. code-block:: http
:caption: Request Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1443,10 +1443,10 @@ func readGetDeliveryServices(h http.Header, params map[string]string, tx *sqlx.T
"profile": {Column: "ds.profile", Checker: api.IsInt},
"type": {Column: "ds.type", Checker: api.IsInt},
"logsEnabled": {Column: "ds.logs_enabled", Checker: api.IsBool},
"tenant": {Column: "ds.tenant_id", Checker: api.IsInt},
"signingAlgorithm": {Column: "ds.signing_algorithm"},
"topology": {Column: "ds.topology"},
"serviceCategory": {Column: "ds.service_category"},
"tenant": {Column: "ds.tenant_id", Checker: api.IsInt},
"topology": {Column: "ds.topology"},
}

where, orderBy, pagination, queryValues, errs := dbhelpers.BuildWhereAndOrderByAndPagination(params, queryParamsToSQLCols)
Expand Down Expand Up @@ -1491,6 +1491,11 @@ func readGetDeliveryServices(h http.Header, params map[string]string, tx *sqlx.T
where += " AND ds.tenant_id = ANY(CAST(:accessibleTo AS bigint[])) "
queryValues["accessibleTo"] = pq.Array(accessibleTenants)
}

if reqCap, ok := params["requiredCapability"]; ok {
where += " AND '" + reqCap + "'=ANY(ds.required_capabilities)"
}

query := SelectDeliveryServicesQuery + where + orderBy + pagination
log.Debugln("generated deliveryServices query: " + query)
log.Debugf("executing with values: %++v\n", queryValues)
Expand Down
24 changes: 3 additions & 21 deletions traffic_portal/app/src/common/api/DeliveryServiceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @property {string[]} [exampleURLs]
* @property {number} [id]
* @property {string} [lastUpdated]
* @property {string[]} requiredCapabilities
* @property {string} routingName
* @property {boolean} signed
* @property {null|number} [sslKeyVersion]
Expand Down Expand Up @@ -157,10 +158,10 @@ class DeliveryServiceService {
* Gets the server capabilities required by the identified Delivery Service.
*
* @param {number} deliveryServiceID The ID of the Delivery Service in question.
* @returns {Promise<DSRequiredCapability[]>} The Server Capabilities required by the DS with the given ID.
* @returns {Promise<DeliveryService[]>} The Server Capabilities required by the DS with the given ID.
*/
async getServerCapabilities(deliveryServiceID) {
const result = await this.$http.get(`${this.ENV.api.unstable}deliveryservices_required_capabilities`, { params: { deliveryServiceID } });
const result = await this.$http.get(`${this.ENV.api.unstable}deliveryservices`, { params: { deliveryServiceID } });
return result.data.response;
};

Expand Down Expand Up @@ -191,25 +192,6 @@ class DeliveryServiceService {
}
}

/**
* Removes the requirement of a particular Capability from the identified Delivery Service.
*
* @param {number} deliveryServiceID The ID of the Delivery Service from which a Capability requirement will be removed.
* @param {string} requiredCapability The name of the Capability being removed as a requirement.
* @returns {Promise<{alerts: {text: string; level: string}[]}>} The full API response.
*/
async removeServerCapability(deliveryServiceID, requiredCapability) {
try {
const result = await this.$http.delete(`${this.ENV.api.unstable}deliveryservices_required_capabilities`, { params: { deliveryServiceID, requiredCapability } });
return result.data;
} catch (err) {
if (err.data && err.data.alerts) {
this.messageModel.setMessages(err.data.alerts, false);
}
throw err;
}
}

/**
* Get the Delivery Service for which the identified server is responsible for serving content.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var ServerCapabilityService = function($http, ENV, locationUtils, messageModel)
};

this.getServerCapabilityDeliveryServices = function(capabilityName) {
return $http.get(ENV.api.unstable + 'deliveryservices_required_capabilities', { params: { requiredCapability: capabilityName } }).then(
return $http.get(ENV.api.unstable + 'deliveryservices', { params: { requiredCapability: capabilityName } }).then(
function (result) {
return result.data.response;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<td data-search="^{{::fed.cname}}$">{{::fed.cname}}</td>
<td data-search="^{{::fed.ttl}}$">{{::fed.ttl}}</td>
<td data-search="^{{::fed.description}}$">{{::fed.description}}</td>
<td data-search="^{{::fed.deliveryService.xmlId}}$">{{::fed.deliveryService.xmlId}}</td>
<td data-search="^{{::fed.deliveryService.xmlID}}$">{{::fed.deliveryService.xmlID}}</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ function TableDeliveryServicesController(tableName, deliveryServices, steeringTa
field: "remapText",
hide: true
},
{
headerName: "Required Capability(ies)",
field: "requiredCapabilities",
hide: true
},
{
headerName: "Routing Name",
field: "routingName",
Expand Down Expand Up @@ -652,14 +657,14 @@ function TableDeliveryServicesController(tableName, deliveryServices, steeringTa

$scope.contextMenuOptions = [
{
getHref: ds => `/delivery-services/${ds.id}?dsType=${ds.type}`,
getHref: ds => `#!/delivery-services/${ds.id}?dsType=${ds.type}`,
getText: ds => `Open ${ds.xmlId} in a new tab`,
newTab: true,
type: 2
},
{type: 0},
{
getHref: ds => `/delivery-services/${ds.id}?dsType=${ds.type}`,
getHref: ds => `#!/delivery-services/${ds.id}?dsType=${ds.type}`,
text: "Edit",
type: 2
},
Expand Down
Loading

0 comments on commit 0f6e475

Please sign in to comment.