fix(logs): fall back to point timestamp #5472

pull/5517/head
Pavel Zavora 2020-06-19 07:43:08 +02:00
parent 71b9d07f4f
commit 798e588cc9
1 changed files with 14 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import {
orderTableColumns,
filterTableColumns,
} from 'src/dashboards/utils/tableGraph'
import {TimeSeriesValue} from 'src/types/series'
export const ROW_HEIGHT = 18
const CHAR_WIDTH = 9
@ -174,8 +175,20 @@ export const applyChangesToTableData = (
): TableData => {
const columns = _.get(tableData, 'columns', [])
const values = _.get(tableData, 'values', [])
const data = [columns, ...values]
// #5472 fallback to timestamp when time is not defined
const timeColumnIndex = _.indexOf(columns, 'time')
const timestampColumnIndex = _.indexOf(columns, 'timestamp')
if (timeColumnIndex >= 0 && timestampColumnIndex >= 0) {
// modify existing data to save memory
(values as TimeSeriesValue[][]).forEach(row => {
if (row[timestampColumnIndex] === null) {
row[timestampColumnIndex] = (row[timeColumnIndex] as number) * 1000000
}
})
}
const data = [columns, ...values]
const filteredData = filterTableColumns(data, tableColumns)
const orderedData = orderTableColumns(filteredData, tableColumns)
const updatedColumns: string[] = _.get(orderedData, '0', [])