From 978c61e65bcf72510e8c484b1493a33285dd6caa Mon Sep 17 00:00:00 2001 From: TheWitness Date: Sun, 4 Jun 2023 13:15:06 -0400 Subject: [PATCH] Fixing #4045 - URL does not update when searching When searching tree or list views, the URL does not update after changes --- CHANGELOG | 1 + include/layout.js | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 18a30409cf..615f741343 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Cacti CHANGELOG 1.2.25 -SECURITY#5318: Multiple minor stored XSS vulnerabilities in Cacti 1.2.24 -issue#2959: Multi-threaded cli/rebuild_poller_cache.php, deprecated push_out_hosts.php +-issue#4045: When searching tree or list views, the URL does not update after changes -issue#5254: Created a data source template to specify the snmp port, but it doesn't seem to work properly -issue#5255: Data query xml path with space problem -issue#5258: Warnings occur when installing thold plugin and as such thold will not upgrade correctly diff --git a/include/layout.js b/include/layout.js index a940fe764a..8e3ff26c96 100644 --- a/include/layout.js +++ b/include/layout.js @@ -3425,13 +3425,23 @@ function saveGraphFilter(section) { } function applyGraphFilter() { - var href = appendHeaderSuppression(graphPage+'?action='+pageAction+ - '&rfilter=' + base64_encode($('#rfilter').val())+ - (typeof $('#host_id').val() != 'undefined' ? '&host_id='+$('#host_id').val():'')+ - '&columns='+$('#columns').val()+ - '&graphs='+$('#graphs').val()+ - '&graph_template_id='+$('#graph_template_id').val()+ - '&thumbnails='+$('#thumbnails').is(':checked')); + statePushed = false; + + var href = appendHeaderSuppression(graphPage+'?action='+pageAction + + '&rfilter=' + base64_encode($('#rfilter').val()) + + (typeof $('#host_id').val() != 'undefined' ? '&host_id=' + $('#host_id').val():'') + + '&columns=' + $('#columns').val() + + '&graphs=' + $('#graphs').val() + + '&graph_template_id=' + $('#graph_template_id').val() + + '&thumbnails=' + $('#thumbnails').is(':checked')); + + /* replace myHref parameter for address bar update */ + const urlParams = new URLSearchParams(myHref); + urlParams.set('rfilter', base64_encode($('#rfilter').val())); + if (typeof $('#host_id').val() != 'undefined') { + urlParams.set('host_id', $('#host_id').val()); + } + myHref = urlParams.toString(); closeDateFilters();