Skip to content

Commit

Permalink
Bugfix/compare profile page (#7885)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rimashah25 authored Dec 19, 2023
1 parent 78fb430 commit 83556e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,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.
Expand Down
8 changes: 4 additions & 4 deletions traffic_ops/traffic_ops_golang/profile/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[]} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 83556e8

Please sign in to comment.