fix t.replace is not a function, #661

This commit is contained in:
Alexander Zobnin
2019-02-12 22:26:40 +03:00
parent b1327bb559
commit 1913430f37
2 changed files with 13 additions and 5 deletions

View File

@@ -108,6 +108,9 @@ export class ZabbixDatasource {
// Prevent changes of original object
let target = _.cloneDeep(t);
// Migrate old targets
target = migrations.migrate(target);
this.replaceTargetVariables(target, options);
// Apply Time-related functions (timeShift(), etc)
@@ -123,9 +126,6 @@ export class ZabbixDatasource {
// Metrics or Text query mode
if (!target.mode || target.mode === c.MODE_METRICS || target.mode === c.MODE_TEXT) {
// Migrate old targets
target = migrations.migrate(target);
// Don't request undefined targets
if (!target.group || !target.host || !target.item) {
return [];
@@ -534,6 +534,7 @@ export class ZabbixDatasource {
let enabled_targets = filterEnabledTargets(options.targets);
let getPanelItems = _.map(enabled_targets, t => {
let target = _.cloneDeep(t);
target = migrations.migrate(target);
this.replaceTargetVariables(target, options);
return this.zabbix.getItemsFromTarget(target, {itemtype: 'num'});
});