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

rshah pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 1043c1905808ea4cb5229221769a7053424e9230
Author: Rima Shah <[email protected]>
AuthorDate: Tue Dec 19 13:52:57 2023 -0700

    Bugfix/compare profile page (#7885)
    
    * Fixed Compare Profiles Page Issue
    Fixed get profiles to return list of asscoaited parameters to a profile.
    
    * Updated changelog
    
    * using a defined constant instead of hard coded value
    
    (cherry picked from commit 83556e8de20ac01254261e0802ed785d1359a98a)
---
 CHANGELOG.md                                                      | 3 ++-
 traffic_ops/traffic_ops_golang/profile/profiles.go                | 8 ++++----
 traffic_portal/app/src/common/service/utils/CollectionUtils.js    | 2 ++
 .../app/src/modules/private/profiles/compare/diff/index.js        | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1ae721f51d..ab6cf89e24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -97,7 +97,8 @@ 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.
+- [#7885](https://github.com/apache/trafficcontrol/pull/7885) *Traffic Portal* 
Fixed the issue where Compare Profiles page was not being displayed.
+- [#7879](https://github.com/apache/trafficcontrol/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.
diff --git a/traffic_ops/traffic_ops_golang/profile/profiles.go 
b/traffic_ops/traffic_ops_golang/profile/profiles.go
index df706be8fb..efaa0380b4 100644
--- a/traffic_ops/traffic_ops_golang/profile/profiles.go
+++ b/traffic_ops/traffic_ops_golang/profile/profiles.go
@@ -429,7 +429,7 @@ func Read(w http.ResponseWriter, r *http.Request) {
        profile := tc.ProfileV5{}
        var profileList []tc.ProfileV5
        for rows.Next() {
-               if err = rows.Scan(&profile.Description, &profile.ID, 
&profile.LastUpdated, &profile.Name, &profile.RoutingDisabled, &profile.Type, 
&profile.CDNID, &profile.CDNName); err != nil {
+               if err = rows.StructScan(&profile); err != nil {
                        api.HandleErr(w, r, tx.Tx, 
http.StatusInternalServerError, nil, fmt.Errorf("error getting profile(s): %w", 
err))
                        return
                }
@@ -439,9 +439,9 @@ func Read(w http.ResponseWriter, r *http.Request) {
        profileInterfaces := []interface{}{}
 
        for _, p := range profileList {
-               // Attach Parameters if the 'param' parameter is sent
-               if _, ok := inf.Params["param"]; ok {
-                       p.Parameters, err = ReadParameters(inf.Tx, inf.User, 
p.ID, inf.User.Can("PARAMETER-SECURE:READ"))
+               // Attach Parameters if the 'id' parameter is sent
+               if _, ok := inf.Params["id"]; ok {
+                       p.Parameters, err = ReadParameters(inf.Tx, inf.User, 
p.ID, inf.User.Can(tc.PermParameterSecureRead))
                        if err != nil {
                                api.HandleErr(w, r, tx.Tx, 
http.StatusInternalServerError, nil, fmt.Errorf("profile read: error reading 
parameters for a profile: %w", err))
                                return
diff --git a/traffic_portal/app/src/common/service/utils/CollectionUtils.js 
b/traffic_portal/app/src/common/service/utils/CollectionUtils.js
index a92ff0954a..cf85706abe 100644
--- a/traffic_portal/app/src/common/service/utils/CollectionUtils.js
+++ b/traffic_portal/app/src/common/service/utils/CollectionUtils.js
@@ -78,6 +78,8 @@ class CollectionUtils {
         * @returns {T[]}
         */
        uniqArray(array1, array2, key) {
+               array1 = array1 || [];
+               array2 = array2 || [];
                /** @type {Set<unknown>} */
                const keys = new Set();
                /** @type {T[]} */
diff --git 
a/traffic_portal/app/src/modules/private/profiles/compare/diff/index.js 
b/traffic_portal/app/src/modules/private/profiles/compare/diff/index.js
index 7b2187dc67..ebbd1d72dd 100644
--- a/traffic_portal/app/src/modules/private/profiles/compare/diff/index.js
+++ b/traffic_portal/app/src/modules/private/profiles/compare/diff/index.js
@@ -38,7 +38,7 @@ module.exports = 
angular.module('trafficPortal.private.profiles.diff', [])
                                                         * @param {{params: 
{id: unknown}[]}} profile2
                                                         * @param 
{import("../../../../../common/service/utils/CollectionUtils")} collectionUtils
                                                         */
-                                                        profilesParams: 
function(profile1, profile2, collectionUtils) {
+                                                       profilesParams: 
function(profile1, profile2, collectionUtils) {
                                                                return 
collectionUtils.uniqArray(profile1.params, profile2.params, 'id');
                                                        },
                                                        showAll: function() {

Reply via email to