Merge branch 'master' into triggers-panel-scroll

This commit is contained in:
Alexander Zobnin
2017-02-02 13:21:17 +03:00
95 changed files with 11542 additions and 14 deletions

View File

@@ -164,7 +164,7 @@ function setAliasByRegex(alias, timeseries) {
function extractText(str, pattern) {
var extractPattern = new RegExp(pattern);
var extractedValue = extractPattern.exec(str);
extractedValue = extractedValue[0]
extractedValue = extractedValue[0];
return extractedValue;
}

View File

@@ -394,7 +394,9 @@ class ZabbixAPIDatasource {
replaceTargetVariables(target, options) {
let parts = ['group', 'host', 'application', 'item'];
parts.forEach(p => {
target[p].filter = this.replaceTemplateVars(target[p].filter, options.scopedVars);
if (target[p] && target[p].filter) {
target[p].filter = this.replaceTemplateVars(target[p].filter, options.scopedVars);
}
});
target.textFilter = this.replaceTemplateVars(target.textFilter, options.scopedVars);

View File

@@ -181,7 +181,11 @@ export class ZabbixQueryController extends QueryCtrl {
*/
isContainsVariables() {
return _.some(['group', 'host', 'application'], field => {
return utils.isTemplateVariable(this.panel.triggers[field].filter, this.templateSrv.variables);
if (this.target[field] && this.target[field].filter) {
return utils.isTemplateVariable(this.target[field].filter, this.templateSrv.variables);
} else {
return false;
}
});
}

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

View File

@@ -31,8 +31,8 @@
{"name": "Metric Editor", "path": "img/screenshot-metric_editor.png"},
{"name": "Triggers", "path": "img/screenshot-triggers.png"}
],
"version": "3.2.0",
"updated": "2016-12-20"
"version": "3.2.1",
"updated": "2017-02-02"
},
"includes": [