Commit 6b071054 by srid12 Committed by Torkel Ödegaard

changing callback fn into arrow functions for correct usage of this (#12673)

parent a17a9218
...@@ -480,17 +480,17 @@ export default class OpenTsDatasource { ...@@ -480,17 +480,17 @@ export default class OpenTsDatasource {
mapMetricsToTargets(metrics, options, tsdbVersion) { mapMetricsToTargets(metrics, options, tsdbVersion) {
var interpolatedTagValue, arrTagV; var interpolatedTagValue, arrTagV;
return _.map(metrics, function(metricData) { return _.map(metrics, metricData => {
if (tsdbVersion === 3) { if (tsdbVersion === 3) {
return metricData.query.index; return metricData.query.index;
} else { } else {
return _.findIndex(options.targets, function(target) { return _.findIndex(options.targets, target => {
if (target.filters && target.filters.length > 0) { if (target.filters && target.filters.length > 0) {
return target.metric === metricData.metric; return target.metric === metricData.metric;
} else { } else {
return ( return (
target.metric === metricData.metric && target.metric === metricData.metric &&
_.every(target.tags, function(tagV, tagK) { _.every(target.tags, (tagV, tagK) => {
interpolatedTagValue = this.templateSrv.replace(tagV, options.scopedVars, 'pipe'); interpolatedTagValue = this.templateSrv.replace(tagV, options.scopedVars, 'pipe');
arrTagV = interpolatedTagValue.split('|'); arrTagV = interpolatedTagValue.split('|');
return _.includes(arrTagV, metricData.tags[tagK]) || interpolatedTagValue === '*'; return _.includes(arrTagV, metricData.tags[tagK]) || interpolatedTagValue === '*';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment