Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/compare profile page #7885

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 {

Check warning on line 432 in traffic_ops/traffic_ops_golang/profile/profiles.go

View check run for this annotation

Codecov / codecov/patch

traffic_ops/traffic_ops_golang/profile/profiles.go#L432

Added line #L432 was not covered by tests
api.HandleErr(w, r, tx.Tx, http.StatusInternalServerError, nil, fmt.Errorf("error getting profile(s): %w", err))
return
}
Expand All @@ -439,9 +439,9 @@
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("PARAMETER:SECURE-READ"))

Check warning on line 444 in traffic_ops/traffic_ops_golang/profile/profiles.go

View check run for this annotation

Codecov / codecov/patch

traffic_ops/traffic_ops_golang/profile/profiles.go#L442-L444

Added lines #L442 - L444 were not covered by tests
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
Loading