From f6bb9c8acfa89181ee731b66e974e8b47cc72f2a Mon Sep 17 00:00:00 2001 From: Sriram Date: Wed, 27 Oct 2021 13:49:41 +0100 Subject: [PATCH] as is format (#185) --- CHANGELOG.md | 1 + package.json | 2 +- src/components/FormatSelector.tsx | 9 ++++++++- src/datasource.ts | 4 ++++ src/types.ts | 3 ++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b21ad679..9dba0b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Change history of the project. All the feature updates, bug fixes, breaking chan - E2E tests placeholder added - type updates - bug fixes +- "as-is" data format added for debugging ## [ 0.7.10 ] diff --git a/package.json b/package.json index ce12ead1..ea5792fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grafana-infinity-datasource", - "version": "0.8.0-dev.3", + "version": "0.8.0-dev.4", "description": "JSON, CSV, XML, GraphQL & HTML datasource for Grafana. Do infinite things with Grafana.", "main": "dist/module.js", "scripts": { diff --git a/src/components/FormatSelector.tsx b/src/components/FormatSelector.tsx index fbdc53fd..1110a4a4 100644 --- a/src/components/FormatSelector.tsx +++ b/src/components/FormatSelector.tsx @@ -17,13 +17,20 @@ export const FormatSelector = (props: FormatSelectorProps) => { onChange({ ...query, format }); onRunQuery(); }; + const getFormats = () => { + if (query.type === 'json' && query.source === 'inline') { + return SCRAP_QUERY_RESULT_FORMATS; + } else { + return SCRAP_QUERY_RESULT_FORMATS.filter((f) => f.value !== 'as-is'); + } + }; return ( <>
- +
); diff --git a/src/datasource.ts b/src/datasource.ts index dbb04d1d..55669fdc 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -44,6 +44,10 @@ export class Datasource extends DataSourceWithBackend = { type: T } & DataQuery; export type InfinityQueryWithSource = { source: S } & DataQuery; export type InfinityQueryWithURLSource = { @@ -233,6 +233,7 @@ export const SCRAP_QUERY_RESULT_FORMATS: Array