Triggers panel: remove 'default' from datasources list (cause error), iss #340

This commit is contained in:
Alexander Zobnin
2017-02-01 19:57:32 +03:00
parent f8d18c41f5
commit 658e436198

View File

@@ -61,13 +61,8 @@ class TriggerPanelEditorCtrl {
};
_.defaults(this, scopeDefaults);
// Get zabbix data sources
var datasources = _.filter(this.datasourceSrv.getMetricSources(), datasource => {
return datasource.meta.id === 'alexanderzobnin-zabbix-datasource';
});
this.datasources = _.map(datasources, 'name');
// Set default datasource
this.datasources = _.map(this.getZabbixDataSources(), 'name');
if (!this.panel.datasource) {
this.panel.datasource = this.datasources[0];
}
@@ -170,6 +165,13 @@ class TriggerPanelEditorCtrl {
isVariable(str) {
return utils.isTemplateVariable(str, this.templateSrv.variables);
}
getZabbixDataSources() {
let ZABBIX_DS_ID = 'alexanderzobnin-zabbix-datasource';
return _.filter(this.datasourceSrv.getMetricSources(), datasource => {
return datasource.meta.id === ZABBIX_DS_ID && datasource.value;
});
}
}
// Get list of metric names for bs-typeahead directive