icingaweb2-module-businessp.../application/controllers/ServiceController.php
Sukhwinder Dhillon 9a91854d4c Remove monitoring module dependency
By separating `monitoring` module controllers.

- Adjust view-script paths accordingly
2026-01-13 08:52:01 +01:00

38 lines
1.1 KiB
PHP

<?php
namespace Icinga\Module\Businessprocess\Controllers;
use Icinga\Module\Businessprocess\IcingaDbObject;
use Icinga\Module\Icingadb\Model\Service;
use Icinga\Web\Url;
use ipl\Stdlib\Filter;
use ipl\Web\Compat\CompatController;
class ServiceController extends CompatController
{
public function showAction(): void
{
$hostName = $this->params->shift('host');
$serviceName = $this->params->shift('service');
$query = Service::on(IcingaDbObject::fetchDb());
IcingaDbObject::applyIcingaDbRestrictions($query);
$query->filter(Filter::all(
Filter::equal('service.name', $serviceName),
Filter::equal('host.name', $hostName)
));
$service = $query->first();
$this->params->add('name', $serviceName);
$this->params->add('host.name', $hostName);
if ($service !== null) {
$this->redirectNow(Url::fromPath('icingadb/service')->setParams($this->params));
}
$this->view->host = $hostName;
$this->view->service = $serviceName;
}
}