index: allow to apply migrations from dashboard

This commit is contained in:
Thomas Gelf 2016-05-02 10:21:22 +02:00
parent b6b15ce7e3
commit 8dda8a6a9a
2 changed files with 21 additions and 3 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Director\Controllers;
use Exception;
use Icinga\Module\Director\Db\Migrations;
use Icinga\Module\Director\Objects\DirectorJob;
use Icinga\Module\Director\Objects\ImportSource;
use Icinga\Module\Director\Objects\SyncRule;
@ -33,9 +34,21 @@ class IndexController extends ActionController
'label' => $this->translate('Overview')
))->activate('overview');
$migrations = new Migrations($this->db());
if ($migrations->hasPendingMigrations()) {
$this->view->migrationsForm = $this
->loadForm('applyMigrations')
->setMigrations($migrations)
->handleRequest();
}
try {
$this->fetchSyncState()
->fetchImportState()
->fetchJobState();
} catch (Exception $e) {
}
}
}

View File

@ -84,6 +84,11 @@ if (!$this->hasDeploymentEndpoint) {
echo $this->form;
}
if ($this->migrationsForm) {
echo '<h1>' . $this->translate('There are pending database schema migrations') . "</h2>\n";
echo $this->migrationsForm;
}
$all = array(
$this->translate('Define whatever you want to be monitored') => array(
array('host', $this->translate('Host objects'), 'director/hosts', statSummary($this, 'host')),