mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-29 19:22:02 -04:00
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:
@@ -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']));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user