Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions emhttp/plugins/dynamix/nchan/device_list
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,11 @@ function effective_fs_size(&$disk) {
}

function fs_info(&$disk,$online = false) {
global $display, $var;
global $display;
$echo = [];
if (empty(_var($disk,'fsStatus','')))
return "<td colspan='4'></td>";
if (_var($disk,'fsStatus')=='Mounted' && _var($var,'fsState') == 'Started') {
if (_var($disk,'fsStatus')=='Mounted') {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
$fsSize = effective_fs_size($disk);
$echo[] = "<td>".vfs_type($disk,$online)."</td>";
$echo[] = "<td>".my_scale($fsSize*1024,$unit,-1)." $unit</td>";
Expand Down
24 changes: 19 additions & 5 deletions tests/stopped-array-utilization.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,34 @@ function assertNotContainsText(string $needle, string $haystack, string $message
$navigationUsage = ob_get_clean();
assertContainsText('50%', $navigationUsage, 'Started arrays must keep showing the usage percentage.');

$disk = [
$bootPartition = [
'type' => 'Cache',
'fsStatus' => 'Mounted',
'fsType' => 'xfs',
'fsSize' => 100,
'fsUsed' => 25,
'fsFree' => 75,
];
$var['fsState'] = 'Stopped';
$diskInfo = fs_info($disk, true);
assertContainsText('Mounted', $diskInfo, 'Stopped filesystems must keep showing their status.');
assertNotContainsText('usage-disk', $diskInfo, 'Stopped filesystems must not show a usage bar.');
$bootInfo = fs_info($bootPartition, true);
assertContainsText('25', $bootInfo, 'Stopped mounted boot partitions must show used space.');
assertContainsText('75', $bootInfo, 'Stopped mounted boot partitions must show free space.');
assertContainsText('usage-disk', $bootInfo, 'Stopped mounted boot partitions must show usage bars.');

$flashBootDisk = $bootPartition;
$flashBootDisk['type'] = 'Flash';
$flashBootInfo = fs_info($flashBootDisk, true);
assertContainsText('25', $flashBootInfo, 'Stopped mounted flash boot devices must show used space.');
assertContainsText('75', $flashBootInfo, 'Stopped mounted flash boot devices must show free space.');

$dataPartition = $bootPartition;
$dataPartition['fsStatus'] = 'Unmounted';
$dataInfo = fs_info($dataPartition, true);
assertContainsText('Unmounted', $dataInfo, 'Stopped unmounted data partitions must show their status.');
assertNotContainsText('usage-disk', $dataInfo, 'Stopped unmounted data partitions must not show a usage bar.');

$var['fsState'] = 'Started';
$diskInfo = fs_info($disk, true);
$diskInfo = fs_info($bootPartition, true);
assertContainsText('usage-disk', $diskInfo, 'Started filesystems must keep showing a usage bar.');

echo "Stopped array utilization regression test passed.\n";
Loading