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

67 lines
1.9 KiB
PHTML

<?php
use Icinga\Module\Graphite\Web\Widget\Graphs\Host;
use Icinga\Web\Url;
/** @var \Icinga\Web\View $this */
/** @var \Icinga\Web\Widget\FilterEditor $filterEditor */
/** @var \Icinga\Module\Monitoring\Object\Host[] $hosts */
/** @var bool $hasMoreHosts */
/** @var \Icinga\Web\Url $baseUrl */
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($hosts)) {
echo '<div class="graphite-graph-color-registry"></div>';
echo '<div class="grid">';
foreach ($hosts as $host) {
$hostGraphs = (string) (new Host($host))->setPreloadDummy()->handleRequest();
if ($hostGraphs !== '') {
echo '<div class="grid-item">'
. '<h2>'
. $this->qlink(
$host->host_name === $host->host_display_name
? $host->host_display_name
: $host->host_display_name . ' (' . $this->escape($host->host_name) . ')',
$baseUrl->with(['host' => $host->host_name]),
null,
['data-base-target' => '_next']
)
. '</h2>'
. $hostGraphs
. '</div>';
}
}
if ($hasMoreHosts) {
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 hosts found matching the filter.')) . '</p>';
}
?>
</div>