IndexController: slight fixes, work with new tabs
This commit is contained in:
parent
4590fa1d73
commit
02c015d163
|
@ -7,18 +7,16 @@ use Icinga\Module\Director\Db\Migrations;
|
|||
|
||||
class IndexController extends DashboardController
|
||||
{
|
||||
protected $hasDeploymentEndpoint;
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->dashboards = array();
|
||||
|
||||
$this->setViewScript('dashboard/index');
|
||||
|
||||
if ($this->Config()->get('db', 'resource')) {
|
||||
$migrations = new Migrations($this->db());
|
||||
|
||||
if ($migrations->hasSchema()) {
|
||||
if (!$this->hasDeploymentEndpoint()) {
|
||||
$this->showKickstartForm();
|
||||
$this->showKickstartForm(false);
|
||||
}
|
||||
} else {
|
||||
$this->showKickstartForm();
|
||||
|
@ -26,10 +24,11 @@ class IndexController extends DashboardController
|
|||
}
|
||||
|
||||
if ($migrations->hasPendingMigrations()) {
|
||||
$this->view->form = $this
|
||||
$this->content()->prepend($this
|
||||
->loadForm('applyMigrations')
|
||||
->setMigrations($migrations)
|
||||
->handleRequest();
|
||||
->handleRequest()
|
||||
);
|
||||
}
|
||||
|
||||
parent::indexAction();
|
||||
|
@ -38,20 +37,25 @@ class IndexController extends DashboardController
|
|||
}
|
||||
}
|
||||
|
||||
protected function showKickstartForm()
|
||||
protected function showKickstartForm($showTab = true)
|
||||
{
|
||||
$this->singleTab($this->translate('Kickstart'));
|
||||
$this->view->form = $this->loadForm('kickstart')->handleRequest();
|
||||
if ($showTab) {
|
||||
$this->addSingleTab($this->translate('Kickstart'));
|
||||
}
|
||||
|
||||
$this->content()->prepend(
|
||||
$this->loadForm('kickstart')->handleRequest()
|
||||
);
|
||||
}
|
||||
|
||||
protected function hasDeploymentEndpoint()
|
||||
{
|
||||
try {
|
||||
$this->view->hasDeploymentEndpoint = $this->db()->hasDeploymentEndpoint();
|
||||
$this->hasDeploymentEndpoint = $this->db()->hasDeploymentEndpoint();
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->view->hasDeploymentEndpoint;
|
||||
return $this->hasDeploymentEndpoint;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue