N°9205 - Show progress messages in setup sequencer (#906)

* N°9205 - Show progress messages in setup sequencer

* N°9205 - Fix unit tests
This commit is contained in:
Lenaick
2026-05-07 10:27:31 +02:00
committed by GitHub
parent c5b678b4cf
commit 29502a4297
8 changed files with 80 additions and 18 deletions

View File

@@ -51,6 +51,16 @@ class ApplicationInstallSequencer extends StepSequencer
'create-config' => 'Creating the configuration File',
'commit' => 'Finalize',
];
protected const SUCCESS_LABELS = [
'log-parameters' => 'Parameters logged',
'backup' => 'Database backup completed',
'migrate-before' => 'Pre-upgrade data migration completed',
'db-schema' => 'Database schema updated',
'migrate-after' => 'Post-upgrade data migration completed',
'after-db-create' => 'Post-creation data loaded',
'load-data' => 'Data loaded',
'create-config' => 'Configuration file created',
];
/**
* @inherit
@@ -120,7 +130,7 @@ class ApplicationInstallSequencer extends StepSequencer
$this->oRunTimeEnvironment->DoLoadData($this->GetConfig(), $bSampleData, $aSelectedModules);
return $this->ComputeNextStep($sStep, 'All data loaded');
return $this->ComputeNextStep($sStep);
case 'create-config':
$sDataModelVersion = $this->oParams->Get('datamodel_version', '0.0.0');
@@ -144,11 +154,11 @@ class ApplicationInstallSequencer extends StepSequencer
return $this->GetNextStep('', 'Completed', 100);
default:
return $this->GetNextStep('', "Unknown setup step '$sStep'.", 100, '', self::ERROR);
return $this->GetNextStep('', "Unknown setup step '$sStep'.", 100, '', '', self::ERROR);
}
} catch (Exception $e) {
SetupLog::Exception("$sStep failed", $e);
$aResult = $this->GetNextStep('', '', 100, $e->getMessage(), self::ERROR);
$aResult = $this->GetNextStep('', '', 100, $e->getMessage(), '', self::ERROR);
$aResult['error_code'] = $e->getCode();
return $aResult;
} finally {
@@ -229,6 +239,7 @@ class ApplicationInstallSequencer extends StepSequencer
{
[$sNextStep, $iPercent] = $this->GetStepAfterWithPercent($sCurrentStep);
$sLabel = self::LABELS[$sNextStep] ?? '';
return $this->GetNextStep($sNextStep, $sLabel, $iPercent, $sMessage);
$sCurrentStepSuccessMessage = self::SUCCESS_LABELS[$sCurrentStep] ?? '';
return $this->GetNextStep($sNextStep, $sLabel, $iPercent, $sMessage, $sCurrentStepSuccessMessage);
}
}

View File

@@ -47,7 +47,7 @@ class DataAuditSequencer extends StepSequencer
case 'copy':
$this->oRunTimeEnvironment->CopySetupFiles();
return $this->GetNextStep('compile', 'Compiling the data model', 20, 'Copying...');
return $this->GetNextStep('compile', 'Compiling the data model', 20, 'Copying...', 'Data model files copied');
case 'compile':
$aSelectedModules = $this->oParams->Get('selected_modules', []);
@@ -65,25 +65,25 @@ class DataAuditSequencer extends StepSequencer
);
if ($this->IsDataAuditRequired()) {
return $this->GetNextStep('setup-audit', 'Checking data consistency with the new data model', 70, $sMessage);
return $this->GetNextStep('setup-audit', 'Checking data consistency with the new data model', 70, $sMessage, 'Data model compilation completed');
}
return $this->GetNextStep('complete', 'Check Completed', 100);
return $this->GetNextStep('complete', 'Check Completed', 100, '', 'Data model compilation completed');
case 'setup-audit':
if ($this->IsDataAuditRequired()) {
$this->oRunTimeEnvironment->DataToCleanupAudit();
}
return $this->GetNextStep('complete', 'Check Completed', 100);
return $this->GetNextStep('complete', 'Check Completed', 100, '', 'Data consistency check completed');
case 'complete':
return $this->GetNextStep('', 'Completed', 100);
return $this->GetNextStep('', 'Completed', 100, '', 'All checks completed');
default:
return $this->GetNextStep('', "Unknown setup step '$sStep'.", 100, '', self::ERROR);
return $this->GetNextStep('', "Unknown setup step '$sStep'.", 100, '', '', self::ERROR);
}
} catch (Exception $e) {
SetupLog::Exception("$sStep failed", $e);
$aResult = $this->GetNextStep('', '', 100, $e->getMessage(), self::ERROR);
$aResult = $this->GetNextStep('', '', 100, $e->getMessage(), '', self::ERROR);
$aResult['error_code'] = $e->getCode();
return $aResult;
} finally {

View File

@@ -127,13 +127,14 @@ abstract class StepSequencer
return ($iOverallStatus == self::OK);
}
protected function GetNextStep(string $sNextStep, string $sNextStepLabel, int $iPercentComplete, string $sMessage = '', int $iStatus = self::OK): array
protected function GetNextStep(string $sNextStep, string $sNextStepLabel, int $iPercentComplete, string $sMessage = '', string $sPrevStepSuccessMessage = '', int $iStatus = self::OK): array
{
return [
'status' => $iStatus,
'message' => $sMessage,
'next-step' => $sNextStep,
'next-step-label' => $sNextStepLabel,
'prev-step-success-message' => $sPrevStepSuccessMessage,
'percentage-completed' => $iPercentComplete,
];
}