From 9bc58a4ef9e7ad0e58b63b8864ccde6d2f3631ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?= <71827178+bosiraphael@users.noreply.github.com> Date: Fri, 28 Nov 2025 11:17:03 +0100 Subject: [PATCH] Release line chart and pie chart (#16166) - Remove the feature flag for these two charts. - Reorder the charts - Hide gauge chart --- .../components/ChartTypeSelectionSection.tsx | 49 ++++++++----------- ...ransform-widget-configuration.util.spec.ts | 46 ++++++++--------- ...and-transform-widget-configuration.util.ts | 4 +- 3 files changed, 45 insertions(+), 54 deletions(-) diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx index 8657148271..538a5020a7 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx @@ -9,9 +9,9 @@ import { MenuPicker } from 'twenty-ui/navigation'; const graphTypeOptions = [ GraphType.VERTICAL_BAR, GraphType.HORIZONTAL_BAR, - GraphType.AGGREGATE, - GraphType.PIE, GraphType.LINE, + GraphType.PIE, + GraphType.AGGREGATE, GraphType.GAUGE, ]; @@ -36,32 +36,25 @@ export const ChartTypeSelectionSection = ({ return ( - {graphTypeOptions.map((graphType) => { - const isChartV2Type = [ - GraphType.PIE, - GraphType.LINE, - GraphType.GAUGE, - ].includes(graphType); - - const isDisabled = isChartV2Type && !isDashboardV2Enabled; - - return ( - { - setCurrentGraphType(graphType); - }} - showLabel - disabled={isDisabled} - tooltipContent={ - isDisabled ? t`Soon` : t(GRAPH_TYPE_INFORMATION[graphType].label) - } - /> - ); - })} + {graphTypeOptions + .filter( + (graphType) => isDashboardV2Enabled || graphType !== GraphType.GAUGE, + ) + .map((graphType) => { + return ( + { + setCurrentGraphType(graphType); + }} + showLabel + tooltipContent={t(GRAPH_TYPE_INFORMATION[graphType].label)} + /> + ); + })} ); }; diff --git a/packages/twenty-server/src/engine/core-modules/page-layout/utils/__tests__/validate-and-transform-widget-configuration.util.spec.ts b/packages/twenty-server/src/engine/core-modules/page-layout/utils/__tests__/validate-and-transform-widget-configuration.util.spec.ts index f532f54f66..5000aaf463 100644 --- a/packages/twenty-server/src/engine/core-modules/page-layout/utils/__tests__/validate-and-transform-widget-configuration.util.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/page-layout/utils/__tests__/validate-and-transform-widget-configuration.util.spec.ts @@ -247,23 +247,7 @@ describe('validateAndTransformWidgetConfiguration', () => { }); describe('Feature flags', () => { - it('should throw error for unsupported graph type', () => { - expect(() => - validateAndTransformWidgetConfiguration({ - type: WidgetType.GRAPH, - configuration: TEST_PIE_CHART_CONFIG, - isDashboardV2Enabled: false, - }), - ).toThrow(/IS_DASHBOARD_V2_ENABLED feature flag/); - - expect(() => - validateAndTransformWidgetConfiguration({ - type: WidgetType.GRAPH, - configuration: TEST_LINE_CHART_CONFIG, - isDashboardV2Enabled: false, - }), - ).toThrow(/IS_DASHBOARD_V2_ENABLED feature flag/); - + it('should throw error for GAUGE chart type when IS_DASHBOARD_V2_ENABLED is false', () => { expect(() => validateAndTransformWidgetConfiguration({ type: WidgetType.GRAPH, @@ -273,7 +257,25 @@ describe('validateAndTransformWidgetConfiguration', () => { ).toThrow(/IS_DASHBOARD_V2_ENABLED feature flag/); }); - it('should not throw error when IS_DASHBOARD_V2_ENABLED feature flag is enabled', () => { + it('should not throw error for GAUGE chart type when IS_DASHBOARD_V2_ENABLED is true', () => { + expect(() => + validateAndTransformWidgetConfiguration({ + type: WidgetType.GRAPH, + configuration: TEST_GAUGE_CHART_CONFIG, + isDashboardV2Enabled: true, + }), + ).not.toThrow(); + }); + + it('should not throw error for PIE chart type regardless of IS_DASHBOARD_V2_ENABLED', () => { + expect(() => + validateAndTransformWidgetConfiguration({ + type: WidgetType.GRAPH, + configuration: TEST_PIE_CHART_CONFIG, + isDashboardV2Enabled: false, + }), + ).not.toThrow(); + expect(() => validateAndTransformWidgetConfiguration({ type: WidgetType.GRAPH, @@ -283,21 +285,19 @@ describe('validateAndTransformWidgetConfiguration', () => { ).not.toThrow(); }); - it('should not throw error when IS_DASHBOARD_V2_ENABLED feature flag is enabled', () => { + it('should not throw error for LINE chart type regardless of IS_DASHBOARD_V2_ENABLED', () => { expect(() => validateAndTransformWidgetConfiguration({ type: WidgetType.GRAPH, configuration: TEST_LINE_CHART_CONFIG, - isDashboardV2Enabled: true, + isDashboardV2Enabled: false, }), ).not.toThrow(); - }); - it('should not throw error when IS_DASHBOARD_V2_ENABLED feature flag is enabled', () => { expect(() => validateAndTransformWidgetConfiguration({ type: WidgetType.GRAPH, - configuration: TEST_GAUGE_CHART_CONFIG, + configuration: TEST_LINE_CHART_CONFIG, isDashboardV2Enabled: true, }), ).not.toThrow(); diff --git a/packages/twenty-server/src/engine/core-modules/page-layout/utils/validate-and-transform-widget-configuration.util.ts b/packages/twenty-server/src/engine/core-modules/page-layout/utils/validate-and-transform-widget-configuration.util.ts index c511f669d7..68f8b17a28 100644 --- a/packages/twenty-server/src/engine/core-modules/page-layout/utils/validate-and-transform-widget-configuration.util.ts +++ b/packages/twenty-server/src/engine/core-modules/page-layout/utils/validate-and-transform-widget-configuration.util.ts @@ -38,9 +38,7 @@ const validateGraphConfiguration = ({ return null; } - const v2ChartTypes = [GraphType.PIE, GraphType.LINE, GraphType.GAUGE]; - - if (v2ChartTypes.includes(graphType) && !isDashboardV2Enabled) { + if (graphType === GraphType.GAUGE && !isDashboardV2Enabled) { throw new Error( `Chart type ${graphType} requires IS_DASHBOARD_V2_ENABLED feature flag`, );