IndexController: unify setup tabs/titles

This commit is contained in:
Thomas Gelf 2020-12-01 05:51:23 +01:00
parent 1e8adb8586
commit 60f915a024

View File

@ -20,7 +20,7 @@ class IndexController extends DashboardController
if ($migrations->hasSchema()) { if ($migrations->hasSchema()) {
if (!$this->hasDeploymentEndpoint()) { if (!$this->hasDeploymentEndpoint()) {
$this->showKickstartForm(false); $this->showKickstartForm();
} }
} }
@ -38,18 +38,27 @@ class IndexController extends DashboardController
), $migrations->getLastMigrationNumber()))); ), $migrations->getLastMigrationNumber())));
} }
parent::indexAction(); if ($migrations->hasSchema()) {
parent::indexAction();
} else {
$this->addTitle(sprintf(
$this->translate('Icinga Director Setup: %s'),
$this->translate('Create Schema')
));
$this->addSingleTab('Setup');
}
} else { } else {
$this->addTitle(sprintf(
$this->translate('Icinga Director Setup: %s'),
$this->translate('Choose DB Resource')
));
$this->addSingleTab('Setup');
$this->showKickstartForm(); $this->showKickstartForm();
} }
} }
protected function showKickstartForm($showTab = true) protected function showKickstartForm()
{ {
if ($showTab) {
$this->addSingleTab($this->translate('Kickstart'));
}
$form = KickstartForm::load(); $form = KickstartForm::load();
if ($name = $this->getPreferredDbResourceName()) { if ($name = $this->getPreferredDbResourceName()) {
$form->setDbResourceName($name); $form->setDbResourceName($name);