mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
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 Exception;
|
||||||
use Icinga\Module\Director\Objects\DirectorJob;
|
use Icinga\Module\Director\Objects\DirectorJob;
|
||||||
|
use Icinga\Module\Director\Objects\ImportSource;
|
||||||
use Icinga\Module\Director\Objects\SyncRule;
|
use Icinga\Module\Director\Objects\SyncRule;
|
||||||
use Icinga\Module\Director\Web\Controller\ActionController;
|
use Icinga\Module\Director\Web\Controller\ActionController;
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ class IndexController extends ActionController
|
|||||||
))->activate('overview');
|
))->activate('overview');
|
||||||
|
|
||||||
$this->fetchSyncState()
|
$this->fetchSyncState()
|
||||||
|
->fetchImportState()
|
||||||
->fetchJobState();
|
->fetchJobState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,6 +64,31 @@ class IndexController extends ActionController
|
|||||||
return $this;
|
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()
|
protected function fetchJobState()
|
||||||
{
|
{
|
||||||
$jobs = DirectorJob::loadAll($this->db());
|
$jobs = DirectorJob::loadAll($this->db());
|
||||||
|
@ -101,7 +101,7 @@ $all = array(
|
|||||||
array('globe', $this->translate('Zones'), 'director/zones', statSummary($this, 'zone')),
|
array('globe', $this->translate('Zones'), 'director/zones', statSummary($this, 'zone')),
|
||||||
),
|
),
|
||||||
$this->translate('Do more with your data') => 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('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('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('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')),
|
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…
x
Reference in New Issue
Block a user