icingaweb2/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml

46 lines
1.5 KiB
PHTML

<?php
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
if (! ($serviceCount = count($objects))): return; endif ?>
<table class="state-table service-detail-state">
<tbody>
<?php foreach ($objects as $i => $service): /** @var Service $service */
if ($i === 5) {
break;
} ?>
<tr>
<td class="state-col state-<?= Service::getStateText($service->service_state) ?><?= $service->service_handled ? ' handled' : '' ?>">
<span class="sr-only"><?= Service::getStateText($service->service_state) ?></span>
<div class="state-meta">
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?>
</div>
</td>
<td>
<?= $this->link()->service(
$service->service_description,
$service->service_display_name,
$service->host_name,
$service->host_display_name
. ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : '')
) ?>
<?= $this->serviceFlags($service) ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($serviceCount > 5): ?>
<div class="services-link">
<?= $this->qlink(
sprintf($this->translate('List all %d services'), $serviceCount),
$this->url()->setPath('monitoring/list/services'),
null,
array(
'data-base-target' => '_next',
'icon' => 'forward'
)
) ?>
</div>
<?php endif ?>