mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
index: show and link jobs on dashboard
This commit is contained in:
parent
cf1e5d88a8
commit
37d3c5aa04
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Icinga\Module\Director\Objects\DirectorJob;
|
||||||
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;
|
||||||
|
|
||||||
@ -31,7 +32,8 @@ class IndexController extends ActionController
|
|||||||
'label' => $this->translate('Overview')
|
'label' => $this->translate('Overview')
|
||||||
))->activate('overview');
|
))->activate('overview');
|
||||||
|
|
||||||
$this->fetchSyncState();
|
$this->fetchSyncState()
|
||||||
|
->fetchJobState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +58,31 @@ class IndexController extends ActionController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->view->syncState = $state;
|
$this->view->syncState = $state;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function fetchJobState()
|
||||||
|
{
|
||||||
|
$jobs = DirectorJob::loadAll($this->db());
|
||||||
|
if (count($jobs) > 0) {
|
||||||
|
$state = 'ok';
|
||||||
|
} else {
|
||||||
|
$state = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($jobs as $job) {
|
||||||
|
if ($job->isPending()) {
|
||||||
|
$state = 'pending';
|
||||||
|
} elseif (! $job->lastAttemptSucceeded()) {
|
||||||
|
$state = 'critical';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->view->jobState = $state;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hasDeploymentEndpoint()
|
protected function hasDeploymentEndpoint()
|
||||||
|
@ -103,6 +103,7 @@ $all = array(
|
|||||||
$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')),
|
||||||
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('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')),
|
||||||
array('edit', $this->translate('Define data fields'), 'director/data/fields', $this->translate('Data fields make sure that configuration fits your rules')),
|
array('edit', $this->translate('Define data fields'), 'director/data/fields', $this->translate('Data fields make sure that configuration fits your rules')),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user