This is an automated email from the ASF dual-hosted git repository.
ocket8888 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 4194794dce Fixed DSR difference for DS required capability (#7414)
4194794dce is described below
commit 4194794dce2d250a6cb732687c3f1a9c2e7ec825
Author: Rima Shah <[email protected]>
AuthorDate: Mon Mar 20 14:18:19 2023 -0600
Fixed DSR difference for DS required capability (#7414)
* Compare two arrays and return appropriate boolean value to show current
value box in DSRs.
* Updated changelog
* Update based on review comment.
---
CHANGELOG.md | 1 +
.../deliveryService/FormDeliveryServiceController.js | 19 +++++++++++++++++++
.../deliveryService/form.deliveryService.DNS.tpl.html | 2 +-
.../form.deliveryService.HTTP.tpl.html | 2 +-
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 05d6a31ef1..46f5bb195e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -51,6 +51,7 @@ The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7386](https://github.com/apache/trafficcontrol/pull/7386) *Traffic Portal*
Increased the number of events that are logged to the TP access log.
### Fixed
+- [#7414](https://github.com/apache/trafficcontrol/pull/7414) * Traffic
Portal* Fixed DSR difference for DS required capability.
- [#7130](https://github.com/apache/trafficcontrol/issues/7130) *Traffic Ops*
Fixes service_categories response to POST API.
- [#7340](https://github.com/apache/trafficcontrol/pull/7340) *Traffic Router*
Fixed TR logging for the `cqhv` field when absent.
- [#5557](https://github.com/apache/trafficcontrol/issues/5557) *Traffic
Portal* Moved `Fair Queueing Pacing Rate Bps` DS field to `Cache Configuration
Settings` section.
diff --git
a/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
b/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
index 8f23f9ce75..fd9c007685 100644
---
a/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
+++
b/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
@@ -113,6 +113,25 @@ var FormDeliveryServiceController =
function(deliveryService, dsCurrent, origin,
deliveryService.tlsVersions?.splice(index+1, 0, "");
};
+ /** Compare Arrays
+ *
+ * @template T extends number[] | boolean[] | bigint[] | string[]
+ *
+ * @param {T} a
+ * @param {T} b
+ * @returns `false` if the arrays are equal, `true` otherwise.
+ */
+ function arrayCompare (a, b) {
+ if (a === b) return false;
+ if (a.length !== b.length) return true;
+
+ for (let i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) return true;
+ }
+ return false;
+ };
+ $scope.arrayCompare = arrayCompare;
+
/**
* This function is called on 'change' events for any and all TLS
Version
* inputs, and sets validity states of duplicates.
diff --git
a/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
b/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
index de155f2fc5..256c7e5bc7 100644
---
a/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
+++
b/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
@@ -365,7 +365,7 @@ under the License.
<a
ng-href="/#!/server-capabilities/edit?name={{capability.name}}"
target="_blank"> {{capability.name}}</a>
</div>
</div>
- <aside class="current-value"
ng-if="settings.isRequest" ng-show="deliveryService.requiredCapabilities !==
dsCurrent.requiredCapabilities">
+ <aside class="current-value"
ng-if="settings.isRequest"
ng-show="{{arrayCompare(deliveryService.requiredCapabilities,
dsCurrent.requiredCapabilities)}}">
<h3 ng-if="open()">Current Value</h3>
<h3 ng-if="!open()">Previous Value</h3>
<pre>{{::dsCurrent.requiredCapabilities}}</pre>
diff --git
a/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.HTTP.tpl.html
b/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.HTTP.tpl.html
index 37f76dc19e..4ff551a41f 100644
---
a/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.HTTP.tpl.html
+++
b/traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.HTTP.tpl.html
@@ -365,7 +365,7 @@ under the License.
<a
ng-href="/#!/server-capabilities/edit?name={{capability.name}}"
target="_blank">{{capability.name}}</a>
</div>
</div>
- <aside class="current-value"
ng-if="settings.isRequest" ng-show="deliveryService.requiredCapabilities !==
dsCurrent.requiredCapabilities">
+ <aside class="current-value"
ng-if="settings.isRequest"
ng-show="{{arrayCompare(deliveryService.requiredCapabilities,
dsCurrent.requiredCapabilities)}}">
<h3 ng-if="open()">Current Value</h3>
<h3 ng-if="!open()">Previous Value</h3>
<pre>{{::dsCurrent.requiredCapabilities}}</pre>