index: show import state on dashboard
This commit is contained in:
parent
a8904758f3
commit
51f8591a43
|
@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Controllers;
|
|||
|
||||
use Exception;
|
||||
use Icinga\Module\Director\Objects\DirectorJob;
|
||||
use Icinga\Module\Director\Objects\ImportSource;
|
||||
use Icinga\Module\Director\Objects\SyncRule;
|
||||
use Icinga\Module\Director\Web\Controller\ActionController;
|
||||
|
||||
|
@ -33,6 +34,7 @@ class IndexController extends ActionController
|
|||
))->activate('overview');
|
||||
|
||||
$this->fetchSyncState()
|
||||
->fetchImportState()
|
||||
->fetchJobState();
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +64,31 @@ class IndexController extends ActionController
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function fetchImportState()
|
||||
{
|
||||
$srcs = ImportSource::loadAll($this->db());
|
||||
if (count($srcs) > 0) {
|
||||
$state = 'ok';
|
||||
} else {
|
||||
$state = null;
|
||||
}
|
||||
|
||||
foreach ($srcs as $src) {
|
||||
if ($src->import_state !== 'in-sync') {
|
||||
if ($src->import_state === 'failing') {
|
||||
$state = 'critical';
|
||||
break;
|
||||
} else {
|
||||
$state = 'warning';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->importState = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function fetchJobState()
|
||||
{
|
||||
$jobs = DirectorJob::loadAll($this->db());
|
||||
|
|
|
@ -101,7 +101,7 @@ $all = array(
|
|||
array('globe', $this->translate('Zones'), 'director/zones', statSummary($this, 'zone')),
|
||||
),
|
||||
$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('database', $this->translate('Import data sources'), 'director/list/importsource', $this->translate('Define and manage imports from various data sources'), $this->importState),
|
||||
array('flapping', $this->translate('Synchronize'), 'director/list/syncrule', $this->translate('Define how imported data should be synchronized with Icinga'), $this->syncState),
|
||||
array('clock', $this->translate('Jobs'), 'director/jobs', $this->translate('Schedule and automate Import, Syncronization, Config Deployment, Housekeeping and more'), $this->jobState),
|
||||
array('sort-name-up', $this->translate('Provide data lists'), 'director/data/lists', $this->translate('Provide data lists to make life easier for your users')),
|
||||
|
|
Loading…
Reference in New Issue