From f6598a023f4757a4fa93ff3bbc013ecf79b123cf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 7 Jan 2026 01:47:21 +0000 Subject: [PATCH] Add monitorFilterOnChange function for AJAX filter updates on console view Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com> --- web/skins/classic/views/_monitor_filters.php | 19 +++++++++++++------ web/skins/classic/views/js/console.js | 11 +++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/web/skins/classic/views/_monitor_filters.php b/web/skins/classic/views/_monitor_filters.php index 6fbd58416..f7bfaad1e 100644 --- a/web/skins/classic/views/_monitor_filters.php +++ b/web/skins/classic/views/_monitor_filters.php @@ -19,12 +19,16 @@ // function addFilterSelect($name, $options) { + global $view; + // Use monitorFilterOnChange on console view for AJAX refresh, submitThisForm elsewhere + $onChangeFunction = ($view == 'console') ? 'monitorFilterOnChange' : 'submitThisForm'; + $html = ''; $html .= ''; $html .= htmlSelect($name.'[]', $options, (isset($_SESSION[$name])?$_SESSION[$name]:''), array( - 'data-on-change'=>'submitThisForm', + 'data-on-change'=>$onChangeFunction, 'class'=>'chosen', 'multiple'=>'multiple', 'data-placeholder'=>'All', @@ -52,8 +56,11 @@ function addButtonResetForFilterSelect($nameSelect) { } function buildMonitorsFilters() { - global $user, $Servers; + global $user, $Servers, $view; require_once('includes/Monitor.php'); + + // Use monitorFilterOnChange on console view for AJAX refresh, submitThisForm elsewhere + $onChangeFunction = ($view == 'console') ? 'monitorFilterOnChange' : 'submitThisForm'; zm_session_start(); foreach (array('GroupId','Capturing','Analysing','Recording','ServerId','StorageId','Status','MonitorId','MonitorName','Source') as $var) { @@ -151,7 +158,7 @@ function buildMonitorsFilters() { $html .= htmlSelect('ServerId[]', $ServersById, (isset($_SESSION['ServerId'])?$_SESSION['ServerId']:''), array( - 'data-on-change'=>'submitThisForm', + 'data-on-change'=>$onChangeFunction, 'class'=>'chosen', 'multiple'=>'multiple', 'data-placeholder'=>'All', @@ -168,7 +175,7 @@ function buildMonitorsFilters() { $html .= htmlSelect('StorageId[]', $StorageById, (isset($_SESSION['StorageId'])?$_SESSION['StorageId']:''), array( - 'data-on-change'=>'submitThisForm', + 'data-on-change'=>$onChangeFunction, 'class'=>'chosen', 'multiple'=>'multiple', 'data-placeholder'=>'All', @@ -189,7 +196,7 @@ function buildMonitorsFilters() { $html .= htmlSelect( 'Status[]', $status_options, ( isset($_SESSION['Status']) ? $_SESSION['Status'] : '' ), array( - 'data-on-change'=>'submitThisForm', + 'data-on-change'=>$onChangeFunction, 'class'=>'chosen', 'multiple'=>'multiple', 'data-placeholder'=>'All' @@ -296,7 +303,7 @@ function buildMonitorsFilters() { $html .= ''; $html .= htmlSelect('MonitorId[]', $monitors_dropdown, $selected_monitor_ids, array( - 'data-on-change'=>'submitThisForm', + 'data-on-change'=>$onChangeFunction, 'class'=>'chosen', 'multiple'=>'multiple', 'data-placeholder'=>'All', diff --git a/web/skins/classic/views/js/console.js b/web/skins/classic/views/js/console.js index 970f9961b..c29d74133 100644 --- a/web/skins/classic/views/js/console.js +++ b/web/skins/classic/views/js/console.js @@ -384,6 +384,17 @@ function manageFunctionModal(evt) { $j('#modalFunction').modal('show'); } // end function manageFunctionModal +// Called when monitor filters change - refreshes table via AJAX instead of full page reload +function monitorFilterOnChange() { + // On console view with bootstrap-table, just refresh the table + if (typeof table !== 'undefined' && table.length) { + table.bootstrapTable('refresh'); + } else { + // Fall back to full page reload on other views + submitThisForm(); + } +} + function initPage() { // Init the bootstrap-table table.bootstrapTable({icons: icons});