icingaweb2-module-director/application/controllers/IndexController.php

32 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2015-10-20 22:34:04 +02:00
namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\Web\Controller\ActionController;
class IndexController extends ActionController
{
public function indexAction()
{
2016-02-17 20:15:42 +01:00
$this->setAutorefreshInterval(10);
$this->getTabs()->add('overview', array(
'url' => $this->getRequest()->getUrl(),
'label' => $this->translate('Overview')
))->activate('overview');
if (! $this->Config()->get('db', 'resource')) {
$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')
);
return;
}
2015-12-18 10:51:38 +01:00
$this->view->stats = $this->db()->getObjectSummary();
2016-02-18 02:10:40 +01:00
$this->view->undeployedActivities = $this->db()->countActivitiesSinceLastDeployedConfig();
2015-12-18 10:51:38 +01:00
if ((int) $this->view->stats['apiuser']->cnt_total === 0) {
$this->view->form = $this->loadForm('kickstart')->setDb($this->db)->handleRequest();
}
}
}