mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-01-06 13:39:34 -05:00
commit
c8a6eee054
9 changed files with 92 additions and 4 deletions
24
application/controllers/HostController.php
Normal file
24
application/controllers/HostController.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Businessprocess\Controllers;
|
||||
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Web\Url;
|
||||
|
||||
class HostController extends Controller
|
||||
{
|
||||
public function showAction()
|
||||
{
|
||||
$host = $this->params->getRequired('host');
|
||||
|
||||
$query = $this->backend->select()
|
||||
->from('hoststatus', array('host_name'))
|
||||
->where('host_name', $host);
|
||||
|
||||
if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) {
|
||||
$this->redirectNow(Url::fromPath('monitoring/host/show')->setParams($this->params));
|
||||
}
|
||||
|
||||
$this->view->host = $host;
|
||||
}
|
||||
}
|
||||
27
application/controllers/ServiceController.php
Normal file
27
application/controllers/ServiceController.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Businessprocess\Controllers;
|
||||
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Web\Url;
|
||||
|
||||
class ServiceController extends Controller
|
||||
{
|
||||
public function showAction()
|
||||
{
|
||||
$host = $this->params->getRequired('host');
|
||||
$service = $this->params->getRequired('service');
|
||||
|
||||
$query = $this->backend->select()
|
||||
->from('servicestatus', array('service_description'))
|
||||
->where('host_name', $host)
|
||||
->where('service_description', $service);
|
||||
|
||||
if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) {
|
||||
$this->redirectNow(Url::fromPath('monitoring/service/show')->setParams($this->params));
|
||||
}
|
||||
|
||||
$this->view->host = $host;
|
||||
$this->view->service = $service;
|
||||
}
|
||||
}
|
||||
13
application/views/scripts/host/show.phtml
Normal file
13
application/views/scripts/host/show.phtml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/** @var \Icinga\Web\View $this */
|
||||
/** @var \Icinga\Web\Widget\Tabs $tabs */
|
||||
/** @var string $host */
|
||||
?>
|
||||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content restricted">
|
||||
<h1><?= $this->translate('Access Denied') ?></h1>
|
||||
<p><?= sprintf($this->translate('You are lacking permission to access host "%s".'), $this->escape($host)) ?></p>
|
||||
<a href="#" class="close-container-control action-link"><?= $this->icon('cancel') ?><?= $this->translate('Hide this message') ?></a>
|
||||
</div>
|
||||
14
application/views/scripts/service/show.phtml
Normal file
14
application/views/scripts/service/show.phtml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/** @var \Icinga\Web\View $this */
|
||||
/** @var \Icinga\Web\Widget\Tabs $tabs */
|
||||
/** @var string $host */
|
||||
/** @var string $service */
|
||||
?>
|
||||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<div class="content restricted">
|
||||
<h1><?= $this->escape($this->translate('Access Denied')) ?></h1>
|
||||
<p><?= $this->escape(sprintf($this->translate('You are lacking permission to access service "%s" on host "%s"'), $service, $host)) ?></p>
|
||||
<a href="#" class="close-container-control action-link"><?= $this->icon('cancel') ?><?= $this->translate('Hide this message') ?></a>
|
||||
</div>
|
||||
|
|
@ -64,7 +64,7 @@ class HostNode extends MonitoredNode
|
|||
$params['backend'] = $this->bp->getBackendName();
|
||||
}
|
||||
|
||||
return Url::fromPath('monitoring/host/show', $params);
|
||||
return Url::fromPath('businessprocess/host/show', $params);
|
||||
}
|
||||
|
||||
public function getLink()
|
||||
|
|
|
|||
|
|
@ -51,6 +51,6 @@ class ServiceNode extends MonitoredNode
|
|||
$params['backend'] = $this->bp->getBackendName();
|
||||
}
|
||||
|
||||
return Url::fromPath('monitoring/service/show', $params);
|
||||
return Url::fromPath('businessprocess/service/show', $params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -611,6 +611,16 @@ td > a > .badges {
|
|||
|
||||
/** END of tiles **/
|
||||
|
||||
.content.restricted {
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
p > a {
|
||||
margin-left: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
/** BEGIN breadcrumb **/
|
||||
|
||||
.breadcrumb {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class HostNodeTest extends BaseTestCase
|
|||
public function testRendersCorrectLink()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'<a href="/icingaweb2/monitoring/host/show?host=localhost">'
|
||||
'<a href="/icingaweb2/businessprocess/host/show?host=localhost">'
|
||||
. 'localhost</a>',
|
||||
$this->localhost()->getLink()->render()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ServiceNodeTest extends BaseTestCase
|
|||
public function testRendersCorrectLink()
|
||||
{
|
||||
$this->assertEquals(
|
||||
'<a href="/icingaweb2/monitoring/service/show?host=localhost&service=ping%20%3C%3E%20pong">'
|
||||
'<a href="/icingaweb2/businessprocess/service/show?host=localhost&service=ping%20%3C%3E%20pong">'
|
||||
. 'localhost: ping <> pong</a>',
|
||||
$this->pingOnLocalhost()->getLink()->render()
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue