ui: fix timeseries table format

This commit is contained in:
nick-delirium 2024-12-03 12:03:30 +01:00
parent 63aeb103e6
commit 24419712b0
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 5 additions and 7 deletions

View file

@ -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,

View file

@ -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 (
<div className={cn('relative -mx-4 px-2', showTable ? 'pt-6' : '')}>
<div
className={
@ -154,7 +154,7 @@ function WidgetDatatable(props: Props) {
</div>
) : null}
</div>
) : null;
)
}
export default WidgetDatatable;