[Dashboards] [Warning] Remove gauge chart support and delete existing widgets (#20172)

## Summary

Removes gauge chart from the chart-type picker and deletes existing
gauge widgets via a workspace migration. The gauge was rendering a
hardcoded `0.7 / "Progress"` stub regardless of configuration -- never
wired to real data.

The contract stays in place. We keep
`WidgetConfigurationType.GAUGE_CHART`, the DTO, the GraphQL union
member, and the gauge folder -- so stored gauge JSON still resolves
through the schema. The render path falls through to `default: return
null`, so any un-migrated gauge widget renders as an empty cell, not a
crash.

This PR just removes existing gauge widgets if there are any (via
`upgrade:2-3:delete-gauge-widgets`). The deliberate cleanup -- deleting
the type definitions, the gauge folder, the DTO -- comes in a follow-up
PR after the migration has run.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
nitin
2026-05-06 03:06:45 +05:30
committed by GitHub
parent 6ebeedba0a
commit bbd9720ab3
6 changed files with 104 additions and 71 deletions
@@ -1,20 +1,11 @@
import { WidgetSkeletonLoader } from '@/page-layout/widgets/components/WidgetSkeletonLoader';
import { PageLayoutWidgetInvalidConfigDisplay } from '@/page-layout/widgets/components/PageLayoutWidgetInvalidConfigDisplay';
import { GraphWidgetAggregateChartRenderer } from '@/page-layout/widgets/graph/graph-widget-aggregate-chart/components/GraphWidgetAggregateChartRenderer';
import { GraphWidgetBarChartRenderer } from '@/page-layout/widgets/graph/graph-widget-bar-chart/components/GraphWidgetBarChartRenderer';
import { GraphWidgetLineChartRenderer } from '@/page-layout/widgets/graph/graph-widget-line-chart/components/GraphWidgetLineChartRenderer';
import { GraphWidgetPieChartRenderer } from '@/page-layout/widgets/graph/graph-widget-pie-chart/components/GraphWidgetPieChartRenderer';
import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget';
import { lazy, Suspense } from 'react';
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
const GraphWidgetGaugeChart = lazy(() =>
import(
'@/page-layout/widgets/graph/graph-widget-gauge-chart/components/GraphWidgetGaugeChart'
).then((module) => ({
default: module.GraphWidgetGaugeChart,
})),
);
export const GraphWidget = () => {
const widget = useCurrentWidget();
@@ -24,31 +15,6 @@ export const GraphWidget = () => {
case WidgetConfigurationType.AGGREGATE_CHART:
return <GraphWidgetAggregateChartRenderer />;
case WidgetConfigurationType.GAUGE_CHART: {
const gaugeData = {
value: 0.7,
min: 0,
max: 1,
label: 'Progress',
};
return (
<Suspense fallback={<WidgetSkeletonLoader />}>
<GraphWidgetGaugeChart
data={{
value: gaugeData.value,
min: gaugeData.min,
max: gaugeData.max,
label: gaugeData.label,
}}
displayType="percentage"
showValue
id={`gauge-chart-${widget.id}`}
/>
</Suspense>
);
}
case WidgetConfigurationType.PIE_CHART:
return <GraphWidgetPieChartRenderer />;
@@ -58,6 +24,9 @@ export const GraphWidget = () => {
case WidgetConfigurationType.LINE_CHART:
return <GraphWidgetLineChartRenderer />;
case WidgetConfigurationType.GAUGE_CHART:
return <PageLayoutWidgetInvalidConfigDisplay />;
default:
return null;
}
@@ -12,7 +12,6 @@ const graphTypeOptions = [
GraphType.LINE,
GraphType.PIE,
GraphType.AGGREGATE,
GraphType.GAUGE,
];
const StyledChartTypeSelectionContainer = styled.div`