Support template variables in functions, fixes #205.
This commit is contained in:
@@ -90,6 +90,12 @@ export class ZabbixAPIDatasource {
|
|||||||
target.item.filter = this.replaceTemplateVars(target.item.filter, options.scopedVars);
|
target.item.filter = this.replaceTemplateVars(target.item.filter, options.scopedVars);
|
||||||
target.textFilter = this.replaceTemplateVars(target.textFilter, options.scopedVars);
|
target.textFilter = this.replaceTemplateVars(target.textFilter, options.scopedVars);
|
||||||
|
|
||||||
|
_.forEach(target.functions, func => {
|
||||||
|
func.params = _.map(func.params, param => {
|
||||||
|
return this.templateSrv.replace(param, options.scopedVars);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Query numeric data
|
// Query numeric data
|
||||||
if (!target.mode || target.mode === 0) {
|
if (!target.mode || target.mode === 0) {
|
||||||
return this.queryNumericData(target, timeFrom, timeTo, useTrends);
|
return this.queryNumericData(target, timeFrom, timeTo, useTrends);
|
||||||
@@ -417,6 +423,13 @@ function bindFunctionDefs(functionDefs, category) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterFunctionDefs(funcs, category) {
|
||||||
|
let filteredFuncs = _.map(metricFunctions.getCategories()[category]);
|
||||||
|
return _.filter(funcs, func => {
|
||||||
|
return _.contains(filteredFuncs, func.def.name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function formatMetric(metricObj) {
|
function formatMetric(metricObj) {
|
||||||
return {
|
return {
|
||||||
text: metricObj.name,
|
text: metricObj.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user