From c9f8796b04674938dde102792a871e9179bbbba1 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" Date: Wed, 9 Nov 2022 09:47:04 -0500 Subject: [PATCH 1/3] fix: Right click on country map with code filter --- .../plugins/legacy-plugin-chart-world-map/src/WorldMap.js | 3 ++- .../legacy-plugin-chart-world-map/src/transformProps.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js index c845c20da80b0..7b56d432eaaa7 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js +++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js @@ -52,6 +52,7 @@ const formatter = getNumberFormatter(); function WorldMap(element, props) { const { + countryFieldtype, entity, data, width, @@ -111,7 +112,7 @@ function WorldMap(element, props) { const pointerEvent = d3.event; pointerEvent.preventDefault(); const key = source.id || source.country; - const val = mapData[key]?.name; + const val = countryFieldtype === 'name' ? mapData[key]?.name : key; if (val) { const filters = [ { diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js index 71b40e832e815..6348874eaba03 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js +++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js @@ -23,6 +23,7 @@ export default function transformProps(chartProps) { chartProps; const { onContextMenu } = hooks; const { + countryFieldtype, entity, maxBubbleSize, showBubbles, @@ -35,6 +36,7 @@ export default function transformProps(chartProps) { const { r, g, b } = colorPicker; return { + countryFieldtype, entity, data: queriesData[0].data, width, From 82d6eca72895d48511841f873da0803d3a27a9c0 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" Date: Wed, 9 Nov 2022 11:08:40 -0500 Subject: [PATCH 2/3] Fixes E2E test --- .../cypress/integration/dashboard/drilltodetail.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts index f89435f1bc152..2ea31b9808c43 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -409,14 +409,14 @@ describe('Drill to detail modal', () => { cy.get("[data-test-viz-type='world_map'] svg").then($canvas => { cy.wrap($canvas).scrollIntoView().rightclick(70, 150); - openModalFromChartContext('Drill to detail by United States'); - cy.getBySel('filter-val').should('contain', 'United States'); + openModalFromChartContext('Drill to detail by USA'); + cy.getBySel('filter-val').should('contain', 'USA'); closeModal(); }); cy.get("[data-test-viz-type='world_map'] svg").then($canvas => { cy.wrap($canvas).scrollIntoView().rightclick(200, 140); - openModalFromChartContext('Drill to detail by Slovakia'); - cy.getBySel('filter-val').should('contain', 'Slovakia'); + openModalFromChartContext('Drill to detail by SLV'); + cy.getBySel('filter-val').should('contain', 'SLV'); }); }); }); From 111c4a30b58e70969e7b7eb81185ff2125524184 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" Date: Wed, 9 Nov 2022 12:02:48 -0500 Subject: [PATCH 3/3] Fixes Slovakia code --- .../cypress/integration/dashboard/drilltodetail.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts index 2ea31b9808c43..caf938b33cf47 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -415,8 +415,8 @@ describe('Drill to detail modal', () => { }); cy.get("[data-test-viz-type='world_map'] svg").then($canvas => { cy.wrap($canvas).scrollIntoView().rightclick(200, 140); - openModalFromChartContext('Drill to detail by SLV'); - cy.getBySel('filter-val').should('contain', 'SLV'); + openModalFromChartContext('Drill to detail by SVK'); + cy.getBySel('filter-val').should('contain', 'SVK'); }); }); });