From 24419712b07cd591450ef3f2cad533ea9aed3922 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Tue, 3 Dec 2024 12:03:30 +0100 Subject: [PATCH] ui: fix timeseries table format --- .../Dashboard/components/WidgetChart/WidgetChart.tsx | 6 ++---- .../components/WidgetDatatable/WidgetDatatable.tsx | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx index f7d31c573..cf6746bb0 100644 --- a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx +++ b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx @@ -153,11 +153,9 @@ function WidgetChart(props: Props) { } prevMetricRef.current = metric; const timestmaps = drillDownPeriod.toTimestamps(); - const isTimeseries = metric.metricType === TIMESERIES; const payload = isSaved - // TODO: remove after backend adds support for more view types - ? { ...metricParams, viewType: isTimeseries ? 'lineChart' : metric.viewType } - : { ...params, ...timestmaps, ...metric.toJson(), viewType: isTimeseries ? 'lineChart' : metric.viewType }; + ? { ...metricParams } + : { ...params, ...timestmaps, ...metric.toJson() }; debounceRequest( metric, payload, diff --git a/frontend/app/components/Dashboard/components/WidgetDatatable/WidgetDatatable.tsx b/frontend/app/components/Dashboard/components/WidgetDatatable/WidgetDatatable.tsx index ac6b400fb..e4e1371fb 100644 --- a/frontend/app/components/Dashboard/components/WidgetDatatable/WidgetDatatable.tsx +++ b/frontend/app/components/Dashboard/components/WidgetDatatable/WidgetDatatable.tsx @@ -47,7 +47,7 @@ function WidgetDatatable(props: Props) { * + average for each row * [ { seriesName: 'series1', mon: 1, tue: 2, wed: 3, average: 2 }, ... ] * */ - const series = Object.keys(data.chart[0]).filter( + const series = !data.chart[0] ? [] : Object.keys(data.chart[0]).filter( (key) => key !== 'time' && key !== 'timestamp' ); React.useEffect(() => { @@ -107,7 +107,7 @@ function WidgetDatatable(props: Props) { }), type: 'checkbox', }; - return hasMultipleSeries ? ( + return (
) : null}
- ) : null; + ) } export default WidgetDatatable;