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: color collision in dashboard with tabs #24670

Merged
merged 8 commits into from
Jul 14, 2023

Conversation

lilykuang
Copy link
Member

@lilykuang lilykuang commented Jul 11, 2023

SUMMARY

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
color

After:
color_after

TESTING INSTRUCTIONS

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

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Merging #24670 (9d3c8c3) into master (65fb8e1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 9d3c8c3 differs from pull request most recent head 622ae33. Consider uploading reports for the commit 622ae33 to get more accurate results

@@           Coverage Diff           @@
##           master   #24670   +/-   ##
=======================================
  Coverage   68.97%   68.97%           
=======================================
  Files        1901     1901           
  Lines       74006    74008    +2     
  Branches     8182     8183    +1     
=======================================
+ Hits        51045    51047    +2     
  Misses      20840    20840           
  Partials     2121     2121           
Flag Coverage Δ
javascript 55.71% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...uperset-ui-core/src/color/CategoricalColorScale.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Object.entries(this.parentForcedColors).forEach(([key, value]) => {
if (key !== cleanedValue) {
const index = updatedRange.indexOf(value);
updatedRange.splice(index, 1);
Copy link
Member

Choose a reason for hiding this comment

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

could you use a filter method on updatedRange here instead? That may be a little more succinct.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this looks great!

Copy link
Member

Choose a reason for hiding this comment

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

Additional suggestion: #24670 (comment)

@lilykuang lilykuang requested a review from eschutho July 12, 2023 20:20
@lilykuang lilykuang force-pushed the fix-color-collision-tabs branch 2 times, most recently from 339b33a to e62cee9 Compare July 13, 2023 05:59
Comment on lines 81 to 92
let updatedRange = [...this.originColors];
// remove the color option from shared color
sharedColorMap.forEach((value: string, key: string) => {
if (key !== cleanedValue) {
const index = updatedRange.indexOf(value);
updatedRange.splice(index, 1);
updatedRange = updatedRange.filter(color => color !== value);
}
});
Object.entries(this.parentForcedColors).forEach(([key, value]) => {
if (key !== cleanedValue) {
updatedRange = updatedRange.filter(color => color !== value);
}
}); // remove the color option from forced colors
Copy link
Member

Choose a reason for hiding this comment

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

The combination of forEach and .filter operation can be heavy. It should be better using a hashset to filter out the values.

Suggested change
let updatedRange = [...this.originColors];
// remove the color option from shared color
sharedColorMap.forEach((value: string, key: string) => {
if (key !== cleanedValue) {
const index = updatedRange.indexOf(value);
updatedRange.splice(index, 1);
updatedRange = updatedRange.filter(color => color !== value);
}
});
Object.entries(this.parentForcedColors).forEach(([key, value]) => {
if (key !== cleanedValue) {
updatedRange = updatedRange.filter(color => color !== value);
}
}); // remove the color option from forced colors
const updatedRange = new Set(this.originColors);
// remove the color option from shared color
sharedColorMap.forEach((value: string, key: string) => {
if (key !== cleanedValue) {
updatedRange.delete(value);
}
}
Object.entries(this.parentForcedColors).forEach(([key, value]) => {
if (key !== cleanedValue) {
updatedRange.delete(value);
}
}
this.range(updatedRange.size > 0 ? [...updatedRange] : this.originColors);

Copy link
Member Author

Choose a reason for hiding this comment

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

oh nice. i will use that

@lilykuang lilykuang force-pushed the fix-color-collision-tabs branch 2 times, most recently from 6d42537 to 5df4705 Compare July 13, 2023 20:45
@lilykuang lilykuang merged commit 0328dd2 into apache:master Jul 14, 2023
@lilykuang lilykuang deleted the fix-color-collision-tabs branch July 14, 2023 19:13
@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Jul 19, 2023
michael-s-molina pushed a commit that referenced this pull request Jul 26, 2023
@mistercrunch mistercrunch added 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 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 size/M v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants