Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas
This commit is contained in:
commit
348468a98d
|
@ -160,9 +160,12 @@ sub Sql {
|
|||
if ( $term->{attr} =~ /^Monitor/ ) {
|
||||
my ( $temp_attr_name ) = $term->{attr} =~ /^Monitor(.+)$/;
|
||||
$self->{Sql} .= 'M.'.$temp_attr_name;
|
||||
} elsif ( $term->{attr} =~ /^Server/ ) {
|
||||
} elsif ( $term->{attr} eq 'ServerId' or $term->{attr} eq 'MonitorServerId' ) {
|
||||
$self->{Sql} .= 'M.'.$term->{attr};
|
||||
} elsif ( $term->{attr} eq 'StorageServerId' ) {
|
||||
$self->{Sql} .= 'S.'.$term->{attr};
|
||||
|
||||
} elsif ( $term->{attr} eq 'FilterServerId' ) {
|
||||
$self->{Sql} .= $Config{ZM_SERVER_ID};
|
||||
# StartTime options
|
||||
} elsif ( $term->{attr} eq 'DateTime' ) {
|
||||
$self->{Sql} .= 'E.StartTime';
|
||||
|
@ -208,7 +211,7 @@ sub Sql {
|
|||
foreach my $temp_value ( split( /["'\s]*?,["'\s]*?/, $stripped_value ) ) {
|
||||
if ( $term->{attr} =~ /^MonitorName/ ) {
|
||||
$value = "'$temp_value'";
|
||||
} elsif ( $term->{attr} eq 'ServerId' ) {
|
||||
} elsif ( $term->{attr} =~ /ServerId/) {
|
||||
Debug("ServerId, temp_value is ($temp_value) ($ZoneMinder::Config::Config{ZM_SERVER_ID})");
|
||||
if ( $temp_value eq 'ZM_SERVER_ID' ) {
|
||||
$value = "'$ZoneMinder::Config::Config{ZM_SERVER_ID}'";
|
||||
|
@ -241,7 +244,7 @@ sub Sql {
|
|||
}
|
||||
$value = "'$value'";
|
||||
}
|
||||
} elsif ( $term->{attr} eq 'Date' or $term->{attr} eq 'StartDate' or $term->{attr} eq 'EndDate' ) {
|
||||
} elsif ( $term->{attr} eq 'Date' or $term->{attr} eq 'StartDate' or $term->{attr} eq 'EndDate' ) {
|
||||
if ( $temp_value eq 'NULL' ) {
|
||||
$value = $temp_value;
|
||||
} else {
|
||||
|
|
|
@ -346,14 +346,13 @@ sub run {
|
|||
}
|
||||
close(CLIENT);
|
||||
} else {
|
||||
Fatal('Bogus descriptor');
|
||||
Error('Bogus descriptor');
|
||||
}
|
||||
} elsif ( $nfound < 0 ) {
|
||||
if ( $! == EINTR ) {
|
||||
# Dead child, will be reaped
|
||||
#print( "Probable dead child\n" );
|
||||
# See if it needs to start up again
|
||||
restartPending();
|
||||
} elsif ( $! == EPIPE ) {
|
||||
Error("Can't select: $!");
|
||||
} else {
|
||||
|
@ -361,12 +360,13 @@ sub run {
|
|||
}
|
||||
} else {
|
||||
#print( "Select timed out\n" );
|
||||
restartPending();
|
||||
}
|
||||
|
||||
restartPending();
|
||||
check_for_processes_to_kill();
|
||||
|
||||
} # end while
|
||||
|
||||
dPrint(ZoneMinder::Logger::INFO, 'Server exiting at '
|
||||
.strftime( '%y/%m/%d %H:%M:%S', localtime() )
|
||||
."\n"
|
||||
|
@ -530,7 +530,7 @@ sub check_for_processes_to_kill {
|
|||
foreach my $command ( %terminating_processes ) {
|
||||
my $process = $cmd_hash{$command};
|
||||
Debug("Have process $command at pid $$process{pid} $$process{term_sent_at}");
|
||||
if ( $$process{term_sent_at} - time > KILL_DELAY ) {
|
||||
if ( $$process{term_sent_at} and ( $$process{term_sent_at} - time > KILL_DELAY ) ) {
|
||||
dPrint(ZoneMinder::Logger::WARNING, "'$$process{command}' has not stopped at "
|
||||
.strftime('%y/%m/%d %H:%M:%S', localtime())
|
||||
.' after ' . KILL_DELAY . ' seconds.'
|
||||
|
|
|
@ -13,7 +13,7 @@ class Storage {
|
|||
if ( ! $row ) {
|
||||
Error("Unable to load Storage record for Id=" . $IdOrRow );
|
||||
}
|
||||
} elseif ( is_array( $IdOrRow ) ) {
|
||||
} else if ( is_array($IdOrRow) ) {
|
||||
$row = $IdOrRow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ function dbQuery( $sql, $params=NULL ) {
|
|||
}
|
||||
} else {
|
||||
if ( defined('ZM_DB_DEBUG') ) {
|
||||
Logger::Debug("SQL: $sql values:" . $params?implode(',',$params):'' );
|
||||
Logger::Debug("SQL: $sql values:" . ($params?implode(',',$params):'') );
|
||||
}
|
||||
$result = $dbConn->query($sql);
|
||||
}
|
||||
|
|
|
@ -1025,8 +1025,15 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
$filter['sql'] .= 'M.'.preg_replace('/^Monitor/', '', $terms[$i]['attr']);
|
||||
break;
|
||||
case 'ServerId':
|
||||
case 'MonitorServerId':
|
||||
$filter['sql'] .= 'M.ServerId';
|
||||
break;
|
||||
case 'StorageServerId':
|
||||
$filter['sql'] .= 'S.ServerId';
|
||||
break;
|
||||
case 'FilterServerId':
|
||||
$filter['sql'] .= ZM_SERVER_ID;
|
||||
break;
|
||||
# Unspecified start or end, so assume start, this is to support legacy filters
|
||||
case 'DateTime':
|
||||
$filter['sql'] .= 'E.StartTime';
|
||||
|
@ -1121,6 +1128,9 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
case 'Notes':
|
||||
$value = dbEscape($value);
|
||||
break;
|
||||
case 'MonitorServerId':
|
||||
case 'FilterServerId':
|
||||
case 'StorageServerId':
|
||||
case 'ServerId':
|
||||
if ( $value == 'ZM_SERVER_ID' ) {
|
||||
$value = ZM_SERVER_ID;
|
||||
|
|
|
@ -130,7 +130,9 @@ $SLANG = array(
|
|||
'AttrMonitorId' => 'Monitor Id',
|
||||
'AttrMonitorName' => 'Monitor Name',
|
||||
'AttrStorageArea' => 'Storage Area',
|
||||
'AttrServer' => 'Server',
|
||||
'AttrFilterServer' => 'Server Filter is Running On',
|
||||
'AttrMonitorServer' => 'Server Monitor is Running On',
|
||||
'AttrStorageServer' => 'Server Hosting Storage',
|
||||
'AttrStateId' => 'Run State',
|
||||
'AttrName' => 'Name',
|
||||
'AttrNotes' => 'Notes',
|
||||
|
|
|
@ -101,7 +101,10 @@ $attrTypes = array(
|
|||
'DiskSpace' => translate('AttrDiskSpace'),
|
||||
'SystemLoad' => translate('AttrSystemLoad'),
|
||||
'StorageId' => translate('AttrStorageArea'),
|
||||
'ServerId' => translate('AttrServer'),
|
||||
'ServerId' => translate('AttrMonitorServer'),
|
||||
'FilterServerId' => translate('AttrFilterServer'),
|
||||
'MonitorServerId' => translate('AttrMonitorServer'),
|
||||
'StorageServerId' => translate('AttrStorageServer'),
|
||||
'StateId' => translate('AttrStateId'),
|
||||
);
|
||||
|
||||
|
@ -268,7 +271,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
|
|||
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
|
||||
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $monitors, $term['val'] ); ?></td>
|
||||
<?php
|
||||
} elseif ( $term['attr'] == 'ServerId' ) {
|
||||
} elseif ( $term['attr'] == 'ServerId' || $term['attr'] == 'MonitorServerId' || $term['attr'] == 'StorageServerId' || $term['attr'] == 'FilterServerId' ) {
|
||||
?>
|
||||
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
|
||||
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $servers, $term['val'] ); ?></td>
|
||||
|
|
|
@ -142,7 +142,9 @@ function parseRows (rows) {
|
|||
inputTds.eq(6).find(':input[value="-"]').prop('disabled', false);
|
||||
}
|
||||
|
||||
if (inputTds.eq(2).children().val() == "Archived") { //Archived types
|
||||
var attr = inputTds.eq(2).children().val();
|
||||
|
||||
if ( attr == "Archived") { //Archived types
|
||||
inputTds.eq(3).html('equal to<input type="hidden" name="filter[Query][terms][' + rowNum + '][op]" value="=">');
|
||||
let archiveSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (let i = 0; i < archiveTypes.length; i++) {
|
||||
|
@ -151,7 +153,7 @@ function parseRows (rows) {
|
|||
let archiveVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"});
|
||||
|
||||
} else if (inputTds.eq(2).children().val().indexOf('Weekday') >= 0) { //Weekday selection
|
||||
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
|
||||
let weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (let i = 0; i < weekdays.length; i++) {
|
||||
weekdaySelect.append('<option value="' + i + '">' + weekdays[i] + '</option>');
|
||||
|
@ -159,7 +161,7 @@ function parseRows (rows) {
|
|||
let weekdayVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal).chosen({width: "101%"});
|
||||
|
||||
} else if (inputTds.eq(2).children().val() == 'StateId') { //Run state
|
||||
} else if ( attr == 'StateId' ) { //Run state
|
||||
let stateSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (let key in states) {
|
||||
stateSelect.append('<option value="' + key + '">' + states[key] + '</option>');
|
||||
|
@ -167,8 +169,7 @@ function parseRows (rows) {
|
|||
let stateVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(stateSelect).children().val(stateVal).chosen({width: "101%"});
|
||||
|
||||
|
||||
} else if (inputTds.eq(2).children().val() == 'ServerId') { //Select Server
|
||||
} else if ( attr == 'ServerId' || attr == 'MonitorServerId' || attr == 'StorageServerId' || attr == 'FilterServerId' ) { //Select Server
|
||||
let serverSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (let key in servers) {
|
||||
serverSelect.append('<option value="' + key + '">' + servers[key] + '</option>');
|
||||
|
@ -176,21 +177,15 @@ function parseRows (rows) {
|
|||
let serverVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"});
|
||||
|
||||
} else if (inputTds.eq(2).children().val() == 'StorageId') { //Choose by storagearea
|
||||
} else if ( attr == 'StorageId' ) { //Choose by storagearea
|
||||
let storageSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for ( key in storageareas ) {
|
||||
console.log(key + ' ' + storageareas[key]);
|
||||
storageSelect.append('<option value="' + key + '">' + storageareas[key] + '</option>');
|
||||
}
|
||||
/*
|
||||
for (let i=0; i < storageareas.length; i++) {
|
||||
storageSelect.append('<option value="' + i + '">' + storageareas[i] + '</option>');
|
||||
}
|
||||
*/
|
||||
let storageVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"});
|
||||
|
||||
} else if (inputTds.eq(2).children().val() == 'MonitorName') { //Monitor names
|
||||
} else if ( attr == 'MonitorName' ) { //Monitor names
|
||||
let monitorSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (let key in monitors) {
|
||||
monitorSelect.append('<option value="' + key + '">' + monitors[key] + '</option>');
|
||||
|
@ -208,15 +203,15 @@ console.log(key + ' ' + storageareas[key]);
|
|||
let textVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(textInput).children().val(textVal);
|
||||
}
|
||||
if (inputTds.eq(2).children().val().endsWith('DateTime')) { //Start/End DateTime
|
||||
if ( attr.endsWith('DateTime') ) { //Start/End DateTime
|
||||
inputTds.eq(4).children().datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});
|
||||
} else if (inputTds.eq(2).children().val().endsWith('Date')) { //Start/End Date
|
||||
} else if ( attr.endsWith('Date') ) { //Start/End Date
|
||||
inputTds.eq(4).children().datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});
|
||||
} else if (inputTds.eq(2).children().val().endsWith('Time')) { //Start/End Time
|
||||
} else if ( attr.endsWith('Time')) { //Start/End Time
|
||||
inputTds.eq(4).children().timepicker({timeFormat: "HH:mm:ss", constrainInput: false});
|
||||
}
|
||||
|
||||
let attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name
|
||||
attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name
|
||||
let term = attr.attr('name').split(/[[\]]{1,2}/);
|
||||
term.length--;
|
||||
term.shift();
|
||||
|
|
|
@ -234,7 +234,7 @@ foreach( array_map( 'basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
|
|||
<td class="colMemory
|
||||
<?php if ( $row['FreeMem']/$row['TotalMem'] < .1 ) { echo 'danger'; } ?>"><?php echo makePopupLink( '?view=server&id='.$row['Id'], 'zmServer', 'server', human_filesize($row['FreeMem']) . ' / ' . human_filesize($row['TotalMem']), $canEdit ) ?></td>
|
||||
<td class="colSwap
|
||||
<?php if ( $row['FreeSwap']/$row['TotalSwap'] < .1 ) { echo 'danger'; } ?>"><?php echo makePopupLink( '?view=server&id='.$row['Id'], 'zmServer', 'server', human_filesize($row['FreeSwap']) . ' / ' . human_filesize($row['TotalSwap']) , $canEdit ) ?></td>
|
||||
<?php if ( (!$row['TotalSwap']) or ($row['FreeSwap']/$row['TotalSwap'] < .1) ) { echo 'danger'; } ?>"><?php echo makePopupLink( '?view=server&id='.$row['Id'], 'zmServer', 'server', human_filesize($row['FreeSwap']) . ' / ' . human_filesize($row['TotalSwap']) , $canEdit ) ?></td>
|
||||
<td class="colStats"><?php echo makePopupLink( '?view=server&id='.$row['Id'], 'zmServer', 'server', $row['zmstats'] ? 'yes' : 'no', $canEdit ) ?></td>
|
||||
<td class="colAudit"><?php echo makePopupLink( '?view=server&id='.$row['Id'], 'zmServer', 'server', $row['zmaudit'] ? 'yes' : 'no', $canEdit ) ?></td>
|
||||
<td class="colTrigger"><?php echo makePopupLink( '?view=server&id='.$row['Id'], 'zmServer', 'server', $row['zmtrigger'] ? 'yes' : 'no', $canEdit ) ?></td>
|
||||
|
|
Loading…
Reference in New Issue