icingaweb2-module-graphite/application/views/scripts/list/services.phtml
2017-09-20 11:37:47 +02:00

72 lines
2.5 KiB
PHTML

<?php
use Icinga\Module\Graphite\Web\Widget\Graphs\Service;
use Icinga\Web\Url;
/** @var \Icinga\Web\View $this */
/** @var \Icinga\Web\Widget\FilterEditor $filterEditor */
/** @var \Icinga\Module\Monitoring\DataView\DataView $services */
if (! $compact): ?>
<div class="controls">
<?= $tabs ?>
<?= $paginator ?>
<div class="sort-controls-container">
<?= $limiter ?>
<?= $sortBox ?>
</div>
<?= $filterEditor ?>
<?= $timeRangePicker ?>
</div>
<?php endif ?>
<div class="content">
<?php
if ($filterEditor->getFilter()->isEmpty()) {
echo '<p>' . $this->escape($this->translate('Please specify a filter')) . '</p>';
} elseif ($services->hasResult()) {
foreach ($services->peekAhead($compact) as $service) {
if (! $compact) {
echo '<h2>'
. $this->qlink(
$service->host_name === $service->host_display_name
? $service->host_display_name
: $service->host_display_name . ' (' . $this->escape($service->host_name) . ')',
Url::fromPath('monitoring/host/show', ['host' => $service->host_name]),
null,
['data-base-target' => '_next']
)
. '&#58; '
. $this->qlink(
$service->service_description === $service->service_display_name
? $service->service_display_name
: $service->service_display_name . ' (' . $this->escape($service->service_description) . ')',
Url::fromPath('monitoring/service/show', [
'host' => $service->host_name,
'service' => $service->service_description
]),
null,
['data-base-target' => '_next']
)
. '</h2>';
}
echo (new Service($service->host_name, $service->service_description))->setCompact()->handleRequest();
}
if (! $compact && $services->hasMore()) {
echo '<div class="action-links">'
. $this->qlink(
mt('monitoring', 'Show More'),
$this->url()->without(array('view', 'limit')),
null,
[
'class' => 'action-link',
'data-base-target' => '_next'
]
)
. '</div>';
}
} else {
echo '<p>' . $this->escape(mt('monitoring', 'No services found matching the filter.')) . '</p>';
}
?>
</div>