Skip to content

Commit 442a30a

Browse files
author
David Okon
committed
Customer addition to Module // Customer uses dynamic automount of /home which leads to division by zero - Customer suggested changes in VmDiskUsageTable.php and SimpleUsageBar.php
tried to fix indention fixed typo fixed typo fixed indention fixed indention
1 parent fbf7a51 commit 442a30a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

library/Vspheredb/Web/Table/VmDiskUsageTable.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public function renderRow($row)
7777
}
7878

7979
$free = Format::bytes($row->free_space)
80-
. sprintf(' (%0.3f%%)', ($row->free_space / $row->capacity) * 100);
80+
. ($row->capacity > 0
81+
? sprintf(' (%0.3f%%)', ($row->free_space / $row->capacity) * 100)
82+
: ' (n/a)');
8183

8284
$tr = $this::tr([
8385
$this::td($caption, [

library/Vspheredb/Web/Widget/SimpleUsageBar.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public function __construct($used, $total, $title)
3333

3434
protected function assemble()
3535
{
36-
$usedPercent = $this->used / $this->total;
36+
$usedPercent = ($this->total > 0)
37+
? $this->used / $this->total
38+
: 0;
3739

3840
$bar = Html::tag('span', [
3941
'href' => '#',

0 commit comments

Comments
 (0)