diff --git a/include/themes/dark/main.js b/include/themes/dark/main.js index 82a8910bf8..4ef3706db9 100644 --- a/include/themes/dark/main.js +++ b/include/themes/dark/main.js @@ -126,10 +126,10 @@ function themeReady() { minLength: 0, select: function(event,ui) { $('#host_id').val(ui.item.id); - if (typeof applyFilter === 'function') { - applyFilter(); - }else{ + if (typeof applyGraphFilter === 'function') { applyGraphFilter(); + }else{ + applyFilter(); } } }).addClass('ui-state-default ui-selectmenu-text').css('border', 'none').css('background-color', 'transparent'); diff --git a/include/themes/modern/main.js b/include/themes/modern/main.js index ee287d6e53..f70b2e2a10 100644 --- a/include/themes/modern/main.js +++ b/include/themes/modern/main.js @@ -116,10 +116,10 @@ function themeReady() { minLength: 0, select: function(event,ui) { $('#host_id').val(ui.item.id); - if (typeof applyFilter === 'function') { - applyFilter(); - }else{ + if (typeof applyGraphFilter === 'function') { applyGraphFilter(); + }else{ + applyFilter(); } } }).addClass('ui-state-default ui-selectmenu-text').css('border', 'none').css('background-color', 'transparent'); diff --git a/lib/auth.php b/lib/auth.php index cd4ab31934..ee8eec326e 100644 --- a/lib/auth.php +++ b/lib/auth.php @@ -1254,16 +1254,15 @@ function get_host_array() { return $return_devices; } -function get_allowed_ajax_hosts($include_any = true, $include_none = true) { +function get_allowed_ajax_hosts($include_any = true, $include_none = true, $sql_where = '') { $return = array(); + $term = get_filter_request_var('term', FILTER_CALLBACK, array('options' => 'sanitize_search_string')); if ($term != '') { - $sql_where = "hostname LIKE '%$term%' OR description LIKE '%$term%' OR notes LIKE '%$term%'"; - }else{ - $sql_where = ""; + $sql_where .= (strlen($sql_where) ? ' AND ':'') . "hostname LIKE '%$term%' OR description LIKE '%$term%' OR notes LIKE '%$term%'"; } - $hosts = get_allowed_devices($sql_where, 'description', 30); + $hosts = get_allowed_devices($sql_where, 'description', 30); if (get_request_var('term') == '') { if ($include_any) { diff --git a/lib/html.php b/lib/html.php index 3581e0ac57..8e09f3d788 100644 --- a/lib/html.php +++ b/lib/html.php @@ -1342,7 +1342,7 @@ function html_graph_tabs_right($current_user) { } } -function html_host_filter($host_id = '-1', $call_back = 'applyFilter') { +function html_host_filter($host_id = '-1', $call_back = 'applyFilter', $sql_where = '') { $theme = get_selected_theme(); if ($theme == 'classic') { @@ -1355,7 +1355,7 @@ function html_host_filter($host_id = '-1', $call_back = 'applyFilter') { 0) { foreach ($hosts as $host) { diff --git a/lib/html_graph.php b/lib/html_graph.php index 20994954da..93390ed93e 100644 --- a/lib/html_graph.php +++ b/lib/html_graph.php @@ -133,10 +133,10 @@ function html_graph_preview_filter($page, $action, $devices_where = '', $templat ?> -
+ - + @@ -330,7 +330,7 @@ function html_graph_preview_filter($page, $action, $devices_where = '', $templat var graph_start=; var graph_end=; var timeOffset=; - var pageAction =''; + var pageAction = ''; var graphPage = ''; var date1Open = false; var date2Open = false;
Template