ocket8888 commented on code in PR #7036:
URL: https://github.com/apache/trafficcontrol/pull/7036#discussion_r961021870
##########
experimental/traffic-portal/src/app/api/delivery-service.service.ts:
##########
@@ -158,6 +159,16 @@ export class DeliveryServiceService extends APIService {
this.deliveryServiceTypes = new Array<Type>();
}
+ /**
+ * Gets a list of all Steering Configurations
+ *
+ * @returns An array of Steering Configurations
+ */
+ public async getSteering(): Promise<Array<SteeringConfiguration>> {
+ const path = "steering";
+ return this.get<[SteeringConfiguration]>(path).toPromise();
Review Comment:
This type argument is mismatched with the return type. Either it should be
an array of ambiguous length, or the return type should be a tuple of length 1.
##########
traffic_portal/app/src/common/api/DeliveryServiceService.js:
##########
@@ -92,6 +92,17 @@ var DeliveryServiceService = function($http, locationUtils,
messageModel, ENV) {
)
};
+ this.getSteering = function() {
+ return $http.get(`${ENV.api.unstable}steering/`).then(
+ function(result) {
+ return result.data.response;
+ },
+ function (err) {
+ throw err;
+ }
+ )
+ }
+
Review Comment:
because an error handler that does nothing but throw its argument is
equivalent to default behavior, this statement can be written thusly on one
line:
```javascript
this.getSteering = () =>
$http.get(`${ENV.api.unstable}steering/`).then(r=>r.data.response);
```
It doesn't need to be on one line or anything, but using arrow functions
allows eliminating a lot of boilerplate, and the error "handler" can be omitted
entirely.
##########
traffic_portal/app/src/common/service/utils/DeliveryServiceUtils.js:
##########
@@ -17,45 +17,61 @@
* under the License.
*/
-var DeliveryServiceUtils = function($window, propertiesModel) {
-
- this.protocols = {
- 0: "HTTP",
- 1: "HTTPS",
- 2: "HTTP AND HTTPS",
- 3: "HTTP TO HTTPS"
- };
-
- this.qstrings = {
- 0: "USE",
- 1: "IGNORE",
- 2: "DROP"
- };
-
- this.geoProviders = {
- 0: "MaxMind",
- 1: "Neustar"
- };
-
- this.geoLimits = {
- 0: "None",
- 1: "CZF Only",
- 2: "CZF + Country Code(s)",
- };
-
- this.rrhs = {
- 0: "no cache",
- 1: "background_fetch",
- 2: "cache_range_requests",
- 3: "slice"
- };
-
- this.openCharts = function(ds) {
- $window.open(
-
propertiesModel.properties.deliveryServices.charts.customLink.baseUrl +
ds.xmlId,
- '_blank'
- );
- };
+var DeliveryServiceUtils = function ($window, propertiesModel) {
+
+ this.protocols = {
+ 0: "HTTP",
+ 1: "HTTPS",
+ 2: "HTTP AND HTTPS",
+ 3: "HTTP TO HTTPS"
+ };
+
+ this.qstrings = {
+ 0: "USE",
+ 1: "IGNORE",
+ 2: "DROP"
+ };
+
+ this.geoProviders = {
+ 0: "MaxMind",
+ 1: "Neustar"
+ };
+
+ this.geoLimits = {
+ 0: "None",
+ 1: "CZF Only",
+ 2: "CZF + Country Code(s)",
+ };
+
+ this.rrhs = {
+ 0: "no cache",
+ 1: "background_fetch",
+ 2: "cache_range_requests",
+ 3: "slice"
Review Comment:
these whitespace changes are as evil as they are unnecessary. Just use tabs
when adding to a file that uses real indentation.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]