Address code review feedback: improve efficiency and fix event bindings

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-26 17:31:52 +00:00
parent f02d74c4ed
commit 81bcdb4567
2 changed files with 10 additions and 9 deletions

View File

@@ -172,11 +172,13 @@ function queryRequest() {
if ($search != '') {
$search_lower = strtolower($search);
$filtered_monitors = array_filter($unfiltered_monitors, function($monitor) use ($search_lower) {
$Monitor = new ZM\Monitor($monitor);
// Search across common fields without creating Monitor object
return (
stripos($monitor['Name'], $search_lower) !== false ||
stripos($monitor['Function'], $search_lower) !== false ||
stripos($Monitor->Source(), $search_lower) !== false ||
stripos($monitor['Path'], $search_lower) !== false ||
stripos($monitor['Device'], $search_lower) !== false ||
stripos($monitor['Host'], $search_lower) !== false ||
stripos($monitor['Id'], $search_lower) !== false ||
(isset($monitor['Status']) && stripos($monitor['Status'], $search_lower) !== false)
);
@@ -197,8 +199,8 @@ function queryRequest() {
if (!preg_match("/^\/.+\/[a-z]*$/i", $regexp))
$regexp = '/'.$regexp.'/i';
$filtered_monitors = array_filter($filtered_monitors, function($monitor) use ($regexp) {
$Monitor = new ZM\Monitor($monitor);
return (preg_match($regexp, $Monitor->Source()) || preg_match($regexp, $Monitor->Path()));
// Match against Path field directly instead of creating Monitor object
return (preg_match($regexp, $monitor['Path']) || preg_match($regexp, $monitor['Device']) || preg_match($regexp, $monitor['Host']));
});
}

View File

@@ -44,7 +44,8 @@ function processRows(rows) {
// Determine status classes
var source_class = 'infoText';
var source_class_reason = '';
var fps_report_seconds = 60 + 30; // Simplified calculation
// FPS report interval: 60 seconds base + 30 seconds buffer for FPSReportInterval
var fps_report_seconds = 90;
if ((!row.Status || row.Status == 'NotRunning') && row.Type != 'WebSite') {
source_class = 'errorText';
@@ -158,9 +159,9 @@ function processRows(rows) {
return rows;
}
function setButtonStates(element) {
function setButtonStates() {
const selections = table.bootstrapTable('getSelections');
const form = element ? element.form : document.forms['monitorForm'];
const form = document.forms['monitorForm'];
if (selections && selections.length > 0) {
form.editBtn.disabled = false;
@@ -373,8 +374,6 @@ function initPage() {
$j('.functionLnk').click(manageFunctionModal);
});
$j('.functionLnk').click(manageFunctionModal);
// Makes table sortable - disabled by default, enabled by Sort button
// Note: This may need adjustment for bootstrap-table compatibility
$j('#consoleTableBody').sortable({