Transformers: Add template variable substitution (#44486)

* Transformers: Add template variable replacement to transformer operator

* Transformers: Add template variable replacement to calculateField transformer

* Transformers: Add scopedVars to transformer template replacement

* Transformers: Add calculateField template variable test

* Transformers: Fix 'undefined' is not assignable to type 'string'

* Transformers: Fix lint-frontend bug

* Fix lint check

* Fix lint
This commit is contained in:
Tom
2022-03-18 05:25:53 -05:00
committed by GitHub
parent 52bd7618dd
commit ea7d5a6185
5 changed files with 90 additions and 4 deletions

View File

@@ -183,6 +183,13 @@ export class PanelQueryRunner {
return of(data);
}
const replace = (option: string): string => {
return getTemplateSrv().replace(option, data?.request?.scopedVars);
};
transformations.forEach((transform: any) => {
transform.replace = replace;
});
return transformDataFrame(transformations, data.series).pipe(map((series) => ({ ...data, series })));
})
);