2015-06-29 10:01:10 -04:00
|
|
|
<?php
|
|
|
|
|
|
2015-10-20 16:34:04 -04:00
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
|
|
2015-06-30 05:27:32 -04:00
|
|
|
use Icinga\Module\Director\Web\Controller\ActionController;
|
2015-06-29 10:01:10 -04:00
|
|
|
|
2015-12-18 03:01:25 -05:00
|
|
|
class IndexController extends ActionController
|
2015-06-29 10:01:10 -04:00
|
|
|
{
|
|
|
|
|
public function indexAction()
|
|
|
|
|
{
|
2016-02-17 14:15:42 -05:00
|
|
|
$this->setAutorefreshInterval(10);
|
2015-12-16 05:45:00 -05:00
|
|
|
$this->getTabs()->add('overview', array(
|
2015-06-29 10:01:10 -04:00
|
|
|
'url' => $this->getRequest()->getUrl(),
|
2015-12-16 05:45:00 -05:00
|
|
|
'label' => $this->translate('Overview')
|
|
|
|
|
))->activate('overview');
|
|
|
|
|
|
2015-12-23 04:56:17 -05:00
|
|
|
if (! $this->Config()->get('db', 'resource')) {
|
2015-06-29 10:01:10 -04:00
|
|
|
$this->view->errorMessage = sprintf(
|
|
|
|
|
$this->translate('No database resource has been configured yet. Please %s to complete your config'),
|
|
|
|
|
$this->view->qlink($this->translate('click here'), 'director/settings')
|
|
|
|
|
);
|
2015-12-23 04:56:17 -05:00
|
|
|
return;
|
2015-06-29 10:01:10 -04:00
|
|
|
}
|
2015-12-18 04:51:38 -05:00
|
|
|
|
2016-03-02 16:51:50 -05:00
|
|
|
$this->view->hasDeploymentEndpoint = $this->db()->hasDeploymentEndpoint();
|
2015-12-18 04:51:38 -05:00
|
|
|
$this->view->stats = $this->db()->getObjectSummary();
|
2016-02-17 20:10:40 -05:00
|
|
|
$this->view->undeployedActivities = $this->db()->countActivitiesSinceLastDeployedConfig();
|
2015-12-18 04:51:38 -05:00
|
|
|
if ((int) $this->view->stats['apiuser']->cnt_total === 0) {
|
|
|
|
|
$this->view->form = $this->loadForm('kickstart')->setDb($this->db)->handleRequest();
|
|
|
|
|
}
|
2015-06-29 10:01:10 -04:00
|
|
|
}
|
|
|
|
|
}
|