Do not display table when there are no results and fix code style
refs #5543
This commit is contained in:
parent
a0b9a06461
commit
77f5203bbf
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
use Icinga\Module\Monitoring\Web\Widget\StateBadges;
|
|
||||||
|
|
||||||
if (! $this->compact): ?>
|
if (! $this->compact): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
@ -12,46 +11,44 @@ if (! $this->compact): ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (count($groupData) === 0) {
|
if (count($groupData) === 0) {
|
||||||
echo $this->translate('No contactgroups found matching the filter') . '</div>';
|
echo $this->translate('No contactgroups found matching the filter') . '</div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<table class="action action-table listing-table" data-base-target="_next">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th><?= $this->translate('Hostgroup') ?></th>
|
||||||
|
<th><?= $this->translate('Alias') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
<table class="action action-table listing-table" data-base-target="_next">
|
<?php foreach ($groupData as $groupName => $groupInfo): ?>
|
||||||
<thead>
|
<tr>
|
||||||
<tr>
|
<td class="count-col">
|
||||||
<th></th>
|
<span class="badge"><?= count($groupInfo['contacts']) ?></span>
|
||||||
<th><?= $this->translate('Hostgroup') ?></th>
|
</td>
|
||||||
<th><?= $this->translate('Alias') ?></th>
|
<td>
|
||||||
</tr>
|
<?= $this->qlink(
|
||||||
</thead>
|
$groupName,
|
||||||
<tbody>
|
'monitoring/list/contacts',
|
||||||
|
array('contactgroup' => $groupName),
|
||||||
<?php foreach ($groupData as $groupName => $groupInfo): ?>
|
array('title' => sprintf(
|
||||||
<tr>
|
$this->translate('Show detailed information about %s'),
|
||||||
<td class="count-col">
|
$groupName
|
||||||
<span class="badge"><?= count($groupInfo['contacts']) ?></span>
|
))
|
||||||
</td>
|
) ?>
|
||||||
<td>
|
</td>
|
||||||
<?= $this->qlink(
|
<td>
|
||||||
$groupName,
|
<?php if ($groupInfo['alias'] !== $groupName): ?>
|
||||||
'monitoring/list/contacts',
|
<?= $groupInfo['alias'] ?>
|
||||||
array('contactgroup' => $groupName),
|
<?php endif ?>
|
||||||
array('title' => sprintf(
|
</td>
|
||||||
$this->translate('Show detailed information about %s'),
|
</tr>
|
||||||
$groupName
|
<?php endforeach ?>
|
||||||
))
|
</tbody>
|
||||||
); ?>
|
</table>
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if ($groupInfo['alias'] !== $groupName): ?>
|
|
||||||
<?= $groupInfo['alias'] ?>
|
|
||||||
<?php endif ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,71 +8,71 @@
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<table class="action action-table listing-table" data-base-target="_next">
|
<div class="content">
|
||||||
<thead>
|
<?php if ($contacts->hasResult()): ?>
|
||||||
<tr>
|
<table class="action action-table listing-table" data-base-target="_next">
|
||||||
<th><?= $this->translate('Name') ?></th>
|
<thead>
|
||||||
<th><?= $this->translate('Email') ?></th>
|
|
||||||
<th><?= $this->translate('Pager') ?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($contacts->peekAhead($this->compact) as $contact): ?>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th><?= $this->translate('Name') ?></th>
|
||||||
<?= $this->qlink(
|
<th><?= $this->translate('Email') ?></th>
|
||||||
$contact->contact_name,
|
<th><?= $this->translate('Pager') ?></th>
|
||||||
'monitoring/show/contact',
|
|
||||||
array('contact_name' => $contact->contact_name),
|
|
||||||
array('title' => sprintf(
|
|
||||||
$this->translate('Show detailed information about %s'),
|
|
||||||
$contact->contact_alias
|
|
||||||
), 'class' => 'rowaction')
|
|
||||||
); ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?= $this->translate('Email'); ?>:
|
|
||||||
<a href="mailto:<?= $contact->contact_email; ?>"
|
|
||||||
title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"
|
|
||||||
aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>">
|
|
||||||
<?= $this->escape($contact->contact_email); ?>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if ($contact->contact_pager): ?>
|
|
||||||
<div>
|
|
||||||
<?= $this->escape($contact->contact_pager) ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<?php if ($contact->contact_notify_service_timeperiod): ?>
|
|
||||||
<td>
|
|
||||||
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
|
|
||||||
</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($contact->contact_notify_host_timeperiod): ?>
|
|
||||||
<td>
|
|
||||||
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
|
|
||||||
</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
<?php foreach ($contacts->peekAhead($this->compact) as $contact): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?= $this->qlink(
|
||||||
|
$contact->contact_name,
|
||||||
|
'monitoring/show/contact',
|
||||||
|
array('contact_name' => $contact->contact_name),
|
||||||
|
array('title' => sprintf(
|
||||||
|
$this->translate('Show detailed information about %s'),
|
||||||
|
$contact->contact_alias
|
||||||
|
), 'class' => 'rowaction')
|
||||||
|
); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $this->translate('Email') ?>:
|
||||||
|
<a href="mailto:<?= $contact->contact_email; ?>"
|
||||||
|
title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"
|
||||||
|
aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>">
|
||||||
|
<?= $this->escape($contact->contact_email); ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if ($contact->contact_pager): ?>
|
||||||
|
<?= $this->escape($contact->contact_pager) ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
<?php if (! $contacts->hasResult()): ?>
|
<?php if ($contact->contact_notify_service_timeperiod): ?>
|
||||||
|
<td>
|
||||||
|
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($contact->contact_notify_host_timeperiod): ?>
|
||||||
|
<td>
|
||||||
|
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php if ($contacts->hasMore()): ?>
|
||||||
|
<?= $this->qlink(
|
||||||
|
$this->translate('Show More'),
|
||||||
|
$this->url()->without(array('view', 'limit')),
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'data-base-target' => '_next',
|
||||||
|
'class' => 'pull-right show-more'
|
||||||
|
)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php else: ?>
|
||||||
<?= $this->translate('No contacts found matching the filter'); ?>
|
<?= $this->translate('No contacts found matching the filter'); ?>
|
||||||
<?php elseif ($contacts->hasMore()): ?>
|
|
||||||
<?= $this->qlink(
|
|
||||||
$this->translate('Show More'),
|
|
||||||
$this->url()->without(array('view', 'limit')),
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'data-base-target' => '_next',
|
|
||||||
'class' => 'pull-right show-more'
|
|
||||||
)
|
|
||||||
); ?>
|
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
</div>
|
Loading…
Reference in New Issue