2015-06-29 16:01:10 +02:00
< div class = "controls" >
<? = $this -> tabs ?>
< / div >
< div class = "content" >
<?php if ( $this -> errorMessage ) : ?>
< p class = "error" > <? = $this -> errorMessage ?> </ p >
<?php endif ?>
2016-02-18 02:10:07 +01:00
<?php if ( ! $this -> stats ) : ?>
2016-03-13 23:48:22 +01:00
<? = $this -> form ?>
2016-02-18 02:10:07 +01:00
< / div >
<?php return ; endif ?>
2015-07-30 11:40:13 +02:00
<?php
2015-12-18 10:51:38 +01:00
2016-02-17 18:54:46 +01:00
function statSummary($self, $type) {
$stat = $self->stats[$type];
if ((int) $stat->cnt_total === 0) {
return $self->translate('No object has been defined yet');
}
if ((int) $stat->cnt_total === 1) {
if ($stat->cnt_template > 0) {
$msg = $self->translate('One template has been defined');
} elseif ($stat->cnt_external > 0) {
$msg = $self->translate('One external object has been defined, it will not be deployed');
} else {
$msg = $self->translate('One object has been defined');
}
} else {
$msg = sprintf(
$self->translate('%d objects have been defined'),
$stat->cnt_total
);
}
$extra = array();
2016-02-19 01:09:57 +01:00
if ($stat->cnt_total !== $stat->cnt_object) {
2016-02-17 18:54:46 +01:00
if ($stat->cnt_template > 0) {
$extra[] = sprintf(
$self->translate('%d of them are templates'),
$stat->cnt_template
);
}
if ($stat->cnt_external > 0) {
$extra[] = sprintf(
$self->translate('%d have been externally defined and will not be deployed'),
$stat->cnt_external
);
}
2016-02-19 01:09:57 +01:00
}
2016-02-17 18:54:46 +01:00
if (array_key_exists($type . 'group', $self->stats)) {
$groupstat = $self->stats[$type . 'group'];
if ((int) $groupstat->cnt_total === 0) {
$extra[] = $self->translate('no related group exists');
} elseif ((int) $groupstat->cnt_total === 1) {
$extra[] = $self->translate('one related group exists');
} else {
$extra[] = sprintf(
2016-02-19 01:09:57 +01:00
$self->translate('%s related group objects have been created'),
$groupstat->cnt_total
2016-02-17 18:54:46 +01:00
);
}
}
2016-02-19 01:09:57 +01:00
if (empty($extra)) {
return $msg;
}
2016-02-17 18:54:46 +01:00
return $msg . ', ' . implode(', ', $extra);
}
2016-02-18 02:10:40 +01:00
function pendingDeployments($self) {
if ($self->undeployedActivities === 0) return '';
return '. < span class = "error" > ' . sprintf(
$self->translate('A total of %d config changes happened since your last deployed config has been rendered'),
$self->undeployedActivities
) . '< / span > ';
2016-02-17 18:54:46 +01:00
}
2016-03-21 19:16:26 +01:00
if (!$this->hasDeploymentEndpoint) {
2016-03-16 10:39:31 +01:00
echo $this->form;
2015-12-18 10:51:38 +01:00
}
2016-02-17 18:54:46 +01:00
$all = array(
2016-02-18 01:14:25 +01:00
$this->translate('Define whatever you want to be monitored') => array(
2016-02-17 18:54:46 +01:00
array('wrench', $this->translate('Commands'), 'director/commands', statSummary($this, 'command')),
array('host', $this->translate('Host objects'), 'director/hosts', statSummary($this, 'host')),
array('services', $this->translate('Monitored Services'), 'director/services', statSummary($this, 'service')),
),
$this->translate('Alert your users') => array(
array('users', $this->translate('Users / Contacts'), 'director/users', statSummary($this, 'user')),
2016-03-12 02:05:26 +01:00
array('calendar', $this->translate('Timeperiods'), 'director/timeperiods', statSummary($this, 'timeperiod')),
array('megaphone', $this->translate('Notifications'), 'director/notifications', $this->translate('Schedule your notifications.') . ' ' . statSummary($this, 'notification')),
2016-02-28 16:43:45 +01:00
array('book', $this->translate('Audit log'), 'director/config/activities', $this->translate('Wondering about what changed why? Track you changes!'), 'ok'),
2016-02-17 18:54:46 +01:00
),
2016-02-18 01:14:25 +01:00
$this->translate('Deploy configuration to your Icinga nodes') => array(
2016-02-28 16:52:37 +01:00
array('wrench', $this->translate('Deployment'), 'director/config/deployments', $this->translate('Manage deployments, access audit log and history') . pendingDeployments($this), $this->undeployedActivities ? 'warning' : 'ok'),
2016-02-17 18:54:46 +01:00
array('lock-open-alt', $this->translate('Api users'), 'director/apiusers', statSummary($this, 'apiuser')),
2016-03-02 22:51:50 +01:00
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'),
2016-02-28 16:43:45 +01:00
array('globe', $this->translate('Zones'), 'director/zones', statSummary($this, 'zone')),
2016-02-17 18:54:46 +01:00
),
2016-02-18 00:52:22 +01:00
$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('flapping', $this->translate('Synchronize'), 'director/list/importsource', $this->translate('Define how imported data should be synchronized with Icinga')),
2016-02-28 16:59:40 +01:00
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')),
2016-02-17 18:54:46 +01:00
)
2015-07-30 11:40:13 +02:00
);
?>
2016-02-17 18:54:46 +01:00
<?php foreach ( $all as $title => $actions ) : ?>
<? = $this -> partial (
'index/actions.phtml',
array(
'actions' => $actions,
2016-02-28 16:43:45 +01:00
'title' => $title,
2016-02-17 18:54:46 +01:00
)
) ?>
2015-07-30 11:40:13 +02:00
<?php endforeach ?>
2015-06-29 16:01:10 +02:00
< / div >