2016-10-27 19:58:31 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Dashboard\Dashboard;
|
|
|
|
use Icinga\Module\Director\Web\Controller\ActionController;
|
|
|
|
|
|
|
|
class DashboardController extends ActionController
|
|
|
|
{
|
2016-11-03 16:06:18 +01:00
|
|
|
protected function checkDirectorPermissions()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-27 19:58:31 +02:00
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
if ($this->getRequest()->isGet()) {
|
|
|
|
$this->setAutorefreshInterval(10);
|
|
|
|
}
|
|
|
|
|
2017-06-14 18:20:39 +02:00
|
|
|
$this->setTitle($this->translate('Icinga Director'));
|
2016-12-14 14:58:51 +01:00
|
|
|
$names = $this->params->getValues('name', array('Objects', 'Deployment', 'Data'));
|
|
|
|
if (count($names) === 1) {
|
|
|
|
// TODO: Find a better way for this
|
2017-06-14 18:20:39 +02:00
|
|
|
$this->addSingleTab($this->translate(ucfirst($names[0])));
|
2016-12-14 14:58:51 +01:00
|
|
|
} else {
|
2017-06-14 18:20:39 +02:00
|
|
|
$this->addSingleTab($this->translate('Overview'));
|
2016-12-14 14:58:51 +01:00
|
|
|
}
|
2017-06-14 18:20:39 +02:00
|
|
|
|
2016-12-14 14:58:51 +01:00
|
|
|
foreach ($names as $name) {
|
2017-06-14 18:20:39 +02:00
|
|
|
$dashboard = Dashboard::loadByName($name, $this->db());
|
2016-10-27 19:58:31 +02:00
|
|
|
if ($dashboard->isAvailable()) {
|
2017-06-14 18:20:39 +02:00
|
|
|
$this->content()->add($dashboard);
|
2016-10-27 19:58:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|