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

[backport v2.8.10] Primary nav fails to render with trailing space in cluster badge color #12395

Closed
github-actions bot opened this issue Oct 29, 2024 · 1 comment
Assignees
Milestone

Comments

@github-actions
Copy link
Contributor

This is a backport issue for #12272, automatically created via GitHub Actions workflow initiated by @nwmac

Original issue body:

The primary navigation bar in Rancher Dashboard fails to render if a space is entered for a custom badge color for a cluster.

Steps to reproduce

  1. Navigate to Cluster Management
  2. Click on Create and select an RKE2 cluster
  3. Fill out the required fields for creating an RKE2 cluster
  4. Click on Cluster Appearance => Customize
  5. Enable Badge background color and select a background color for the cluster
  6. Create the cluster
  7. Click on "Edit YAML" for the newly created cluster
  8. Modify ui.rancher/badge-color so that it contains trailing whitespace (e.g ui.rancher/badge-color: '#1a5fb4 '
  9. Save the changes

Expected behavior

No errors in the console and primary navigation renders

Actual behavior

Error is printed to the console

Error: Unable to parse color from string: #1a5fb4 
    Color index.js:49
    Color index.js:24
    parseColor color.js:85
    get badge management.cattle.io.cluster.js:315
    get reactivity.esm-bundler.js:492
    clusters TopLevelMenu.vue:107
    clusters TopLevelMenu.vue:98

Primary navigation fails to render

Screenshots

primary-nav

@rancher-max
Copy link

Validated using rancher v2.8-head

Version Information:

image

Validation Information:

Performed the same scenarios as mentioned in #12272 (comment) with the same results

Note that to validate this, I had to create the cluster using Edit as YAML and add the annotations manually, since 2.8 does not have the "Customize Appearance" section on cluster create:

    ui.rancher/badge-color: '#f542e0     '
    ui.rancher/badge-text: Example Text

I also did the same checks on the local cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants