diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx index 50471b5f9..c5fd2ad3f 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidget/CustomMetricWidget.tsx @@ -51,6 +51,10 @@ function CustomMetricWidget(props: Props) { const colors = Styles.customMetricColors; const params = customParams(period.rangeName) const metricParams = { ...params, metricId: metric.metricId, viewType: 'lineChart', startDate: period.start, endDate: period.end } + const isLineChart = metric.viewType === 'lineChart'; + const isProgress = metric.viewType === 'progress'; + const isTable = metric.viewType === 'table'; + const isPieChart = metric.viewType === 'pieChart'; useEffect(() => { new APIClient()['post'](`/custom_metrics/${metricParams.metricId}/chart`, { ...metricParams, q: metric.name }) @@ -115,7 +119,7 @@ function CustomMetricWidget(props: Props) {
{metric.name}
- + {!isTable && !isPieChart && } props.init(metric)} /> updateActiveState(metric.metricId, false)} />
@@ -128,7 +132,7 @@ function CustomMetricWidget(props: Props) { > <> - {metric.viewType === 'lineChart' && ( + {isLineChart && ( )} - {metric.viewType === 'pieChart' && ( + {isPieChart && ( )} - {metric.viewType === 'progress' && ( + {isProgress && ( )} - {metric.viewType === 'table' && ( + {isTable && ( )}