Add Event counts, event disk usage to storage tab of options. Disable checkbox selection when there are events stored on the storage area.

pull/2763/head
Isaac Connor 2019-11-26 14:36:39 -05:00
parent 9d18d5e6f2
commit 5ebf929598
2 changed files with 20 additions and 4 deletions

View File

@ -17,11 +17,11 @@ class Storage extends ZM_Object {
'ServerId' => 0,
'DoDelete' => 1,
);
public static function find($parameters = array(), $options = array() ) {
public static function find($parameters = array(), $options = array()) {
return ZM_Object::_find(get_class(), $parameters, $options);
}
public static function find_one( $parameters = array(), $options = array() ) {
public static function find_one($parameters = array(), $options = array()) {
return ZM_Object::_find_one(get_class(), $parameters, $options);
}
@ -48,6 +48,16 @@ class Storage extends ZM_Object {
return $this->{'Name'};
}
public function Events() {
if ( $this->{'Id'} and ! isset($this->{'Events'}) ) {
$this->{'Events'} = Event::find(array('StorageId'=>$this->{'Id'}));
}
if ( ! isset($this->{'Events'}) ) {
$this->{'Events'} = array();
}
return $this->{'Events'};
}
public function disk_usage_percent() {
$path = $this->Path();
if ( ! $path ) {

View File

@ -266,6 +266,7 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR)) as $
<th class="colScheme"><?php echo translate('StorageScheme') ?></th>
<th class="colServer"><?php echo translate('Server') ?></th>
<th class="colDiskSpace"><?php echo translate('DiskSpace') ?></th>
<th class="colEvents"><?php echo translate('Events') ?></th>
<th class="colMark"><?php echo translate('Mark') ?></th>
</tr>
</thead>
@ -279,8 +280,13 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR)) as $
<td class="colScheme"><?php echo makePopupLink('?view=storage&amp;id='.$Storage->Id(), 'zmStorage', 'storage', validHtmlStr($Storage->Scheme()), $canEdit ) ?></td>
<td class="colServer"><?php
echo makePopupLink('?view=storage&amp;id='.$Storage->Id(), 'zmStorage', 'storage', validHtmlStr($Storage->Server()->Name()), $canEdit ) ?></td>
<td class="colDiskSpace"><?php echo human_filesize($Storage->disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space()) ?></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
<td class="colDiskSpace">
<?php echo
human_filesize($Storage->disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space())
?>
</td>
<td class="ColEvents"><?php echo count($Storage->Events()).' using '.human_filesize($Storage->event_disk_space()) ?></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( count($Storage->Events()) or !$canEdit ) { ?> disabled="disabled"<?php } ?><?php echo count($Storage->Events()) ? ' title="Can\' delete as long as there are events stored here."' : ''?>/></td>
</tr>
<?php } #end foreach Server ?>
</tbody>