Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/setup.css

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion css/setup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,12 @@ body {
}

#progress_content {
height: 200px;
min-height: 200px;
overflow: auto;
text-align: center;
*:not(.message) + .message {
margin-top: 1.5rem;
}
}
#fresh_content{
border: 0;
Expand Down
19 changes: 15 additions & 4 deletions setup/sequencers/ApplicationInstallSequencer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -120,7 +130,7 @@ public function ExecuteStep($sStep = '', $sInstallComment = null): array

$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');
Expand All @@ -144,11 +154,11 @@ public function ExecuteStep($sStep = '', $sInstallComment = null): array
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 {
Expand Down Expand Up @@ -229,6 +239,7 @@ private function ComputeNextStep(string $sCurrentStep, string $sMessage = ''): a
{
[$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);
}
}
14 changes: 7 additions & 7 deletions setup/sequencers/DataAuditSequencer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function ExecuteStep($sStep = '', $sInstallComment = null): array

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', []);
Expand All @@ -65,25 +65,25 @@ public function ExecuteStep($sStep = '', $sInstallComment = null): array
);

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 {
Expand Down
3 changes: 2 additions & 1 deletion setup/sequencers/StepSequencer.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ public function ExecuteAllSteps(bool $bVerbose = true, ?string &$sMessage = null
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,
];
}
Expand Down
16 changes: 16 additions & 0 deletions setup/wizardsteps/WizStepInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ protected function AddProgressBar(WebPage $oPage, string $sTitle = 'Progress of
$oPage->add("<div class=\"message message-error ibo-is-html-content\" style=\"display:none;\" id=\"setup_error\"></div>");
}

protected function AddPrevStepSuccessMessage(WebPage $oPage, string $sPrevStepSuccessMessage): void
{
if ($sPrevStepSuccessMessage === '') {
return;
}

$sPrevStepSuccessMessage = addslashes(utils::EscapeHtml($sPrevStepSuccessMessage));
$oPage->add_ready_script(
<<<EOF
$('<div class="message message-valid ibo-is-html-content">').html('$sPrevStepSuccessMessage').appendTo("#progress_content");
EOF
);
}
Comment thread
greptile-apps[bot] marked this conversation as resolved.

public function Display(SetupPage $oPage): void
{
$aInstallParams = $this->BuildConfig();
Expand Down Expand Up @@ -121,6 +135,7 @@ public function AsyncAction(WebPage $oPage, $sCode, $aParameters)
ExecuteStep('{$aRes['next-step']}');
EOF
);
static::AddPrevStepSuccessMessage($oPage, $aRes['prev-step-success-message']);
} elseif ($aRes['status'] !== StepSequencer::ERROR) {
// Installation complete, move to the next step of the wizard
$oPage->add_ready_script(
Expand All @@ -132,6 +147,7 @@ public function AsyncAction(WebPage $oPage, $sCode, $aParameters)
$("#btn_next").trigger('click');
EOF
);
static::AddPrevStepSuccessMessage($oPage, $aRes['prev-step-success-message']);
} else {
//Error case
$sMessage = addslashes(utils::EscapeHtml($aRes['message']));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ public static function FirstStepProvider()
'next is db-update' => [
'next-step' => 'db-schema',
'next-step-label' => 'Updating database schema',
'prev-step-success-message' => '',
'percentage-completed' => 16,
'optional_steps' => [],
],
'next is log-parameters' => [
'next-step' => 'log-parameters',
'next-step-label' => 'Log parameters',
'prev-step-success-message' => '',
'percentage-completed' => 11,
'optional_steps' => [
'log-parameters' => true,
Expand All @@ -49,6 +51,7 @@ public static function FirstStepProvider()
'next is backup' => [
'next-step' => 'backup',
'next-step-label' => 'Performing a backup of the database',
'prev-step-success-message' => '',
'percentage-completed' => 12,
'optional_steps' => [
'backup' => true,
Expand All @@ -58,6 +61,7 @@ public static function FirstStepProvider()
'next is migrate-before' => [
'next-step' => 'migrate-before',
'next-step-label' => 'Migrate data before database upgrade',
'prev-step-success-message' => '',
'percentage-completed' => 14,
'optional_steps' => [
'migrate-before' => true,
Expand All @@ -70,7 +74,7 @@ public static function FirstStepProvider()
/**
* @dataProvider FirstStepProvider
*/
public function testFirstStep($sNextStep, $sNextLabel, $iPercent, $aOptionalSteps, bool $bCallEnterMaintenanceMode = false, bool $bCallExitMaintenanceMode = false)
public function testFirstStep($sNextStep, $sNextLabel, $sPrevStepSuccessMessage, $iPercent, $aOptionalSteps, bool $bCallEnterMaintenanceMode = false, bool $bCallExitMaintenanceMode = false)
{
$aAdditionalParams = [
'optional_steps' => $aOptionalSteps,
Expand All @@ -83,6 +87,7 @@ public function testFirstStep($sNextStep, $sNextLabel, $iPercent, $aOptionalStep
'message' => '',
'next-step' => $sNextStep,
'next-step-label' => $sNextLabel,
'prev-step-success-message' => $sPrevStepSuccessMessage,
'percentage-completed' => $iPercent,
];
$this->assertEquals($aExpected, $aRes);
Expand All @@ -98,6 +103,7 @@ public function testLogStep()
'message' => '',
'next-step' => 'db-schema',
'next-step-label' => 'Updating database schema',
'prev-step-success-message' => 'Parameters logged',
'percentage-completed' => 16,
];
$this->assertEquals($aExpected, $aRes);
Expand All @@ -109,6 +115,7 @@ public static function BackupStepProvider()
'next is db-update' => [
'next-step' => 'db-schema',
'next-step-label' => 'Updating database schema',
'prev-step-success-message' => 'Database backup completed',
'percentage-completed' => 28,
'optional_steps' => [
'backup' => true,
Expand All @@ -117,6 +124,7 @@ public static function BackupStepProvider()
'next is migrate-before' => [
'next-step' => 'migrate-before',
'next-step-label' => 'Migrate data before database upgrade',
'prev-step-success-message' => 'Database backup completed',
'percentage-completed' => 25,
'optional_steps' => [
'backup' => true,
Expand All @@ -129,7 +137,7 @@ public static function BackupStepProvider()
/**
* @dataProvider BackupStepProvider
*/
public function testBackup($sNextStep, $sNextLabel, $iPercent, $aOptionalSteps)
public function testBackup($sNextStep, $sNextLabel, $sPrevStepSuccessMessage, $iPercent, $aOptionalSteps)
{
$aAdditionalParams = [
'optional_steps' => $aOptionalSteps,
Expand All @@ -149,6 +157,7 @@ public function testBackup($sNextStep, $sNextLabel, $iPercent, $aOptionalSteps)
'message' => '',
'next-step' => $sNextStep,
'next-step-label' => $sNextLabel,
'prev-step-success-message' => $sPrevStepSuccessMessage,
'percentage-completed' => $iPercent,
];
$this->assertEquals($aExpected, $aRes);
Expand All @@ -172,6 +181,7 @@ public function testMigrateBefore()
'message' => '',
'next-step' => 'db-schema',
'next-step-label' => 'Updating database schema',
'prev-step-success-message' => 'Pre-upgrade data migration completed',
'percentage-completed' => 28,
];
$this->assertEquals($aExpected, $aRes);
Expand All @@ -183,6 +193,7 @@ public static function DbUpdateStepProvider()
'next is migrate-after' => [
'next-step' => 'migrate-after',
'next-step-label' => 'Migrate data after database upgrade',
'prev-step-success-message' => 'Database schema updated',
'percentage-completed' => 28,
'optional_steps' => [
'migrate-after' => true,
Expand All @@ -191,6 +202,7 @@ public static function DbUpdateStepProvider()
'next is after-db-create' => [
'next-step' => 'after-db-create',
'next-step-label' => 'Load data after database create',
'prev-step-success-message' => 'Database schema updated',
'percentage-completed' => 33,
'optional_steps' => [],
],
Expand All @@ -200,7 +212,7 @@ public static function DbUpdateStepProvider()
/**
* @dataProvider DbUpdateStepProvider
*/
public function testDbUpdate($sNextStep, $sNextLabel, $iPercent, $aOptionalSteps)
public function testDbUpdate($sNextStep, $sNextLabel, $sPrevStepSuccessMessage, $iPercent, $aOptionalSteps)
{
$aAdditionalParams = [
'selected_modules' => ["a" => "b"],
Expand All @@ -219,6 +231,7 @@ public function testDbUpdate($sNextStep, $sNextLabel, $iPercent, $aOptionalSteps
'message' => '',
'next-step' => $sNextStep,
'next-step-label' => $sNextLabel,
'prev-step-success-message' => $sPrevStepSuccessMessage,
'percentage-completed' => $iPercent,
];
$this->assertEquals($aExpected, $aRes);
Expand All @@ -242,6 +255,7 @@ public function testMigrateAfter()
'message' => '',
'next-step' => 'after-db-create',
'next-step-label' => 'Load data after database create',
'prev-step-success-message' => 'Post-upgrade data migration completed',
'percentage-completed' => 42,
];
$this->assertEquals($aExpected, $aRes);
Expand Down Expand Up @@ -269,6 +283,7 @@ public function testAfterDbCreate()
'message' => '',
'next-step' => 'load-data',
'next-step-label' => 'Loading data',
'prev-step-success-message' => 'Post-creation data loaded',
'percentage-completed' => 50,
];
$this->assertEquals($aExpected, $aRes);
Expand All @@ -287,9 +302,10 @@ public function testLoadData()

$aRes = $this->oSequencer->ExecuteStep('load-data');
$aExpected = [
'message' => 'All data loaded',
'message' => '',
'next-step' => 'create-config',
'next-step-label' => 'Creating the configuration File',
'prev-step-success-message' => 'Data loaded',
'percentage-completed' => 66,
'status' => 1,
];
Expand All @@ -313,6 +329,7 @@ public function testCreateConfig()
'message' => '',
'next-step' => 'commit',
'next-step-label' => 'Finalize',
'prev-step-success-message' => 'Configuration file created',
'percentage-completed' => 83,
'status' => 1,
];
Expand All @@ -330,6 +347,7 @@ public function testCommit()
'message' => '',
'next-step' => '',
'next-step-label' => 'Completed',
'prev-step-success-message' => '',
'percentage-completed' => 100,
'status' => 1,
];
Expand All @@ -348,6 +366,7 @@ public function testAnyFailure()
'message' => 'SHADOK MSG',
'next-step' => '',
'next-step-label' => '',
'prev-step-success-message' => '',
'percentage-completed' => 100,
'error_code' => 0,
];
Expand All @@ -363,6 +382,7 @@ public function testUnknownStep()
'message' => '',
'next-step' => '',
'next-step-label' => 'Unknown setup step \'gabuzomeu\'.',
'prev-step-success-message' => '',
'percentage-completed' => 100,
];
$this->assertEquals($aExpected, $aRes);
Expand Down
Loading