Skip to content

Commit

Permalink
Fix annotations query grafana variables not saving correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
vereecw committed Oct 25, 2024
1 parent 338fdc6 commit 69b50dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class DataSource extends DataSourceWithBackend<Query, HistorianDataSource

switch (target.queryType) {
case 'AssetMeasurementQuery': {
const assetMeasurementQuery = target.query as AssetMeasurementQuery
const assetMeasurementQuery = { ...target.query } as AssetMeasurementQuery
assetMeasurementQuery.Assets = assetMeasurementQuery.Assets?.flatMap((e) =>
this.multiSelectReplace(e, request.scopedVars)
)
Expand All @@ -89,7 +89,7 @@ export class DataSource extends DataSourceWithBackend<Query, HistorianDataSource
break
}
case 'MeasurementQuery': {
const measurementQuery = target.query as MeasurementQuery
const measurementQuery = { ...target.query } as MeasurementQuery
measurementQuery.Databases = measurementQuery.Databases?.flatMap((e) =>
this.multiSelectReplace(e, request.scopedVars)
)
Expand All @@ -101,14 +101,14 @@ export class DataSource extends DataSourceWithBackend<Query, HistorianDataSource
break
}
case 'RawQuery': {
const rawQuery = target.query as RawQuery
const rawQuery = { ...target.query } as RawQuery
rawQuery.TimeseriesDatabase = this.templateSrv.replace(rawQuery.TimeseriesDatabase, request.scopedVars)
rawQuery.Query = this.templateSrv.replace(rawQuery.Query, request.scopedVars)
target.query = rawQuery
break
}
case 'EventQuery': {
const eventQuery = target.query as EventQuery
const eventQuery = { ...target.query } as EventQuery
eventQuery.Assets = eventQuery.Assets?.flatMap((e) => this.multiSelectReplace(e, request.scopedVars))
eventQuery.EventTypes = eventQuery.EventTypes?.flatMap((e) =>
this.multiSelectReplace(e, request.scopedVars)
Expand Down

0 comments on commit 69b50dd

Please sign in to comment.