Parity card: show correct operation label (rebuild vs check vs sync) from mdResyncAction

This commit is contained in:
Gmer4Lfe
2026-06-19 11:19:15 -04:00
parent 3c20c835da
commit ad98d41041
2 changed files with 25 additions and 8 deletions
+8 -6
View File
@@ -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,