index: allow to apply migrations from dashboard
This commit is contained in:
parent
b6b15ce7e3
commit
8dda8a6a9a
|
@ -3,6 +3,7 @@
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Icinga\Module\Director\Db\Migrations;
|
||||||
use Icinga\Module\Director\Objects\DirectorJob;
|
use Icinga\Module\Director\Objects\DirectorJob;
|
||||||
use Icinga\Module\Director\Objects\ImportSource;
|
use Icinga\Module\Director\Objects\ImportSource;
|
||||||
use Icinga\Module\Director\Objects\SyncRule;
|
use Icinga\Module\Director\Objects\SyncRule;
|
||||||
|
@ -33,9 +34,21 @@ class IndexController extends ActionController
|
||||||
'label' => $this->translate('Overview')
|
'label' => $this->translate('Overview')
|
||||||
))->activate('overview');
|
))->activate('overview');
|
||||||
|
|
||||||
$this->fetchSyncState()
|
$migrations = new Migrations($this->db());
|
||||||
->fetchImportState()
|
|
||||||
->fetchJobState();
|
if ($migrations->hasPendingMigrations()) {
|
||||||
|
$this->view->migrationsForm = $this
|
||||||
|
->loadForm('applyMigrations')
|
||||||
|
->setMigrations($migrations)
|
||||||
|
->handleRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->fetchSyncState()
|
||||||
|
->fetchImportState()
|
||||||
|
->fetchJobState();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,11 @@ if (!$this->hasDeploymentEndpoint) {
|
||||||
echo $this->form;
|
echo $this->form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->migrationsForm) {
|
||||||
|
echo '<h1>' . $this->translate('There are pending database schema migrations') . "</h2>\n";
|
||||||
|
echo $this->migrationsForm;
|
||||||
|
}
|
||||||
|
|
||||||
$all = array(
|
$all = array(
|
||||||
$this->translate('Define whatever you want to be monitored') => array(
|
$this->translate('Define whatever you want to be monitored') => array(
|
||||||
array('host', $this->translate('Host objects'), 'director/hosts', statSummary($this, 'host')),
|
array('host', $this->translate('Host objects'), 'director/hosts', statSummary($this, 'host')),
|
||||||
|
|
Loading…
Reference in New Issue