From b24bca0db341fdc35745f837373a26cdbc39f884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ida=20=C5=A0tambuk?= Date: Tue, 10 Oct 2023 23:29:51 +0200 Subject: [PATCH] Revert "Replace deprecated setVariableQueryEditor with CustomVariableSupport" (#229) --- CHANGELOG.md | 3 +++ package.json | 2 +- src/DataSource.ts | 2 -- src/module.ts | 1 + src/variables.ts | 21 --------------------- 5 files changed, 5 insertions(+), 24 deletions(-) delete mode 100644 src/variables.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 94359811..5e208fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## v1.11.1 +- Revert "Replace deprecated setVariableQueryEditor with CustomVariableSupport" in [#229](https://github.com/grafana/iot-sitewise-datasource/pull/229) + ## v1.11.0 - Update backend grafana-aws-sdk to v0.19.1 to add `il-central-1` to the opt-in region list diff --git a/package.json b/package.json index 8d62f7de..429270db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grafana-iot-sitewise-datasource", - "version": "1.11.0", + "version": "1.11.1", "description": "View IoT Sitewise data in grafana", "scripts": { "build": "webpack -c ./.config/webpack/webpack.config.ts --env production", diff --git a/src/DataSource.ts b/src/DataSource.ts index 39abc808..4c332a05 100644 --- a/src/DataSource.ts +++ b/src/DataSource.ts @@ -14,7 +14,6 @@ import { Observable } from 'rxjs'; import { getRequestLooper, MultiRequestTracker } from 'requestLooper'; import { appendMatchingFrames } from 'appendFrames'; import { frameToMetricFindValues } from 'utils'; -import { SitewiseVariableSupport } from './variables'; export class DataSource extends DataSourceWithBackend { // Easy access for QueryEditor @@ -24,7 +23,6 @@ export class DataSource extends DataSourceWithBackend) { super(instanceSettings); this.options = instanceSettings.jsonData; - this.variables = new SitewiseVariableSupport(this); } /** diff --git a/src/module.ts b/src/module.ts index 70227ef4..89352836 100644 --- a/src/module.ts +++ b/src/module.ts @@ -8,4 +8,5 @@ import { QueryEditor } from 'components/query/QueryEditor'; export const plugin = new DataSourcePlugin(DataSource) .setConfigEditor(ConfigEditor) .setMetadataInspector(MetaInspector) + .setVariableQueryEditor(QueryEditor) .setQueryEditor(QueryEditor); diff --git a/src/variables.ts b/src/variables.ts deleted file mode 100644 index d7b07a5e..00000000 --- a/src/variables.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Observable } from 'rxjs'; -import { assign } from 'lodash'; -import { SitewiseQuery } from './types'; -import { DataSource } from './DataSource'; -import { DataQueryRequest, DataQueryResponse, CustomVariableSupport } from '@grafana/data'; -import { QueryEditor } from './components/query/QueryEditor'; - -export class SitewiseVariableSupport extends CustomVariableSupport { - constructor(private readonly datasource: DataSource) { - super(); - this.datasource = datasource; - this.query = this.query.bind(this); - } - - editor = QueryEditor; - - query(request: DataQueryRequest): Observable { - assign(request.targets, [{ ...request.targets[0], refId: 'A' }]); - return this.datasource.query(request); - } -}