parent
bf7d1ba878
commit
c5fe641c43
|
@ -12,97 +12,84 @@ if (! $this->compact): ?>
|
|||
<?php endif ?>
|
||||
<div class="content" data-base-target="_next">
|
||||
<?php
|
||||
|
||||
$hasHeader = false;
|
||||
$pivotData = $this->pivot->toArray();
|
||||
if (empty($pivotData)) {
|
||||
echo $this->translate('No services found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$hostFilter = '(host_name=' . implode('|host_name=', array_keys($pivotData)) . ')';
|
||||
?>
|
||||
<table class="pivot servicestates">
|
||||
<?php foreach ($pivotData as $hostName => $services): ?>
|
||||
<?php if (!$hasHeader): ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= $this->partial(
|
||||
'joystickPagination.phtml',
|
||||
'default',
|
||||
array(
|
||||
'xAxisPaginator' => $horizontalPaginator,
|
||||
'yAxisPaginator' => $verticalPaginator
|
||||
)
|
||||
); ?></th>
|
||||
<th colspan="<?= count($services); ?>">
|
||||
<div>
|
||||
<?php
|
||||
$serviceDescriptions = array_keys($services);
|
||||
$serviceFilter = '(service_description=' . implode('|service_description=', $serviceDescriptions) . ')';
|
||||
|
||||
foreach ($serviceDescriptions as $serviceDescription): ?>
|
||||
<span>
|
||||
<?= $this->qlink(
|
||||
'<abbr>' . $this->ellipsis($serviceDescription, 18) . '</abbr>',
|
||||
<table class="service-grid-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= $this->partial(
|
||||
'joystickPagination.phtml',
|
||||
'default',
|
||||
array(
|
||||
'xAxisPaginator' => $horizontalPaginator,
|
||||
'yAxisPaginator' => $verticalPaginator
|
||||
)
|
||||
); ?></th>
|
||||
<?php foreach ($pivotHeader['cols'] as $serviceDescription => $serviceDisplayName): ?>
|
||||
<th class="rotate-45"><div><span><?= $this->qlink(
|
||||
$this->ellipsis($serviceDisplayName, 18),
|
||||
'monitoring/list/services?' . $hostFilter,
|
||||
array(
|
||||
'service_description' => $serviceDescription
|
||||
),
|
||||
array(
|
||||
'title' => sprintf($this->translate('List all services with the name "%s" on all reported hosts'), $serviceDescription)
|
||||
),
|
||||
array('service_description' => $serviceDescription),
|
||||
array('title' => sprintf(
|
||||
$this->translate('List all services with the name "%s" on all reported hosts'),
|
||||
$serviceDisplayName
|
||||
)),
|
||||
false
|
||||
); ?>
|
||||
</span>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
) ?></span></div></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $hasHeader = true; ?>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<th>
|
||||
<?= $this->qlink(
|
||||
$hostName,
|
||||
'monitoring/list/services?' . $serviceFilter,
|
||||
array('host' => $hostName),
|
||||
array('title' => sprintf($this->translate('List all reported services on host %s'), $hostName))
|
||||
); ?>
|
||||
</th>
|
||||
<?php foreach ($services as $service): ?>
|
||||
<?php if ($service !== null): ?>
|
||||
<td>
|
||||
<span class="sr-only" id="<?= $service->host_name . '_' . $service->service_description . '_desc'; ?>">
|
||||
<?= $this->escape($service->service_output); ?>
|
||||
</span>
|
||||
<?= $this->qlink(
|
||||
'',
|
||||
'monitoring/show/service',
|
||||
array(
|
||||
'host' => $service->host_name,
|
||||
'service' => $service->service_description
|
||||
),
|
||||
array(
|
||||
'aria-describedby' => $service->host_name . '_' . $service->service_description . '_desc',
|
||||
'class' => 'state_' . Service::getStateText($service->service_state). ($service->service_handled ? ' handled' : ''),
|
||||
'title' => $this->escape($service->service_output),
|
||||
'aria-label' => sprintf(
|
||||
$this->translate('Show detailed information for service %s on host %s'),
|
||||
$service->service_display_name,
|
||||
$service->host_display_name
|
||||
)
|
||||
)
|
||||
); ?>
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<td><span aria-hidden="true">·</span></td>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($pivotHeader['rows'] as $hostName => $hostDisplayName): ?>
|
||||
<tr>
|
||||
<th><?php
|
||||
$services = $pivotData[$hostName];
|
||||
$serviceFilter = '(service_description=' . implode('|service_description=', array_keys($services)) . ')';
|
||||
echo $this->qlink(
|
||||
$hostDisplayName,
|
||||
'monitoring/list/services?' . $serviceFilter,
|
||||
array('host_name' => $hostName),
|
||||
array('title' => sprintf($this->translate('List all reported services on host %s'), $hostDisplayName))
|
||||
);
|
||||
?></th>
|
||||
<?php foreach (array_keys($pivotHeader['cols']) as $serviceDescription): ?>
|
||||
<td>
|
||||
<?php
|
||||
$service = $pivotData[$hostName][$serviceDescription];
|
||||
if ($service === null): ?>
|
||||
<span aria-hidden="true">·</span>
|
||||
<?php continue; endif ?>
|
||||
<?php $ariaDescribedById = $this->protectId($service->host_name . '_' . $service->service_description . '_desc') ?>
|
||||
<span class="sr-only" id="<?= $ariaDescribedById ?>">
|
||||
<?= $this->escape($service->service_output) ?>
|
||||
</span>
|
||||
<?= $this->qlink(
|
||||
'',
|
||||
'monitoring/show/service',
|
||||
array(
|
||||
'host' => $hostName,
|
||||
'service' => $serviceDescription
|
||||
),
|
||||
array(
|
||||
'aria-describedby' => $ariaDescribedById,
|
||||
'class' => 'bg-state-' . Service::getStateText($service->service_state) . ($service->service_handled ? ' handled' : ''),
|
||||
'title' => $this->escape($service->service_output),
|
||||
'aria-label' => sprintf(
|
||||
$this->translate('Show detailed information for service %s on host %s'),
|
||||
$service->service_display_name,
|
||||
$service->host_display_name
|
||||
)
|
||||
)
|
||||
); ?>
|
||||
</td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue