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): Color inconsistency on refreshes and conflicts #27439

Merged
merged 21 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Clean up
  • Loading branch information
geido committed May 13, 2024
commit c81a55fb03b5aeb86d84aebce07e6d44bb88021a
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('Dashboard edit', () => {

it('should apply same color to same labels with color scheme set', () => {
openProperties();
selectColorScheme('lyftColors');
selectColorScheme('blueToGreen');
applyChanges();
saveChanges();

Expand All @@ -232,7 +232,7 @@ describe('Dashboard edit', () => {
'[data-test-chart-name="Top 10 California Names Timeseries"] .line .nv-legend-symbol',
)
.first()
.should('have.css', 'fill', 'rgb(234, 11, 140)');
.should('have.css', 'fill', 'rgb(0, 234, 162)');

// open 2nd main tab
openTab(0, 1);
Expand All @@ -241,7 +241,7 @@ describe('Dashboard edit', () => {
// label Anthony
cy.get('[data-test-chart-name="Trends"] .line .nv-legend-symbol')
.eq(2)
.should('have.css', 'fill', 'rgb(234, 11, 140)');
.should('have.css', 'fill', 'rgb(0, 234, 162)');
});

it('should apply same color to same labels with no color scheme set', () => {
Expand Down Expand Up @@ -471,7 +471,7 @@ describe('Dashboard edit', () => {

it.skip('should change color scheme multiple times', () => {
openProperties();
selectColorScheme('lyftColors');
selectColorScheme('blueToGreen');
applyChanges();
saveChanges();

Expand Down Expand Up @@ -500,7 +500,7 @@ describe('Dashboard edit', () => {

editDashboard();
openProperties();
selectColorScheme('bnbColors');
selectColorScheme('modernSunset');
applyChanges();
saveChanges();

Expand All @@ -523,7 +523,7 @@ describe('Dashboard edit', () => {

it.skip('should apply the color scheme across main tabs', () => {
openProperties();
selectColorScheme('lyftColors');
selectColorScheme('blueToGreen');
applyChanges();
saveChanges();

Expand All @@ -539,7 +539,7 @@ describe('Dashboard edit', () => {
it.skip('should apply the color scheme across main tabs for rendered charts', () => {
waitForChartLoad({ name: 'Treemap', viz: 'treemap_v2' });
openProperties();
selectColorScheme('bnbColors');
selectColorScheme('blueToGreen');
applyChanges();
saveChanges();

Expand All @@ -554,7 +554,7 @@ describe('Dashboard edit', () => {
// change scheme now that charts are rendered across the main tabs
editDashboard();
openProperties();
selectColorScheme('lyftColors');
selectColorScheme('modernSunset');
applyChanges();
saveChanges();

Expand All @@ -565,7 +565,7 @@ describe('Dashboard edit', () => {

it.skip('should apply the color scheme in nested tabs', () => {
openProperties();
selectColorScheme('lyftColors');
selectColorScheme('blueToGreen');
applyChanges();
saveChanges();

Expand Down Expand Up @@ -600,7 +600,7 @@ describe('Dashboard edit', () => {
// go to previous tab
openTab(1, 0);
openProperties();
selectColorScheme('lyftColors');
selectColorScheme('blueToGreen');
applyChanges();
saveChanges();

Expand Down Expand Up @@ -637,16 +637,16 @@ describe('Dashboard edit', () => {
});

it.skip('should overwrite the color scheme when advanced is closed', () => {
selectColorScheme('d3Category20b');
selectColorScheme('blueToGreen');
openAdvancedProperties();
assertMetadata('d3Category20b');
assertMetadata('blueToGreen');
applyChanges();
});

it.skip('should overwrite the color scheme when advanced is open', () => {
openAdvancedProperties();
selectColorScheme('googleCategory10c');
assertMetadata('googleCategory10c');
selectColorScheme('modernSunset');
assertMetadata('modernSunset');
applyChanges();
});

Expand Down
2 changes: 0 additions & 2 deletions superset-frontend/src/dashboard/util/colorScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export const isLabelsColorMapSynced = (
currentLabelsColorMap: Map<string, string>,
): boolean => {
const freshLabelsColorMap = getLabelsColorMap().getColorMap();
console.log('------currentLabelsColorMap', currentLabelsColorMap);
console.log('------freshLabelsColorMap', freshLabelsColorMap);
return Object.entries(freshLabelsColorMap).every(
([label, color]) =>
currentLabelsColorMap.hasOwnProperty(label) &&
Expand Down