Fixed templated items parsing (fixed regexps)

This commit is contained in:
Alexander Zobnin
2015-06-03 23:21:20 +03:00
parent 83c82a3481
commit 3a31b8b27c
2 changed files with 33 additions and 16 deletions

View File

@@ -25,12 +25,8 @@ function (angular, _, kbn) {
this.username = datasource.meta.username;
this.password = datasource.meta.password;
// Limit metrics per panel
this.limitmetrics = datasource.meta.limitmetrics || 20;
// For testing
this.ds = datasource;
this.auth = 'testauth'
// Limit metrics per panel for templated request
this.limitmetrics = datasource.meta.limitmetrics || 50;
}
@@ -81,12 +77,14 @@ function (angular, _, kbn) {
var hosts = hostname.match(host_pattern);
// Remove hostnames from item names and then
// Extract item names
// extract item names
// "hostname: itemname" --> "itemname"
var delete_hostname_pattern = /(?:\[[\w\.]+\]\:\s)/g;
var itemname_pattern = /([^{},]+)/g;
var remove_brackets_pattern = /^{|}$/g;
var itemname_split_pattern = /(,(?!\s))/g;
var itemnames = itemname.replace(delete_hostname_pattern, '')
.match(itemname_pattern);
.replace(remove_brackets_pattern, '')
.split(itemname_split_pattern);
//var aliases = itemname.match(itemname_pattern);
// Don't perform query for high number of items