diff --git a/web/client/components/widgets/builder/wizard/ChartWizard.jsx b/web/client/components/widgets/builder/wizard/ChartWizard.jsx index 246e0d3a6b..3e629a76b7 100644 --- a/web/client/components/widgets/builder/wizard/ChartWizard.jsx +++ b/web/client/components/widgets/builder/wizard/ChartWizard.jsx @@ -205,6 +205,8 @@ const ChartWizard = ({ onFilterLayer={() => openFilterEditor()} />} ({ - label: m?.name || (m?.layer?.title), + : options.map((m, idx) => ({ + // layer cannot be used anymore as default + // because a chart could contain multiple layers + label: m?.name || `[Chart ${idx + 1}]`, value: m.chartId })) } diff --git a/web/client/components/widgets/builder/wizard/chart/__tests__/ChartSwitcher-test.jsx b/web/client/components/widgets/builder/wizard/chart/__tests__/ChartSwitcher-test.jsx index f7a5584303..4e7acb077e 100644 --- a/web/client/components/widgets/builder/wizard/chart/__tests__/ChartSwitcher-test.jsx +++ b/web/client/components/widgets/builder/wizard/chart/__tests__/ChartSwitcher-test.jsx @@ -13,7 +13,7 @@ import ReactTestUtils from 'react-dom/test-utils'; import ChartSwitcher from '../ChartSwitcher'; -const charts = [{chartId: 1, layer: {title: 'm1'}}, {chartId: 2, layer: {title: 'm2'}}]; +const charts = [{chartId: 1}, {chartId: 2}]; describe('ChartSwitcher component', () => { beforeEach((done) => { document.body.innerHTML = '
'; @@ -32,7 +32,7 @@ describe('ChartSwitcher component', () => { const switcherDropdown = container.querySelector('.Select'); expect(switcherDropdown).toBeTruthy(); const switcherValue = container.querySelector('.Select-value-label'); - expect(switcherValue.textContent).toBe('m1'); + expect(switcherValue.textContent).toBe('[Chart 1]'); }); it('ChartSwitcher render without container', () => { ReactDOM.render(, document.getElementById("container"));