mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Logs Panel: Add milliseconds to download file (#75045)
* add milliseconds to log panel txt file download
This commit is contained in:
parent
354c1e992e
commit
af3ea54d0e
@ -1,14 +1,6 @@
|
||||
import saveAs from 'file-saver';
|
||||
|
||||
import {
|
||||
dataFrameFromJSON,
|
||||
DataFrameJSON,
|
||||
dateTimeFormat,
|
||||
dateTimeFormatISO,
|
||||
FieldType,
|
||||
LogRowModel,
|
||||
LogsMetaKind,
|
||||
} from '@grafana/data';
|
||||
import { dataFrameFromJSON, DataFrameJSON, dateTimeFormat, FieldType, LogRowModel, LogsMetaKind } from '@grafana/data';
|
||||
|
||||
import { downloadAsJson, downloadDataFrameAsCsv, downloadLogsModelAsTxt } from './download';
|
||||
|
||||
@ -98,7 +90,7 @@ describe('inspector download', () => {
|
||||
rows: [{ timeEpochMs: 100, entry: 'testEntry' } as unknown as LogRowModel],
|
||||
},
|
||||
'test',
|
||||
`testLabel: 1\nsecondTestLabel: 2\n\n\n${dateTimeFormatISO(100)}\ttestEntry\n`,
|
||||
`testLabel: 1\nsecondTestLabel: 2\n\n\n${dateTimeFormat(100, { defaultWithMS: true })}\ttestEntry\n`,
|
||||
],
|
||||
])('should, when logsModel is %s and title is %s, resolve in %s', async (logsModel, title, expected) => {
|
||||
downloadLogsModelAsTxt(logsModel, title);
|
||||
|
@ -5,7 +5,6 @@ import {
|
||||
DataFrame,
|
||||
DataTransformerID,
|
||||
dateTimeFormat,
|
||||
dateTimeFormatISO,
|
||||
LogsModel,
|
||||
MutableDataFrame,
|
||||
toCSV,
|
||||
@ -31,7 +30,7 @@ export function downloadLogsModelAsTxt(logsModel: Pick<LogsModel, 'meta' | 'rows
|
||||
textToDownload = textToDownload + '\n\n';
|
||||
|
||||
logsModel.rows.forEach((row) => {
|
||||
const newRow = dateTimeFormatISO(row.timeEpochMs) + '\t' + row.entry + '\n';
|
||||
const newRow = dateTimeFormat(row.timeEpochMs, { defaultWithMS: true }) + '\t' + row.entry + '\n';
|
||||
textToDownload = textToDownload + newRow;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user