mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-11-01 19:54:17 +01:00
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
use Icinga\Module\Director\Objects\IcingaService;
|
|
use Icinga\Module\Director\Web\Controller\SimpleController;
|
|
use Icinga\Module\Director\Web\Table\ServicesOnHostsTable;
|
|
|
|
class ServicetemplateController extends SimpleController
|
|
{
|
|
public function hostsAction()
|
|
{
|
|
$this->addSingleTab($this->translate('Hosts using this service Template'));
|
|
$this->content()->add(
|
|
new ServicesOnHostsTable($this->db())
|
|
);
|
|
}
|
|
|
|
public function servicesAction()
|
|
{
|
|
$template = $this->requireTemplate();
|
|
$this->addSingleTab(
|
|
$this->translate('Single Services')
|
|
)->addTitle(
|
|
$this->translate('Services based on %s'),
|
|
$template->getObjectName()
|
|
);
|
|
|
|
$this->content()->add(
|
|
new ServicesOnHostsTable($this->db())
|
|
);
|
|
}
|
|
|
|
public function usageAction()
|
|
{
|
|
$template = $this->requireTemplate();
|
|
|
|
$this->addSingleTab(
|
|
$this->translate('Service Template Usage')
|
|
)->addTitle(
|
|
$this->translate('Template: %s'),
|
|
$template->getObjectName()
|
|
);
|
|
}
|
|
|
|
protected function requireTemplate()
|
|
{
|
|
return IcingaService::load([
|
|
'object_name' => $this->params->get('name')
|
|
], $this->db());
|
|
}
|
|
}
|