diff --git a/www/include/monitoring/status/Common/commonJS.php b/www/include/monitoring/status/Common/commonJS.php index 8f1e47c5596..ba349b8daa5 100644 --- a/www/include/monitoring/status/Common/commonJS.php +++ b/www/include/monitoring/status/Common/commonJS.php @@ -58,6 +58,7 @@ var _search = 'historySearchService[$url]) ? $centreon->historySearchService[$url] : ""));?>'; var _host_search = 'historySearch[$url]) ? $centreon->historySearch[$url] : "")); ?>'; +var _sg_search = 'historySearch[$url]) ? $centreon->historySearch[$url] : "")); ?>'; var _output_search = 'historySearchOutput[$url]) ? $centreon->historySearchOutput[$url] : "")); ?>'; var _num=''; diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php index a4a653a7e63..07cd9def285 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php @@ -80,14 +80,30 @@ $tpl->assign('pollerStr', _('Poller')); $tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing')); $tpl->assign("mon_status_information", _("Status information")); - - + + /* + * Get servicegroups list + */ + $query = "SELECT DISTINCT sg.sg_name FROM servicegroup sg"; + $DBRESULT = $pearDB->query($query); + $sgSearchSelect = ''; + $tpl->assign("sgSearchSelect", $sgSearchSelect); + + $form = new HTML_QuickForm('select_form', 'GET', "?p=".$p); - - $tpl->assign("order", strtolower($order)); $tab_order = array("sort_asc" => "sort_desc", "sort_desc" => "sort_asc"); $tpl->assign("tab_order", $tab_order); + + + + ##Toolbar select $lang["lgd_more_actions"] diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php index aa1c0dd3554..17260f8821b 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php @@ -125,6 +125,10 @@ function mainLoopLocal() { } } _oldInputFieldValue = _currentInputFieldValue; + + jQuery("#sg_search").on('change', function(){ + monitoring_refresh(); + }); setTimeout("mainLoopLocal()", 250); } @@ -136,10 +140,17 @@ function initM(_time_reload, _sid, _o ){ construct_HostGroupSelectList('hostgroups_selected'); if (document.getElementById("host_search") && document.getElementById("host_search").value) { - _search = document.getElementById("host_search").value; + _host_search = document.getElementById("host_search").value; viewDebugInfo('search: '+document.getElementById("host_search").value); - } else if (document.getElementById("host_search").lenght == 0) { - _search = ""; + } else if (document.getElementById("host_search").lenght === 0) { + _host_search = ""; + } + + if (document.getElementById("sg_search") && document.getElementById("sg_search").value) { + _sg_search = document.getElementById("sg_search").value; + viewDebugInfo('search: '+document.getElementById("sg_search").value); + } else if (document.getElementById("sg_search").lenght == 0) { + _sg_search = ""; } if (_first){ @@ -157,12 +168,13 @@ function goM(_time_reload, _sid, _o) { _lock = 1; var proc = new Transformation(); proc.setCallback(monitoringCallBack); - proc.setXml(_addrXML+"?"+'sid='+_sid+'&search='+_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); + proc.setXml(_addrXML+"?"+'sid='+_sid+'&host_search='+_host_search+'&sg_search='+_sg_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); proc.setXslt(_addrXSL); proc.transform("forAjax"); if (_counter == 0) { document.getElementById("host_search").value = _host_search; + document.getElementById("sg_search").value = _sg_search; _counter += 1; } diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php index d762195df25..4bc97c341d4 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php @@ -48,6 +48,7 @@ !isset($_GET["search_type_service"]) ? $search_type_service = 1 : $search_type_service = $_GET["search_type_service"]; !isset($_GET["sort_type"]) ? $sort_type = "host_name" : $sort_type = $_GET["sort_type"]; !isset($_GET["host_search"]) ? $host_search = 0 : $host_search = $_GET["host_search"]; + !isset($_GET["sg_search"]) ? $sg_search = 0 : $sg_search = $_GET["sg_search"]; /* * Check search value in Host search field @@ -55,6 +56,13 @@ if (isset($_GET["host_search"])) { $centreon->historySearch[$url] = $_GET["host_search"]; } + + /* + * Check search value in Service Group search field + */ + if (isset($_GET["sg_search"])) { + $centreon->historySearch[$url] = $_GET["sg_search"]; + } $tab_class = array("0" => "list_one", "1" => "list_two"); $rows = 10; @@ -79,6 +87,21 @@ $tpl->assign('pollerStr', _('Poller')); $tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing')); $tpl->assign("mon_status_information", _("Status information")); + + + /* + * Get servicegroups list + */ + $query = "SELECT DISTINCT sg.sg_name FROM servicegroup sg"; + $DBRESULT = $pearDB->query($query); + $sgSearchSelect = ''; + $tpl->assign("sgSearchSelect", $sgSearchSelect); $form = new HTML_QuickForm('select_form', 'GET', "?p=".$p); diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php index 0808129be7b..ba0b995f489 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php @@ -104,6 +104,7 @@ function mainLoopLocal() { if (!_lock) { set_search_host(escapeURI(_currentInputFieldValue)); _host_search = _currentInputFieldValue; + _sg_search = _currentInputFieldValue; monitoring_refresh(); @@ -115,6 +116,10 @@ function mainLoopLocal() { } } _oldInputFieldValue = _currentInputFieldValue; + + jQuery("#sg_search").on('change', function(){ + monitoring_refresh(); + }); setTimeout("mainLoopLocal()", 250); } @@ -128,9 +133,16 @@ function initM(_time_reload, _sid, _o ){ if (document.getElementById("host_search") && document.getElementById("host_search").value) { _host_search = document.getElementById("host_search").value; viewDebugInfo('search: '+document.getElementById("host_search").value); - } else if (document.getElementById("host_search").lenght == 0) { + } else if (document.getElementById("host_search").lenght === 0) { _host_search = ""; } + + if (document.getElementById("sg_search") && document.getElementById("sg_search").value) { + _sg_search = document.getElementById("sg_search").value; + viewDebugInfo('search: '+document.getElementById("sg_search").value); + } else if (document.getElementById("sg_search").lenght == 0) { + _sg_search = ""; + } if (_first){ mainLoopLocal(); @@ -147,12 +159,13 @@ function goM(_time_reload, _sid, _o) { _lock = 1; var proc = new Transformation(); proc.setCallback(monitoringCallBack); - proc.setXml(_addrXML+"?"+'sid='+_sid+'&search='+_host_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); + proc.setXml(_addrXML+"?"+'sid='+_sid+'&host_search='+_host_search+'&sg_search='+_sg_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); proc.setXslt(_addrXSL); proc.transform("forAjax"); if (_counter == 0) { document.getElementById("host_search").value = _host_search; + document.getElementById("sg_search").value = _sg_search; _counter += 1; } diff --git a/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml b/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml index ba11b38213b..703c4281fe2 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml +++ b/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml @@ -6,6 +6,7 @@