From 289a33bf5b0c1d3f23e19de9beddc911fe05e98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 3 Sep 2019 15:57:00 +0200 Subject: [PATCH] Updated is time series test --- .../features/explore/utils/ResultProcessor.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/public/app/features/explore/utils/ResultProcessor.ts b/public/app/features/explore/utils/ResultProcessor.ts index 4a1872662c5..956593b7a75 100644 --- a/public/app/features/explore/utils/ResultProcessor.ts +++ b/public/app/features/explore/utils/ResultProcessor.ts @@ -18,7 +18,7 @@ export class ResultProcessor { return []; } - const onlyTimeSeries = this.dataFrames.filter(series => series.fields.length === 2); + const onlyTimeSeries = this.dataFrames.filter(isTimeSeries); return getGraphSeriesModel( onlyTimeSeries, @@ -36,14 +36,7 @@ export class ResultProcessor { // For now ignore time series // We can change this later, just need to figure out how to // Ignore time series only for prometheus - const onlyTables = this.dataFrames.filter(frame => { - if (frame.fields.length === 2) { - if (frame.fields[1].type === FieldType.time) { - return false; - } - } - return true; - }); + const onlyTables = this.dataFrames.filter(frame => !isTimeSeries(frame)); const tables = onlyTables.map(frame => { const { fields } = frame; @@ -113,3 +106,13 @@ export class ResultProcessor { return { ...sortedNewResults, rows, series }; } } + +export function isTimeSeries(frame: DataFrame): boolean { + if (frame.fields.length === 2) { + if (frame.fields[1].type === FieldType.time) { + return true; + } + } + + return false; +}