overview: highlight missing deployment endpoint

This commit is contained in:
Thomas Gelf 2016-03-02 22:51:50 +01:00
parent d24b2a9642
commit 06452dc78e
3 changed files with 21 additions and 1 deletions

View File

@ -22,6 +22,7 @@ class IndexController extends ActionController
return;
}
$this->view->hasDeploymentEndpoint = $this->db()->hasDeploymentEndpoint();
$this->view->stats = $this->db()->getObjectSummary();
$this->view->undeployedActivities = $this->db()->countActivitiesSinceLastDeployedConfig();
if ((int) $this->view->stats['apiuser']->cnt_total === 0) {

View File

@ -99,7 +99,7 @@ $all = array(
$this->translate('Deploy configuration to your Icinga nodes') => array(
array('wrench', $this->translate('Deployment'), 'director/config/deployments', $this->translate('Manage deployments, access audit log and history') . pendingDeployments($this), $this->undeployedActivities ? 'warning' : 'ok'),
array('lock-open-alt', $this->translate('Api users'), 'director/apiusers', statSummary($this, 'apiuser')),
array('cloud', $this->translate('Endpoints'), 'director/endpoints', statSummary($this, 'endpoint')),
array('cloud', $this->translate('Endpoints'), 'director/endpoints', statSummary($this, 'endpoint') . ( $this->hasDeploymentEndpoint ? '' : '. ' . $this->translate('None could be used for deployments right now')), $this->hasDeploymentEndpoint ? '' : 'critical'),
array('globe', $this->translate('Zones'), 'director/zones', statSummary($this, 'zone')),
),
$this->translate('Do more with your data') => array(

View File

@ -55,6 +55,25 @@ class Db extends DbConnection
return $this->getSetting('default_global_zone', 'director-global');
}
public function hasDeploymentEndpoint()
{
$db = $this->db();
$query = $db->select()->from(
array('z' => 'icinga_zone'),
array('cnt' => 'COUNT(*)')
)->join(
array('e' => 'icinga_endpoint'),
'e.zone_id = z.id',
array()
)->join(
array('au' => 'icinga_apiuser'),
'e.apiuser_id = au.id',
array()
)->where('z.object_name = ?', $this->getMasterZoneName());
return $db->fetchOne($query) > 0;
}
public function getDeploymentEndpointName()
{
$db = $this->db();