/usr/share/grafana/public/app/plugins/datasource/influxdb
import { AnnotationQuery, AnnotationSupport } from '@grafana/data'; import { InfluxQuery, InfluxQueryTag } from './types'; type LegacyAnnotation = { query?: string; queryType?: string; fromAnnotations?: boolean; tagsColumn?: string; textColumn?: string; timeEndColumn?: string; titleColumn?: string; name?: string; target?: { limit?: string | number | undefined; matchAny?: boolean; tags?: InfluxQueryTag[]; type?: string; }; }; // this becomes the target in the migrated annotations const migrateLegacyAnnotation = (json: LegacyAnnotation) => { // eslint-ignore-next-line const target: InfluxQuery = { refId: '', query: json.query ?? '', queryType: 'tags', fromAnnotations: true, tagsColumn: json.tagsColumn ?? '', textColumn: json.textColumn ?? '', timeEndColumn: json.timeEndColumn ?? '', titleColumn: json.titleColumn ?? '', name: json.name ?? '', }; // handle json target fields if (json.target && json.target.limit) { target.limit = json.target.limit; } if (json.target && json.target.matchAny) { target.matchAny = json.target.matchAny; } if (json.target && json.target.tags) { target.tags = json.target.tags; } if (json.target && json.target.type) { target.type = json.target.type; } return target; }; export const prepareAnnotation: AnnotationSupport<InfluxQuery, AnnotationQuery<InfluxQuery>>['prepareAnnotation'] = ( json ) => { // make sure that any additional target fields are migrated json.target = json.target && !json.target?.query ? migrateLegacyAnnotation(json) : json.target; return json; };
.
Edit
..
Edit
README.md
Edit
components
Edit
constants.ts
Edit
datasource.test.ts
Edit
datasource.ts
Edit
datasource_sql.test.ts
Edit
fsql
Edit
img
Edit
influx_query_model.test.ts
Edit
influx_query_model.ts
Edit
influx_series.test.ts
Edit
influx_series.ts
Edit
influxql_metadata_query.test.ts
Edit
influxql_metadata_query.ts
Edit
influxql_query_builder.test.ts
Edit
influxql_query_builder.ts
Edit
migrations.ts
Edit
mocks
Edit
module.ts
Edit
plugin.json
Edit
queryUtils.test.ts
Edit
queryUtils.ts
Edit
query_help.md
Edit
query_part.test.ts
Edit
query_part.ts
Edit
response_parser.test.ts
Edit
response_parser.ts
Edit
types.ts
Edit
variables.ts
Edit