Skip to content

Commit f4b5655

Browse files
fix: Resolves issue #46
This ensures that variable queries have their `refId` set, which is required for Grafana to recognize the result as a variable response. I can't seem to find documentation about this, but it's reflected in other custom variable support implementations: https://github.com/grafana/grafana/blob/15293a2ceb083108c0f15490933db523aa915c7d/public/app/plugins/datasource/loki/components/VariableQueryEditor.tsx#L71
1 parent edcb23f commit f4b5655

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/datasource.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export class HaystackVariableSupport extends CustomVariableSupport<DataSource, H
130130

131131
query(request: DataQueryRequest<HaystackVariableQuery>): Observable<DataQueryResponse> {
132132
let variableQuery = request.targets[0];
133+
// Setting the refId is apparently required for Grafana to recognize the result as a variable
134+
variableQuery.refId = 'HaystackVariableQuery';
133135
let observable = this.onQuery(request);
134136
return observable.pipe(
135137
map((response) => {

0 commit comments

Comments
 (0)