diff --git a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx index 5d4a720c4..7e5106cca 100644 --- a/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx +++ b/frontend/app/components/Dashboard/components/WidgetChart/WidgetChart.tsx @@ -519,8 +519,8 @@ function WidgetChart(props: Props) { {renderChart()} {props.isPreview && _metric.metricType === TIMESERIES ? ( void; defaultOpen?: boolean; metric: { name: string }; + isTableView?: boolean; } function WidgetDatatable(props: Props) { @@ -49,15 +50,17 @@ function WidgetDatatable(props: Props) { * + average for each row * [ { seriesName: 'series1', mon: 1, tue: 2, wed: 3, average: 2 }, ... ] * */ - const series = !data.chart[0] ? [] : Object.keys(data.chart[0]).filter( - (key) => key !== 'time' && key !== 'timestamp' - ); + const series = !data.chart[0] + ? [] + : Object.keys(data.chart[0]).filter( + (key) => key !== 'time' && key !== 'timestamp' + ); React.useEffect(() => { if (!data.chart) return; setTableProps(initTableProps); columnNames.clear(); data.chart.forEach((p: any) => { - columnNames.add(p.time); + columnNames.add(p.time); }); // for example: mon, tue, wed, thu, fri, sat, sun const avg: any = {}; // { seriesName: {itemsCount: 0, total: 0} } const items: Record[] = []; // as many items (rows) as we have series in filter @@ -110,27 +113,31 @@ function WidgetDatatable(props: Props) { type: 'checkbox', }; return ( -
-
-
- -
+
+ {props.isTableView ? null : ( + <> +
+
+ +
+ + )} {showTable ? (
) : null} - ) + ); } export default WidgetDatatable; diff --git a/frontend/app/components/Dashboard/components/WidgetOptions.tsx b/frontend/app/components/Dashboard/components/WidgetOptions.tsx index e3567ab57..84b9607c9 100644 --- a/frontend/app/components/Dashboard/components/WidgetOptions.tsx +++ b/frontend/app/components/Dashboard/components/WidgetOptions.tsx @@ -188,6 +188,7 @@ const WidgetViewTypeOptions = observer(({ metric }: { metric: any }) => { })), onClick: ({ key }: any) => { metric.updateKey('viewType', key); + metric.updateKey('hasChanged', true); }, }} >