From 050153144f39ffd8222cd6d0004396b3d758868f Mon Sep 17 00:00:00 2001 From: loiclau Date: Thu, 5 Oct 2017 15:24:42 +0200 Subject: [PATCH] fix(monitoring) save filter between pages --- .../monitoring/status/Hosts/xml/hostXML.php | 10 ++++------ .../ServicesServiceGroups/serviceGridBySG.php | 6 ++++-- .../serviceGridBySGJS.php | 19 +++++++++---------- .../templates/serviceGrid.ihtml | 1 - .../xml/serviceGridBySGXML.php | 5 ++++- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/www/include/monitoring/status/Hosts/xml/hostXML.php b/www/include/monitoring/status/Hosts/xml/hostXML.php index ba42e27b633..73341e15be4 100644 --- a/www/include/monitoring/status/Hosts/xml/hostXML.php +++ b/www/include/monitoring/status/Hosts/xml/hostXML.php @@ -84,6 +84,10 @@ $statusHost = $obj->checkArgument("statusHost", $_GET, ""); $statusFilter = $obj->checkArgument("statusFilter", $_GET, ""); +/* Store in session the last type of call */ +$_SESSION['monitoring_host_status'] = $statusHost; +$_SESSION['monitoring_host_status_filter'] = $statusFilter; + if (isset($_GET['sort_type']) && $_GET['sort_type'] == "host_name") { $sort_type = "name"; } else { @@ -95,12 +99,6 @@ } $criticality_id = $obj->checkArgument('criticality', $_GET, $obj->defaultCriticality); -/* Store in session the last type of call */ -if (isset($_GET['sSetOrderInMemory']) && $_GET['sSetOrderInMemory'] == "1") { - $_SESSION['monitoring_host_status'] = $statusHost; - $_SESSION['monitoring_host_status_filter'] = $statusFilter; -} - /* * Backup poller selection */ diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php index ed899ca4781..a04c1aae937 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php @@ -57,7 +57,10 @@ if (isset($_GET["host_search"])) { $centreon->historySearch[$url] = $_GET["host_search"]; } - +if (isset($_SESSION['monitoring_service_groups'])) { + $sg_search = $_SESSION['monitoring_service_groups']; +} + $aTypeAffichageLevel1 = array( "svcOVSG" => _("Details"), "svcSumSG" => _("Summary") @@ -69,7 +72,6 @@ "ack_1" => _("Acknowledge"), "ack_0" => _("Not Acknowledged"), ); - $tab_class = array("0" => "list_one", "1" => "list_two"); $rows = 10; diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php index 0bc6700ee52..188baa0d6e5 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php @@ -118,7 +118,7 @@ function mainLoopLocal() { if ((_currentInputFieldValue.length >= 3 || _currentInputFieldValue.length == 0) && _oldInputFieldValue != _currentInputFieldValue){ if (!_lock) { set_search_host(escapeURI(_currentInputFieldValue)); - _search = _currentInputFieldValue; + _host_search = _currentInputFieldValue; monitoring_refresh(); @@ -137,30 +137,29 @@ function initM(_time_reload, _sid, _o ){ // INIT Select objects construct_selecteList_ndo_instance('instance_selected'); - construct_HostGroupSelectList('hostgroups_selected'); 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").value.length === 0) { + viewDebugInfo('search: ' + document.getElementById("host_search").value); + } else if (document.getElementById("host_search").length == 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); + viewDebugInfo('search: ' + document.getElementById("sg_search").value); } else if (document.getElementById("sg_search").value.length === 0) { _sg_search = ""; } - - if (_first){ + + if (_first) { mainLoopLocal(); _first = 0; } - _time=; + _time =; if (_on) { - goM(_time_reload,_sid,_o); + goM(_time_reload, _sid, _o); } } diff --git a/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml b/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml index 3e348c1d498..56db8bc7a3b 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml +++ b/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml @@ -38,7 +38,6 @@ Play Pause Pause - diff --git a/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php b/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php index 8224fdf8469..7974a50e35d 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php +++ b/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php @@ -47,7 +47,7 @@ /* * Create XML Request Objects */ -CentreonSession::start(1); +CentreonSession::start(); $obj = new CentreonXMLBGRequest(session_id(), 1, 1, 0, 1); $svcObj = new CentreonService($obj->DB); @@ -83,6 +83,9 @@ */ $obj->setInstanceHistory($instance); + +$_SESSION['monitoring_service_groups'] = $sgSearch; + /** ********************************************** * Prepare pagination */