Fixed expandItemName() in query editor (no need to expand templated item name in editor).

Improve hosts and items search - return only monitored hosts and enabled items.
This commit is contained in:
Alexander Zobnin
2015-05-30 21:12:33 +03:00
parent 46c9fa90be
commit 4ab1fb4568
2 changed files with 14 additions and 8 deletions

View File

@@ -247,7 +247,9 @@ function (angular, _, kbn) {
output: ['name', 'host'], output: ['name', 'host'],
sortfield: 'name', sortfield: 'name',
// Return only hosts that have items with numeric type of information. // Return only hosts that have items with numeric type of information.
with_simple_graph_items: true with_simple_graph_items: true,
// Return only monitored hosts.
monitored_hosts: true
}; };
// Return only hosts in given group // Return only hosts in given group
if (groupids) { if (groupids) {
@@ -285,6 +287,8 @@ function (angular, _, kbn) {
filter: { filter: {
value_type: [0,3] value_type: [0,3]
}, },
// Return only enabled items
monitored: true,
searchByAny: true searchByAny: true
}; };
if (hostids) { if (hostids) {

View File

@@ -222,14 +222,16 @@ function (angular, _) {
var name = item.name; var name = item.name;
var key = item.key_; var key = item.key_;
// extract params from key: if (key) {
// "system.cpu.util[,system,avg1]" --> ["", "system", "avg1"] // extract params from key:
var key_params = key.substring(key.indexOf('[') + 1, key.lastIndexOf(']')).split(','); // "system.cpu.util[,system,avg1]" --> ["", "system", "avg1"]
var key_params = key.substring(key.indexOf('[') + 1, key.lastIndexOf(']')).split(',');
// replace item parameters // replace item parameters
for (var i = key_params.length; i >= 1; i--) { for (var i = key_params.length; i >= 1; i--) {
name = name.replace('$' + i, key_params[i - 1]); name = name.replace('$' + i, key_params[i - 1]);
}; };
}
return name; return name;
}; };