diff --git a/packages/grafana-runtime/src/services/templateSrv.ts b/packages/grafana-runtime/src/services/templateSrv.ts index 7b6fe6df195..36cc70df3a7 100644 --- a/packages/grafana-runtime/src/services/templateSrv.ts +++ b/packages/grafana-runtime/src/services/templateSrv.ts @@ -1,4 +1,4 @@ -import { VariableModel } from '@grafana/data'; +import { VariableModel, ScopedVars } from '@grafana/data'; /** * Via the TemplateSrv consumers get access to all the available template variables @@ -8,7 +8,15 @@ import { VariableModel } from '@grafana/data'; * @public */ export interface TemplateSrv { + /** + * List the dashboard variables + */ getVariables(): VariableModel[]; + + /** + * Replace the values within the target string. See also {@link InterpolateFunction} + */ + replace(target: string, scopedVars?: ScopedVars, format?: string | Function): string; } let singletonInstance: TemplateSrv; diff --git a/public/app/features/templating/template_srv.ts b/public/app/features/templating/template_srv.ts index 52f66c8363c..df55841d912 100644 --- a/public/app/features/templating/template_srv.ts +++ b/public/app/features/templating/template_srv.ts @@ -317,7 +317,7 @@ export class TemplateSrv implements BaseTemplateSrv { return scopedVar.value; } - replace(target: string, scopedVars?: ScopedVars, format?: string | Function): any { + replace(target: string, scopedVars?: ScopedVars, format?: string | Function): string { if (!target) { return target; } diff --git a/public/app/plugins/datasource/cloudwatch/datasource.ts b/public/app/plugins/datasource/cloudwatch/datasource.ts index c7ce5491684..f1ea1ea48c2 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.ts +++ b/public/app/plugins/datasource/cloudwatch/datasource.ts @@ -300,7 +300,7 @@ export class CloudWatchDatasource extends DataSourceApi