Compare commits

2 Commits

Author SHA1 Message Date
Zeroune
46e54e8d0a some syntax error fixes 2020-06-19 16:31:57 +02:00
Zeroune
1fe95e2df4 display output in table 2020-06-16 18:50:06 +02:00

View File

@@ -117,7 +117,44 @@ Title="Unraid-Kernel-Helper"
<tr> <tr>
<td>Pool List:</td> <td>Pool List:</td>
<td><b><?=`zpool list -o name,size | column -t -o '&nbsp;&nbsp;&nbsp;&nbsp;' | sed 's/$/<br>/'`?></b></td> <td>
<?
$output = "NAME SIZE\nabc 10";
// check for error message
if(strpos($output, "no pools available") !== false) {
?>
<b><?=$output?></b>
<?
} elseif (strpos($output, "config:") !== false) {
// TODO display data for zpool status without any options (?)
// parse output table
} else {
// create array with lines; splits on \n
$rows = explode("\n", $output);
?>
<table>
<?
foreach($rows as $row) {
// create array with columns from line; splits on \t
$columns = explode("\t", $row);
?>
<tr>
<?
foreach($columns as $column) {
?>
<td><?=$column?></td>
<?
}
?>
</tr>
<?
}
?>
</table>
<?
}
?>
</td>
</tr> </tr>