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

fix(dashboard): title formatting #26189

Merged
merged 1 commit into from
Dec 7, 2023
Merged

fix(dashboard): title formatting #26189

merged 1 commit into from
Dec 7, 2023

Conversation

nytai
Copy link
Member

@nytai nytai commented Dec 5, 2023

SUMMARY

Titles with special characters are not rendered correctly. This PR ensures that special characters are handled correctly and titles match the user input

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  • Dashboards load and titles are rendered correctly

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (39c6488) 67.00% compared to head (9d1b97f) 69.20%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #26189      +/-   ##
==========================================
+ Coverage   67.00%   69.20%   +2.20%     
==========================================
  Files        1944     1945       +1     
  Lines       75927    76114     +187     
  Branches     8451     8521      +70     
==========================================
+ Hits        50873    52676    +1803     
+ Misses      22869    21234    -1635     
- Partials     2185     2204      +19     
Flag Coverage Δ
hive 53.68% <ø> (?)
javascript 56.59% <100.00%> (+0.08%) ⬆️
mysql 78.10% <ø> (+0.02%) ⬆️
postgres 78.19% <ø> (ø)
presto 53.64% <ø> (?)
python 82.88% <ø> (+4.54%) ⬆️
sqlite 76.85% <ø> (ø)
unit 55.81% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

/\s/g,
'&nbsp;',
);
sizerRef.current.innerHTML = (currentTitle || placeholder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nytai are there libraries we can leverage for sanitizing the HTML?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to sanitize (ie, remove) html or just escape it? I think the purpose of this code is to render the title to the DOM so we can measure how much space it takes up, so we probably want to escape it.

Looking at an escape-html lib, it's pretty basic. Eg https://github.com/component/escape-html/blob/master/index.js

Happy to update the PR to use this lib if we think it's best, but... you know the joke about node modules

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I meant escape rather than sanitize. It seems like we're already installing the escape-html library and thus maybe we should just use that directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the websocket sidecar app (for async queries), but sure we can use that.

@pull-request-size pull-request-size bot added size/XS and removed size/S labels Dec 7, 2023
@nytai nytai closed this Dec 7, 2023
@nytai nytai reopened this Dec 7, 2023
/\s/g,
'&nbsp;',
);
sizerRef.current.innerHTML = escapeHTML(currentTitle || placeholder);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good improvement, yet it's a breaking change, minimal we need a line on UPDATING.md

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well now it's nice and simple! :D

@nytai nytai merged commit 88fb342 into master Dec 7, 2023
51 checks passed
@nytai nytai deleted the tai/fix-title branch December 7, 2023 21:33
@michael-s-molina michael-s-molina added v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch labels Dec 8, 2023
michael-s-molina pushed a commit that referenced this pull request Dec 8, 2023
michael-s-molina pushed a commit that referenced this pull request Dec 8, 2023
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Dec 11, 2023
josedev-union pushed a commit to Ortege-xyz/studio that referenced this pull request Jan 22, 2024
@mistercrunch mistercrunch added 🍒 3.0.3 🍒 3.0.4 🍒 3.1.0 🍒 3.1.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Mar 8, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset:2023.49 size/XS v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch 🍒 3.0.3 🍒 3.0.4 🍒 3.1.0 🍒 3.1.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants