From d8678b3193ec04b585b6800718a505be4c5b73f9 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Wed, 11 Nov 2020 17:01:42 +0100 Subject: [PATCH] some cleanup --- CHANGELOG.md | 6 ++++++ src/ConfigEditor.tsx | 3 +++ src/DataSource.ts | 41 ++++++----------------------------------- src/QueryEditor.tsx | 5 +---- src/plugin.json | 2 +- 5 files changed, 17 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57dd6b8..98b2faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ +# v0.2.0 - 2020-11-11 + +Highlights: +* Some cleanup +* Added tooltips again + # v0.1.9 - 2020-11-11 Complete rewrite of the plugin for Grafana 7.x. diff --git a/src/ConfigEditor.tsx b/src/ConfigEditor.tsx index 657e9d2..cecef6d 100644 --- a/src/ConfigEditor.tsx +++ b/src/ConfigEditor.tsx @@ -60,6 +60,7 @@ export class ConfigEditor extends PureComponent { onChange={this.onConsulAddrChange} value={jsonData.consulAddr || ''} placeholder="http://localhost:8500" + tooltip="Specify a complete HTTP URL. This is usually one of the addresses specified in the Consul configuration under `addresses`. The default value when running Consul locally is `http://localhost:8500`. More details can be found in the Consul documentation. Consul is accessed by the Consul plugin backend, this means the URL needs to be accessible from the Grafana server." /> @@ -74,6 +75,8 @@ export class ConfigEditor extends PureComponent { inputWidth={20} onReset={this.onResetConsulToken} onChange={this.onConsulTakenChange} + tooltip=" If Consul Token is set, it has to be a valid Consul Token which is able to read the data you want to access. + If Consul Token is not set, no token will be set on the Consul client." /> diff --git a/src/DataSource.ts b/src/DataSource.ts index 61f2fef..81f3358 100644 --- a/src/DataSource.ts +++ b/src/DataSource.ts @@ -23,8 +23,9 @@ export class DataSource extends DataSourceWithBackend { - console.log('rsp', rsp); - const finalRsp: DataQueryResponse = { data: [], state: LoadingState.Done }; + _.each(rsp.data, (data: any) => { - console.log('data', data); const legendFormat = activeTargets[data.refId].legendFormat; + + // evaluate legendFormat if it is set if (!_.isEmpty(legendFormat)) { - console.log('legendFormat', legendFormat); data.fields[1].name = this.renderTemplate(legendFormat, data.fields[1].labels); data.fields[1].labels = []; finalRsp.data.push(data); } else { finalRsp.data.push(data); } - console.log('data2', data); }); return finalRsp; }) @@ -56,7 +55,7 @@ export class DataSource extends DataSourceWithBackend { - if (rsp.status === 200) { - return { status: 'success', message: 'Data source is working', title: 'Success' }; - } - return { - status: 'error', - message: 'Data source is not working: ' + rsp.message, - }; - }) - ); - } - metricFindQuery(query: string): Promise { return getBackendSrv() .fetch({ diff --git a/src/QueryEditor.tsx b/src/QueryEditor.tsx index f17e9e5..d47922a 100644 --- a/src/QueryEditor.tsx +++ b/src/QueryEditor.tsx @@ -150,10 +150,7 @@ export class QueryEditor extends PureComponent { {formatOption.value === 'table' ? (
- + Columns