icingaweb2-module-graphite/application/views/scripts/list/services.phtml
2022-03-08 10:51:38 +01:00

77 lines
2.6 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\Object\Service[] $services */
/** @var bool $hasMoreServices */
/** @var \Icinga\Web\Url $hostBaseUrl */
/** @var \Icinga\Web\Url $serviceBaseUrl */
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 (! empty($services)) {
echo '<div class="graphite-graph-color-registry"></div>';
echo '<div class="grid">';
foreach ($services as $service) {
echo '<div class="grid-item">'
. '<h2>'
. $this->qlink(
$service->host_name === $service->host_display_name
? $service->host_display_name
: $service->host_display_name . ' (' . $this->escape($service->host_name) . ')',
$hostBaseUrl->with(['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) . ')',
$serviceBaseUrl->with([
'host' => $service->host_name,
'service' => $service->service_description
]),
null,
['data-base-target' => '_next']
)
. '</h2>';
echo (new Service($service))->setPreloadDummy()->handleRequest();
echo '</div>';
}
if ($hasMoreServices) {
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>';
}
echo '</div>';
} else {
echo '<p>' . $this->escape(mt('monitoring', 'No services found matching the filter.')) . '</p>';
}
?>
</div>