Skip to content

Commit f63b47d

Browse files
chore: Resolves JS warnings
1 parent 9038768 commit f63b47d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/datasource.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
DataFrame,
77
Field,
88
MetricFindValue,
9-
Vector,
109
getDefaultTimeRange,
1110
} from '@grafana/data';
1211
import { DataSourceWithBackend, getTemplateSrv } from '@grafana/runtime';
@@ -52,7 +51,7 @@ export class DataSource extends DataSourceWithBackend<HaystackQuery, HaystackDat
5251

5352
let ops: string[] = [];
5453

55-
let defField = frame?.fields?.find((field: Field<any, Vector<string>>) => {
54+
let defField = frame?.fields?.find((field: Field<any, [string]>) => {
5655
return field.name === 'def';
5756
});
5857
if (defField != null) {
@@ -65,7 +64,7 @@ export class DataSource extends DataSourceWithBackend<HaystackQuery, HaystackDat
6564
});
6665
} else {
6766
// Include back-support for old `ops` format, which uses "name", not "defs". Used by nhaystack
68-
let nameField = frame?.fields?.find((field: Field<any, Vector<string>>) => {
67+
let nameField = frame?.fields?.find((field: Field<any, [string]>) => {
6968
return field.name === 'name';
7069
});
7170
if (nameField != null) {
@@ -99,7 +98,8 @@ export class DataSource extends DataSourceWithBackend<HaystackQuery, HaystackDat
9998
// This is called when the user is selecting a variable value
10099
async metricFindQuery(variableQuery: HaystackVariableQuery, options?: any) {
101100
let request: HaystackQuery = variableQuery.query;
102-
let response = await this.query({ targets: [request] } as DataQueryRequest<HaystackQuery>).toPromise();
101+
let observable = this.query({ targets: [request] } as DataQueryRequest<HaystackQuery>);
102+
let response = await firstValueFrom(observable);
103103

104104
if (response === undefined || response.data === undefined) {
105105
return [];
@@ -112,7 +112,7 @@ export class DataSource extends DataSourceWithBackend<HaystackQuery, HaystackDat
112112
field = frame.fields.find((field: Field) => field.name === variableQuery.column) ?? field;
113113
}
114114

115-
let fieldVals = field.values.toArray().map((value) => {
115+
let fieldVals = field.values.map((value) => {
116116
if (value.startsWith('@')) {
117117
// Detect ref using @ prefix, and adjust value to just the Ref
118118
let spaceIndex = value.indexOf(' ');

0 commit comments

Comments
 (0)