mirror of
https://github.com/unraid/webgui.git
synced 2026-04-25 20:01:38 -05:00
Add last parity log to Dashboard (align with Main page)
This commit is contained in:
@@ -44,13 +44,6 @@ function status_indicator() {
|
||||
}
|
||||
return "<a class='info nohand' onclick='return false'><img src='$ball' class='icon'><span>$help</span></a>";
|
||||
}
|
||||
function last_history_log() {
|
||||
$log = '/boot/config/parity-checks.log';
|
||||
if (!file_exists($log)) return [0,0,0,0,0];
|
||||
list($date,$duration,$speed,$status,$error) = explode('|',exec("tail -1 $log"));
|
||||
list($y,$m,$d,$t) = preg_split('/ +/',$date);
|
||||
return [strtotime("$d-$m-$y $t"), $duration, $speed, $status, $error];
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
td.gap{padding-left:26px!important}
|
||||
@@ -255,7 +248,7 @@ $(function(){
|
||||
<td>Last check incomplete on <strong><?=my_time($var['sbSynced2']).day_count($var['sbSynced2'])?></strong><?if ($var['sbSynced2']):?>, finding <strong><?=$var['sbSyncErrs']?></strong> error<?=$var['sbSyncErrs']==1?'':'s'?>.<?endif;?>
|
||||
<br><i class="fa fa-dot-circle-o icon"></i><small>Error code: <?=my_error($var['sbSyncExit'])?></small></td></tr>
|
||||
<? elseif ($var['sbSynced']==0):
|
||||
list($date,$duration,$speed,$status,$error) = last_history_log();?>
|
||||
list($date,$duration,$speed,$status,$error) = last_parity_log();?>
|
||||
<? if ($status==0):?>
|
||||
<td>Last checked on <strong><?=my_time($date).day_count($date)?></strong>, finding <strong><?=$error?></strong> error<?=$error==1?'':'s'?>.
|
||||
<br><i class="fa fa-clock-o icon"></i><small>Duration: <?=my_check($duration,$speed)?></small></td></tr>
|
||||
|
||||
@@ -39,7 +39,6 @@ function init_row($label) {
|
||||
}
|
||||
function parity_status() {
|
||||
global $var,$disks;
|
||||
|
||||
$parity_num_slots = 0;
|
||||
$parity_disabled = [];
|
||||
$parity_invalid = [];
|
||||
@@ -54,7 +53,6 @@ function parity_status() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($parity_num_slots == count($parity_disabled)) {
|
||||
echo "<tr style='vertical-align:top'><td><span class='red p0'><strong>Parity disk".($parity_num_slots>1?'s':'')." not present</strong></span></td><td id='parity'></td></tr>";
|
||||
return;
|
||||
@@ -71,7 +69,16 @@ function parity_status() {
|
||||
return;
|
||||
}
|
||||
if ($var['sbSynced']==0) {
|
||||
echo "<tr><td><em>Parity has not been checked yet.<em></td><td id='parity'></td></tr>";
|
||||
list($date,$duration,$speed,$status,$error) = last_parity_log();
|
||||
if (!$date) {
|
||||
echo "<tr><td><em>Parity has not been checked yet.<em></td><td id='parity'></td></tr>";
|
||||
} elseif ($status==0) {
|
||||
echo "<tr><td>Last checked on <strong>".my_time($date).day_count($date)."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
|
||||
echo "<br><i class='fa fa-clock-o icon'></i><em>Duration: ".my_check($duration,$speed)."</em></td><td id='parity'></td></tr>";
|
||||
} else {
|
||||
echo "<tr><td>Last check incomplete on <strong>".my_time($date).day_count($date)."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
|
||||
echo "<br><i class='fa fa-dot-circle-o icon'></i><em>Error code: ".my_error($status)."</em></td><td id='parity'></td></tr>";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ($var['sbSynced2']==0) {
|
||||
@@ -82,7 +89,7 @@ function parity_status() {
|
||||
echo "<br><i class='fa fa-clock-o icon'></i><em>".($idle ? "Duration: " : "Last result: ").my_check($duration,$speed)."</em></td><td id='parity'></td></tr>";
|
||||
} else {
|
||||
echo "<tr><td>Last check incomplete on <strong>".my_time($var['sbSynced']).day_count($var['sbSynced'])."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
|
||||
echo "<br><i class='fa fa-dot-circle-o icon'></i><em>Error code: $status</em></td><td id='parity'></td></tr>";
|
||||
echo "<br><i class='fa fa-dot-circle-o icon'></i><em>Error code: ".my_error($status)."</em></td><td id='parity'></td></tr>";
|
||||
}
|
||||
} else {
|
||||
$status = 0;
|
||||
|
||||
@@ -176,6 +176,13 @@ function read_parity_log($epoch, $busy=false) {
|
||||
}
|
||||
return $line ?: $last ?: '0|0|0|0|0';
|
||||
}
|
||||
function last_parity_log() {
|
||||
$log = '/boot/config/parity-checks.log';
|
||||
if (!file_exists($log)) return [0,0,0,0,0];
|
||||
list($date,$duration,$speed,$status,$error) = explode('|',exec("tail -1 $log"));
|
||||
list($y,$m,$d,$t) = preg_split('/ +/',$date);
|
||||
return [strtotime("$d-$m-$y $t"), $duration, $speed, $status, $error];
|
||||
}
|
||||
function urlencode_path($path) {
|
||||
return str_replace("%2F", "/", urlencode($path));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user