From 0c083bdc1af4e6a3e17155246a3134cb5cb5887d Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:44:40 -0300 Subject: [PATCH] feat: Adds Sunburst chart migration logic (#25343) --- .../plugins/legacy-plugin-chart-sunburst/src/Sunburst.js | 3 ++- .../plugin-chart-echarts/src/Sunburst/transformProps.ts | 7 +++++-- superset/cli/viz_migrations.py | 3 +++ superset/migrations/shared/migrate_viz/processors.py | 6 ++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js b/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js index dd70afad3b36c..138788495c894 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js +++ b/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js @@ -82,7 +82,8 @@ function buildHierarchy(rows) { let currentNode = root; for (let level = 0; level < levels.length; level += 1) { const children = currentNode.children || []; - const nodeName = levels[level].toString(); + const node = levels[level]; + const nodeName = node ? node.toString() : t('N/A'); // If the next node has the name '0', it will const isLeafNode = level >= levels.length - 1 || levels[level + 1] === 0; let childNode; diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts index a3a9b8777f440..d0b2d079cd25e 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts @@ -32,7 +32,7 @@ import { } from '@superset-ui/core'; import { EChartsCoreOption } from 'echarts'; import { CallbackDataParams } from 'echarts/types/src/util/types'; -import { OpacityEnum } from '../constants'; +import { NULL_STRING, OpacityEnum } from '../constants'; import { defaultGrid } from '../defaults'; import { Refs } from '../types'; import { formatSeriesName, getColtypesMapping } from '../utils/series'; @@ -138,7 +138,10 @@ export function formatTooltip({ color: ${theme.colors.grayscale.base}" >`, `