Parity card: show correct operation label (rebuild vs check vs sync) from mdResyncAction
This commit is contained in:
@@ -410,10 +410,11 @@ function vv_parity_status(): array {
|
||||
// Emulated (DISK_DSBL) disks are protected by parity and don't make parity invalid.
|
||||
// True invalidity: sync errors on the last check, or unprotectable missing slots.
|
||||
$isValid = $errors === 0 && $numMissing === 0;
|
||||
$inProgress = ($var['mdResync'] ?? '0') !== '0';
|
||||
$resyncPos = (int)($var['mdResyncPos'] ?? 0);
|
||||
$resyncSize = (int)($var['mdResyncSize'] ?? 1);
|
||||
$resyncPct = $resyncSize > 0 ? round($resyncPos / $resyncSize * 100, 1) : 0;
|
||||
$inProgress = ($var['mdResync'] ?? '0') !== '0';
|
||||
$resyncAction = trim($var['mdResyncAction'] ?? '');
|
||||
$resyncPos = (int)($var['mdResyncPos'] ?? 0);
|
||||
$resyncSize = (int)($var['mdResyncSize'] ?? 1);
|
||||
$resyncPct = $resyncSize > 0 ? round($resyncPos / $resyncSize * 100, 1) : 0;
|
||||
|
||||
// Last check from log
|
||||
$lastDate = null; $lastDuration = 0; $lastSpeed = 0; $lastErrors = 0; $lastExit = 0;
|
||||
@@ -457,8 +458,9 @@ function vv_parity_status(): array {
|
||||
'valid' => $isValid,
|
||||
'num_disabled' => $numDisabled,
|
||||
'num_missing' => $numMissing,
|
||||
'in_progress' => $inProgress,
|
||||
'resync_pct' => $resyncPct,
|
||||
'in_progress' => $inProgress,
|
||||
'resync_action' => $resyncAction,
|
||||
'resync_pct' => $resyncPct,
|
||||
'exit_code' => $exitCode,
|
||||
'exit_label' => $exitMap[(string)$lastExit] ?? 'Unknown',
|
||||
'errors' => $lastErrors,
|
||||
|
||||
@@ -1046,8 +1046,23 @@ function vvPollMonitor() {
|
||||
</div>`;
|
||||
|
||||
if (inProg) {
|
||||
const pct = par.resync_pct ?? 0;
|
||||
html += `<div style="font-size:11px;color:#aaa;margin-bottom:4px;">Check in progress — ${pct}%</div>
|
||||
const pct = par.resync_pct ?? 0;
|
||||
const action = par.resync_action ?? '';
|
||||
let opLabel;
|
||||
if (/^recon/i.test(action)) {
|
||||
const disk = action.replace(/^recon\s*/i, '').trim();
|
||||
opLabel = 'Rebuilding' + (disk ? ' disk ' + disk : '');
|
||||
} else if (/^check/i.test(action)) {
|
||||
opLabel = 'Parity check';
|
||||
} else if (/^sync/i.test(action)) {
|
||||
opLabel = 'Parity sync';
|
||||
} else if (/^clear/i.test(action)) {
|
||||
const disk = action.replace(/^clear\s*/i, '').trim();
|
||||
opLabel = 'Clearing' + (disk ? ' disk ' + disk : '');
|
||||
} else {
|
||||
opLabel = action || 'Operation';
|
||||
}
|
||||
html += `<div style="font-size:11px;color:#aaa;margin-bottom:4px;">${opLabel} — ${pct}%</div>
|
||||
<div style="background:#1a1a1a;border-radius:3px;height:6px;overflow:hidden;margin-bottom:10px;">
|
||||
<div style="width:${pct}%;height:100%;background:#4caf50;border-radius:3px;transition:width 2s;"></div>
|
||||
</div>`;
|
||||
|
||||
Reference in New Issue
Block a user