overview: highlight missing deployment endpoint
This commit is contained in:
parent
d24b2a9642
commit
06452dc78e
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue