Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

fix(plugin-chart-echarts): sanitize series from html tags #1126

Merged
merged 2 commits into from
Jul 2, 2021

Conversation

villebro
Copy link
Contributor

🐛 Bug Fix

Remove html tags from series names in tooltip.

BEFORE

Currently a series names that could be html tags don't show correctly on the tooltip(the series name <NULL> which can be seen on the legend does not show):
image

AFTER

After they show correctly (legend omitted in screenshot):
image

@villebro villebro requested a review from a team as a code owner May 21, 2021 08:44
@vercel
Copy link

vercel bot commented May 21, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/superset/superset-ui/FjicMRQoqHWqZ8qzxg5nruoC2hhm
✅ Preview: https://superset-ui-git-fork-preset-io-villebro-sanitize-html-superset.vercel.app

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #1126 (5033fc8) into master (f059a81) will increase coverage by 0.02%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1126      +/-   ##
==========================================
+ Coverage   29.00%   29.03%   +0.02%     
==========================================
  Files         463      463              
  Lines        9339     9342       +3     
  Branches     1494     1494              
==========================================
+ Hits         2709     2712       +3     
  Misses       6418     6418              
  Partials      212      212              
Impacted Files Coverage Δ
...plugin-chart-echarts/src/BoxPlot/transformProps.ts 56.25% <0.00%> (ø)
...s/plugin-chart-echarts/src/Graph/transformProps.ts 71.23% <0.00%> (ø)
.../plugin-chart-echarts/src/Funnel/transformProps.ts 75.00% <50.00%> (+0.64%) ⬆️
...ins/plugin-chart-echarts/src/Pie/transformProps.ts 71.11% <50.00%> (+0.65%) ⬆️
plugins/plugin-chart-echarts/src/utils/prophet.ts 91.83% <100.00%> (ø)
plugins/plugin-chart-echarts/src/utils/series.ts 92.64% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f059a81...5033fc8. Read the comment docs.

@stephenLYZ
Copy link
Contributor

@villebro great job! A small suggestion, maybe we can sanitize some general string like echarts.format.encodeHTML:

image

@villebro
Copy link
Contributor Author

@villebro great job! A small suggestion, maybe we can sanitize some general string like echarts.format.encodeHTML:

Yes, much cleaner approach. I'll update accordingly 👍

Comment on lines +204 to +206
export function sanitizeHtml(text: string): string {
return format.encodeHTML(text);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stephenLYZ I left the original sanitizeHtml function in place so we can more easily swap encodeHTML out if needed later.

Copy link
Contributor

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM

@villebro villebro merged commit fcd6fde into apache-superset:master Jul 2, 2021
@villebro villebro deleted the villebro/sanitize-html branch July 2, 2021 11:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants