only expose monitor info which are being used in client

This commit is contained in:
Heng Liu 2015-10-02 20:04:10 -07:00
parent 2fd6cbe742
commit 59b0675588
2 changed files with 10 additions and 6 deletions

View File

@ -22,7 +22,7 @@ function createEventHtml( event, frame )
if ( event.Archived > 0 )
eventHtml.addClass( 'archived' );
new Element( 'p' ).inject( eventHtml ).set( 'text', monitorNames[event.MonitorId] );
new Element( 'p' ).inject( eventHtml ).set( 'text', monitors[event.MonitorId].Name );
new Element( 'p' ).inject( eventHtml ).set( 'text', event.Name+(frame?("("+frame.FrameId+")"):"") );
new Element( 'p' ).inject( eventHtml ).set( 'text', event.StartTime+" - "+event.Length+"s" );
new Element( 'p' ).inject( eventHtml ).set( 'text', event.Cause );

View File

@ -1,17 +1,21 @@
var filterQuery = '<?php echo validJsStr($filterQuery) ?>';
var monitorNames = {};
<?php
$jsMonitors = array();
$fields = array('Name', 'SaveJPEGs', 'VideoWriter');
foreach ( $monitors as $monitor )
{
if ( !empty($monitorIds[$monitor['Id']]) )
{
?>
monitorNames[<?php echo $monitor['Id'] ?>] = '<?php echo validJsStr($monitor['Name']) ?>';
<?php
$jsMonitor = array();
foreach ($fields as $field)
{
$jsMonitor[$field] = $monitor[$field];
}
$jsMonitors[$monitor['Id']] = $jsMonitor;
}
}
?>
var monitors = <?php echo json_encode($monitors) ?>;
var monitors = <?php echo json_encode($jsMonitors) ?>;
var archivedString = "<?php echo translate('Archived') ?>";