Index: show sync state on dashboard
This commit is contained in:
parent
c92d1caeb4
commit
b37716cabe
|
@ -3,6 +3,7 @@
|
|||
namespace Icinga\Module\Director\Controllers;
|
||||
|
||||
use Exception;
|
||||
use Icinga\Module\Director\Objects\SyncRule;
|
||||
use Icinga\Module\Director\Web\Controller\ActionController;
|
||||
|
||||
class IndexController extends ActionController
|
||||
|
@ -29,9 +30,34 @@ class IndexController extends ActionController
|
|||
'url' => $this->getRequest()->getUrl(),
|
||||
'label' => $this->translate('Overview')
|
||||
))->activate('overview');
|
||||
|
||||
$this->fetchSyncState();
|
||||
}
|
||||
}
|
||||
|
||||
protected function fetchSyncState()
|
||||
{
|
||||
$syncs = SyncRule::loadAll($this->db());
|
||||
if (count($syncs) > 0) {
|
||||
$state = 'ok';
|
||||
} else {
|
||||
$state = null;
|
||||
}
|
||||
|
||||
foreach ($syncs as $sync) {
|
||||
if ($sync->sync_state !== 'in-sync') {
|
||||
if ($sync->sync_state === 'failing') {
|
||||
$state = 'critical';
|
||||
break;
|
||||
} else {
|
||||
$state = 'warning';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->syncState = $state;
|
||||
}
|
||||
|
||||
protected function hasDeploymentEndpoint()
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -102,7 +102,7 @@ $all = array(
|
|||
),
|
||||
$this->translate('Do more with your data') => array(
|
||||
array('database', $this->translate('Import data sources'), 'director/list/importsource', $this->translate('Define and manage imports from various data sources')),
|
||||
array('flapping', $this->translate('Synchronize'), 'director/list/importsource', $this->translate('Define how imported data should be synchronized with Icinga')),
|
||||
array('flapping', $this->translate('Synchronize'), 'director/list/syncrule', $this->translate('Define how imported data should be synchronized with Icinga'), $this->syncState),
|
||||
array('sort-name-up', $this->translate('Provide data lists'), 'director/data/lists', $this->translate('Provide data lists to make life easier for your users')),
|
||||
array('edit', $this->translate('Define data fields'), 'director/data/fields', $this->translate('Data fields make sure that configuration fits your rules')),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue