Skip to content

Commit 1ed6952

Browse files
authored
Merge pull request #70 from axiomhq/fix-repeat-panels-values
Fix repeat panels values
2 parents ed68b97 + 7e19679 commit 1ed6952

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright {yyyy} {name of copyright owner}
189+
Copyright 2023 axiom.co
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

src/datasource.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataFrame, DataQueryRequest, DataQueryResponse, DataSourceInstanceSettings } from '@grafana/data';
1+
import { DataFrame, DataQueryRequest, DataQueryResponse, DataSourceInstanceSettings, ScopedVars } from '@grafana/data';
22
import { DataSourceWithBackend, getTemplateSrv } from '@grafana/runtime';
33

44
import { AxiomQuery, AxiomDataSourceOptions } from './types';
@@ -11,11 +11,12 @@ export class DataSource extends DataSourceWithBackend<AxiomQuery, AxiomDataSourc
1111
this.url = instanceSettings.url;
1212
}
1313

14-
applyTemplateVariables(query: AxiomQuery) {
14+
applyTemplateVariables(query: AxiomQuery, scopedVars: ScopedVars) {
1515
const templateSrv = getTemplateSrv();
16+
1617
return {
1718
...query,
18-
apl: query.apl ? templateSrv.replace(query.apl) : '',
19+
apl: query.apl ? templateSrv.replace(query.apl, scopedVars) : '',
1920
};
2021
}
2122

@@ -43,7 +44,9 @@ export class DataSource extends DataSourceWithBackend<AxiomQuery, AxiomDataSourc
4344
return [];
4445
}
4546

46-
return res ? (res.data[0] as DataFrame).fields[0].values.toArray().map((_) => ({ text: _.toString() })) : [];
47+
return res
48+
? (res.data[0] as DataFrame).fields[0].values.map((v) => ({ text: v != null ? v.toString() : null }))
49+
: [];
4750
}
4851

4952
async lookupSchema() {

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataQuery, DataSourceJsonData } from '@grafana/data';
1+
import { DataQuery, DataSourceJsonData } from '@grafana/schema';
22

33
export interface AxiomQuery extends DataQuery {
44
apl: string;

0 commit comments

Comments
 (0)