Replace Function monitor filter with Capturing, Analysing, Recording filters.

This commit is contained in:
Isaac Connor 2022-02-08 11:21:16 -05:00
parent dcf6e5da46
commit 01fad8a0dc
1 changed files with 24 additions and 21 deletions

View File

@ -21,14 +21,14 @@
require_once('includes/Monitor.php');
zm_session_start();
foreach ( array('GroupId','Function','ServerId','StorageId','Status','MonitorId','MonitorName','Source') as $var ) {
if ( isset($_REQUEST[$var]) ) {
if ( $_REQUEST[$var] != '' ) {
foreach (array('GroupId','Capturing','Analysing','Recording','ServerId','StorageId','Status','MonitorId','MonitorName','Source') as $var) {
if (isset($_REQUEST[$var])) {
if ($_REQUEST[$var] != '') {
$_SESSION[$var] = $_REQUEST[$var];
} else {
unset($_SESSION[$var]);
}
} else if ( isset($_REQUEST['filtering']) ) {
} else if (isset($_REQUEST['filtering'])) {
unset($_SESSION[$var]);
}
}
@ -36,7 +36,7 @@ session_write_close();
$storage_areas = ZM\Storage::find();
$StorageById = array();
foreach ( $storage_areas as $S ) {
foreach ($storage_areas as $S) {
$StorageById[$S->Id()] = $S;
}
$servers = ZM\Server::find(null, array('order'=>'lower(Name)'));
@ -81,7 +81,7 @@ $values = array();
if ( $groupSql )
$conditions[] = $groupSql;
foreach ( array('ServerId','StorageId','Status','Function') as $filter ) {
foreach ( array('ServerId','StorageId','Status','Capturing','Analysing','Recording') as $filter ) {
if ( isset($_SESSION[$filter]) ) {
if ( is_array($_SESSION[$filter]) ) {
$conditions[] = '`'.$filter . '` IN ('.implode(',', array_map(function(){return '?';}, $_SESSION[$filter])). ')';
@ -101,23 +101,26 @@ if ( !empty($user['MonitorIds']) ) {
$html .= '<span class="MonitorNameFilter"><label>'.translate('Name').'</label>';
$html .= '<input type="text" name="MonitorName" value="'.(isset($_SESSION['MonitorName'])?validHtmlStr($_SESSION['MonitorName']):'').'" placeholder="text or regular expression"/>';
$html .= '</span>
';
$html .= '</span>'.PHP_EOL;
$Functions = ZM\GetMonitorFunctionTypes();
function addFilterSelect($name, $options) {
$html .= '<span class="'.$name.'Filter"><label>'.translate($name).'</label>';
$html .= htmlSelect($name.'[]', $options,
(isset($_SESSION[$name])?$_SESSION[$name]:''),
array(
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',
)
);
$html .= '</span>'.PHP_EOL;
return $html;
}
$html .= '<span class="FunctionFilter"><label>'.translate('Function').'</label>';
$html .= htmlSelect('Function[]', $Functions,
(isset($_SESSION['Function'])?$_SESSION['Function']:''),
array(
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',
)
);
$html .= '</span>
';
$html .= addFilterSelect('Capturing', array('None'=>translate('None'), 'OnDemand'=>translate('On Demand')));
$html .= addFilterSelect('Analysing', array('None'=>translate('None'), 'Always'=>translate('Always')));
$html .= addFilterSelect('Recording', array('None'=>translate('None'), 'OnMotion'=>translate('On Motion'),'Always'=>translate('Always')));
if ( count($ServersById) > 1 ) {
$html .= '<span class="ServerFilter"><label>'. translate('Server').'</label>';