Merge branch 'bugfix/do-not-use-count-queries-for-emptiness-checks-9632'
fixes #9632
This commit is contained in:
commit
66edf55ca6
|
@ -26,7 +26,10 @@ if (! isset($backend)) {
|
|||
$reducible = $this->hasPermission('config/authentication/groups/remove') && $backend instanceof Reducible;
|
||||
}
|
||||
|
||||
if (count($groups) > 0): ?>
|
||||
$firstRow = true;
|
||||
foreach ($groups as $group): ?>
|
||||
<?php if ($firstRow): ?>
|
||||
<?php $firstRow = false; ?>
|
||||
<table data-base-target="_next" class="action group-list alternating">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -37,7 +40,7 @@ if (count($groups) > 0): ?>
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($groups as $group): ?>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td class="group-name"><?= $this->qlink($group->group_name, 'group/show', array(
|
||||
'backend' => $backend->getName(),
|
||||
|
@ -62,7 +65,8 @@ if (count($groups) > 0): ?>
|
|||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($groups->hasResult()): ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
|
|
|
@ -49,7 +49,12 @@ if ($this->hasPermission('config/authentication/groups/edit') && $backend instan
|
|||
<?php endif ?>
|
||||
</div>
|
||||
<div class="content members" data-base-target="_next">
|
||||
<?php if (count($members) > 0): ?>
|
||||
<?php
|
||||
|
||||
$firstRow = true;
|
||||
foreach ($members as $member): ?>
|
||||
<?php if ($firstRow): ?>
|
||||
<?php $firstRow = false; ?>
|
||||
<table data-base-target="_next" class="action member-list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -60,7 +65,7 @@ if ($this->hasPermission('config/authentication/groups/edit') && $backend instan
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($members as $member): ?>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td class="member-name"><?= $this->escape($member->user_name); ?></td>
|
||||
<?php if (isset($removeForm)): ?>
|
||||
|
@ -69,7 +74,8 @@ if ($this->hasPermission('config/authentication/groups/edit') && $backend instan
|
|||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($members->hasResult()): ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
|
|
|
@ -26,7 +26,10 @@ if (! isset($backend)) {
|
|||
$reducible = $this->hasPermission('config/authentication/users/remove') && $backend instanceof Reducible;
|
||||
}
|
||||
|
||||
if (count($users) > 0): ?>
|
||||
$firstRow = true;
|
||||
foreach ($users as $user): ?>
|
||||
<?php if ($firstRow): ?>
|
||||
<?php $firstRow = false; ?>
|
||||
<table data-base-target="_next" class="action user-list alternating">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -37,7 +40,7 @@ if (count($users) > 0): ?>
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td class="user-name"><?= $this->qlink($user->user_name, 'user/show', array(
|
||||
'backend' => $backend->getName(),
|
||||
|
@ -62,7 +65,8 @@ if (count($users) > 0): ?>
|
|||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($users->hasResult()): ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
|
|
|
@ -52,7 +52,12 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
|
|||
<?php endif ?>
|
||||
</div>
|
||||
<div class="content memberships">
|
||||
<?php if (count($memberships) > 0): ?>
|
||||
<?php
|
||||
|
||||
$firstRow = true;
|
||||
foreach ($memberships as $membership): ?>
|
||||
<?php if ($firstRow): ?>
|
||||
<?php $firstRow = false; ?>
|
||||
<table data-base-target="_next" class="action membership-list alternating">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -61,7 +66,7 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($memberships as $membership): ?>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td class="membership-group">
|
||||
<?php if ($this->hasPermission('config/authentication/groups/show') && $membership->backend instanceof Selectable): ?>
|
||||
|
@ -86,7 +91,8 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
|
|||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($memberships->hasResult()): ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
|
|
|
@ -158,7 +158,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
|
|||
}
|
||||
|
||||
$this->iterator->rewind();
|
||||
$this->iteratorPosition = 0;
|
||||
$this->iteratorPosition = null;
|
||||
Benchmark::measure('Query result iteration started');
|
||||
}
|
||||
|
||||
|
@ -190,6 +190,8 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
|
|||
if (! $valid) {
|
||||
Benchmark::measure('Query result iteration finished');
|
||||
return false;
|
||||
} elseif ($this->iteratorPosition === null) {
|
||||
$this->iteratorPosition = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -420,6 +422,16 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
|
|||
return $this->hasMore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this query will or has yielded any result
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResult()
|
||||
{
|
||||
return $this->iteratorPosition !== null || $this->fetchRow() !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a limit count and offset to the query
|
||||
*
|
||||
|
|
|
@ -367,6 +367,16 @@ class RepositoryQuery implements QueryInterface, SortRules, Iterator
|
|||
return $this->query->hasMore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this query will or has yielded any result
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResult()
|
||||
{
|
||||
return $this->query->hasResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit this query's results
|
||||
*
|
||||
|
|
|
@ -368,7 +368,7 @@ class Monitoring_ListController extends Controller
|
|||
$this->view->filter = Filter::fromQuerystring((string) $this->params);
|
||||
$query->applyFilter($this->view->filter);
|
||||
$this->applyRestriction('monitoring/filter/objects', $query);
|
||||
$this->view->summary = $query->getQuery()->fetchAll();
|
||||
$this->view->summary = $query;
|
||||
$this->view->column = $form->getValue('state');
|
||||
// $this->view->orientationBox = $orientationBox;
|
||||
$this->view->orientation = $orientation;
|
||||
|
|
|
@ -2,6 +2,19 @@
|
|||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
function contactsLink($match, $view) {
|
||||
$links = array();
|
||||
foreach (preg_split('/,\s/', $match[1]) as $contact) {
|
||||
$links[] = $view->qlink(
|
||||
$contact,
|
||||
'monitoring/show/contact',
|
||||
array('contact_name' => $contact),
|
||||
array('title' => sprintf($view->translate('Show detailed information about %s'), $contact))
|
||||
);
|
||||
}
|
||||
return '[' . implode(', ', $links) . ']';
|
||||
}
|
||||
|
||||
$self = $this;
|
||||
|
||||
if (! $this->compact): ?>
|
||||
|
@ -16,29 +29,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($history) === 0) {
|
||||
echo $this->translate('No history events found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
function contactsLink($match, $view) {
|
||||
$links = array();
|
||||
foreach (preg_split('/,\s/', $match[1]) as $contact) {
|
||||
$links[] = $view->qlink(
|
||||
$contact,
|
||||
'monitoring/show/contact',
|
||||
array('contact_name' => $contact),
|
||||
array('title' => sprintf($view->translate('Show detailed information about %s'), $contact))
|
||||
);
|
||||
}
|
||||
return '[' . implode(', ', $links) . ']';
|
||||
}
|
||||
?>
|
||||
|
||||
<table data-base-target="_next" class="action objecthistory">
|
||||
<tbody>
|
||||
<?php foreach ($history as $event): ?>
|
||||
|
@ -144,7 +134,10 @@ function contactsLink($match, $view) {
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $history->hasResult()): ?>
|
||||
<?= $this->translate('No history events found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -12,13 +12,6 @@
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($comments) === 0) {
|
||||
echo $this->translate('No comments found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table data-base-target="_next"
|
||||
class="action comments multiselect"
|
||||
data-icinga-multiselect-url="/icingaweb2/monitoring/comments/show"
|
||||
|
@ -91,4 +84,7 @@ if (count($comments) === 0) {
|
|||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $comments->hasResult()): ?>
|
||||
<?= $this->translate('No comments found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -8,14 +8,7 @@
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div data-base-target="_next" class="content contacts">
|
||||
<?php
|
||||
|
||||
if (count($contacts) === 0) {
|
||||
echo $this->translate('No contacts found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<?php foreach ($contacts as $contact): ?>
|
||||
<?php foreach ($contacts as $contact): ?>
|
||||
<div class="contact">
|
||||
<?= $this->img('/static/gravatar', array('email' => $contact->contact_email)); ?>
|
||||
<strong><?= $this->qlink(
|
||||
|
@ -59,4 +52,7 @@ if (count($contacts) === 0) {
|
|||
if (true): /* The following piece of HTML MUST be nested in <?php */ ?>
|
||||
<div style="clear: both;"></div>
|
||||
<?php endif; ?>
|
||||
<?php if (! $contacts->hasResult()): ?>
|
||||
<?= $this->translate('No contacts found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -16,14 +16,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($downtimes) === 0) {
|
||||
echo $this->translate('No downtimes found matching the filter,'
|
||||
. ' maybe the downtime already expired.') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table data-base-target="_next"
|
||||
class="action multiselect"
|
||||
data-icinga-multiselect-url="/icingaweb2/monitoring/downtimes/show"
|
||||
|
@ -143,4 +135,7 @@ if (count($downtimes) === 0) {
|
|||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $downtimes->hasResult()): ?>
|
||||
<?= $this->translate('No downtimes found matching the filter, maybe the downtime already expired.'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -15,11 +15,6 @@ if (! $this->compact): ?>
|
|||
<div class="content" data-base-target="_next">
|
||||
<?php
|
||||
|
||||
if (count($summary) === 0) {
|
||||
echo $this->translate('No state changes in the selected time period.') . '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = array(
|
||||
'cnt_up' => array(
|
||||
'tooltip' => $this->translate('%d hosts ok on %s'),
|
||||
|
@ -60,14 +55,6 @@ $settings = array(
|
|||
)
|
||||
);
|
||||
|
||||
$from = intval($form->getValue('from', strtotime('3 months ago')));
|
||||
$to = intval($form->getValue('to', time()));
|
||||
|
||||
// don't display more than ten years, or else this will get really slow
|
||||
if ($to - $from > 315360000) {
|
||||
$from = $to - 315360000;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
foreach ($summary as $entry) {
|
||||
$day = $entry->day;
|
||||
|
@ -90,6 +77,19 @@ foreach ($summary as $entry) {
|
|||
);
|
||||
}
|
||||
|
||||
if (! $summary->hasResult()) {
|
||||
echo $this->translate('No state changes in the selected time period.') . '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$from = intval($form->getValue('from', strtotime('3 months ago')));
|
||||
$to = intval($form->getValue('to', time()));
|
||||
|
||||
// don't display more than ten years, or else this will get really slow
|
||||
if ($to - $from > 315360000) {
|
||||
$from = $to - 315360000;
|
||||
}
|
||||
|
||||
$f = new DateTime();
|
||||
$f->setTimestamp($from);
|
||||
$t = new DateTime();
|
||||
|
@ -117,11 +117,11 @@ for ($i = 0; $i < $diff->days; $i += $step) {
|
|||
}
|
||||
?>
|
||||
<div style="width: 33.5em;">
|
||||
<? foreach (array_reverse($grids) as $key => $grid) { ?>
|
||||
<?php foreach (array_reverse($grids) as $key => $grid): ?>
|
||||
<div style=" <?= $this->orientation === 'horizontal' ? '' : 'display: inline-block; vertical-align: top; top; margin: 0.5em;' ?>">
|
||||
<?= $grid; ?>
|
||||
<?= $this->orientation === 'horizontal' ? '<br />' : '' ?>
|
||||
</div>
|
||||
<? } ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,12 +12,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
if (count($history) === 0) {
|
||||
echo $this->translate('No history events found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table data-base-target="_next" class="action">
|
||||
<tbody>
|
||||
<?php foreach ($history as $event): ?>
|
||||
|
@ -96,4 +90,7 @@ if (count($history) === 0) {
|
|||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $history->hasResult()): ?>
|
||||
<?= $this->translate('No history events found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -13,11 +13,10 @@ if (! $this->compact): ?>
|
|||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($hostgroups) === 0) {
|
||||
echo $this->translate('No hostgroups found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
$firstRow = true;
|
||||
foreach ($hostgroups as $h): ?>
|
||||
<?php if ($firstRow): ?>
|
||||
<?php $firstRow = false; ?>
|
||||
<table class="groupview action" data-base-target="_next">
|
||||
<thead>
|
||||
<th><?= $this->translate('Last Problem'); ?></th>
|
||||
|
@ -28,32 +27,35 @@ if (count($hostgroups) === 0) {
|
|||
<th><?= $this->translate('Service States'); ?></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($hostgroups as $h):
|
||||
if ($h->hosts_down_unhandled) {
|
||||
$handled = false;
|
||||
$state = Host::STATE_DOWN;
|
||||
$lastStateChange = $h->hosts_down_last_state_change_unhandled;
|
||||
} elseif ($h->hosts_unreachable_unhandled) {
|
||||
$handled = false;
|
||||
$state = Host::STATE_UNREACHABLE;
|
||||
$lastStateChange = $h->hosts_unreachable_last_state_change_unhandled;
|
||||
} else {
|
||||
$handled = true;
|
||||
if ($h->hosts_down_handled) {
|
||||
$state = Host::STATE_DOWN;
|
||||
$lastStateChange = $h->hosts_down_last_state_change_handled;
|
||||
} elseif ($h->hosts_unreachable_handled) {
|
||||
$state = Host::STATE_UNREACHABLE;
|
||||
$lastStateChange = $h->hosts_unreachable_last_state_change_handled;
|
||||
} elseif ($h->hosts_up) {
|
||||
$state = Host::STATE_UP;
|
||||
$lastStateChange = $h->hosts_up_last_state_change;
|
||||
} else {
|
||||
$state = Host::STATE_PENDING;
|
||||
$lastStateChange = $h->hosts_pending_last_state_change;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
|
||||
if ($h->hosts_down_unhandled) {
|
||||
$handled = false;
|
||||
$state = Host::STATE_DOWN;
|
||||
$lastStateChange = $h->hosts_down_last_state_change_unhandled;
|
||||
} elseif ($h->hosts_unreachable_unhandled) {
|
||||
$handled = false;
|
||||
$state = Host::STATE_UNREACHABLE;
|
||||
$lastStateChange = $h->hosts_unreachable_last_state_change_unhandled;
|
||||
} else {
|
||||
$handled = true;
|
||||
if ($h->hosts_down_handled) {
|
||||
$state = Host::STATE_DOWN;
|
||||
$lastStateChange = $h->hosts_down_last_state_change_handled;
|
||||
} elseif ($h->hosts_unreachable_handled) {
|
||||
$state = Host::STATE_UNREACHABLE;
|
||||
$lastStateChange = $h->hosts_unreachable_last_state_change_handled;
|
||||
} elseif ($h->hosts_up) {
|
||||
$state = Host::STATE_UP;
|
||||
$lastStateChange = $h->hosts_up_last_state_change;
|
||||
} else {
|
||||
$state = Host::STATE_PENDING;
|
||||
$lastStateChange = $h->hosts_pending_last_state_change;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="state <?= Host::getStateText($state) ?><?= $handled ? ' handled' : '' ?>" href="<?=
|
||||
$this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name))
|
||||
?>">
|
||||
|
@ -461,7 +463,11 @@ if (count($hostgroups) === 0) {
|
|||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($hostgroups->hasResult()): ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<?= $this->translate('No hostgroups found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -15,14 +15,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($hosts) === 0) {
|
||||
echo $this->translate('No hosts found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<table
|
||||
data-base-target="_next"
|
||||
class="action multiselect"
|
||||
|
@ -99,4 +91,7 @@ if (count($hosts) === 0) {
|
|||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $hosts->hasResult()): ?>
|
||||
<?= $this->translate('No hosts found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -12,13 +12,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($notifications) === 0) {
|
||||
echo $this->translate('No notifications found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table data-base-target="_next" class="action">
|
||||
<tbody>
|
||||
<?php foreach ($notifications as $notification):
|
||||
|
@ -71,4 +64,7 @@ if (count($notifications) === 0) {
|
|||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $notifications->hasResult()): ?>
|
||||
<?= $this->translate('No notifications found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($servicegroups) === 0) {
|
||||
echo $this->translate('No servicegroups found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
$firstRow = true;
|
||||
foreach ($servicegroups as $s): ?>
|
||||
<?php if ($firstRow): ?>
|
||||
<?php $firstRow = false; ?>
|
||||
<table class="groupview action" data-base-target="_next">
|
||||
<thead>
|
||||
<th><?= $this->translate('Last Problem'); ?></th>
|
||||
|
@ -23,7 +22,7 @@ if (count($servicegroups) === 0) {
|
|||
<th><?= $this->translate('Service States'); ?></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($servicegroups as $s): ?>
|
||||
<?php endif ?>
|
||||
<tr href="<?= $this->href('monitoring/list/services', array('servicegroup_name' => $s->servicegroup_name)); ?>">
|
||||
<?php if ($s->services_critical_last_state_change_unhandled): ?>
|
||||
<td class="state change critical unhandled">
|
||||
|
@ -298,7 +297,11 @@ if (count($servicegroups) === 0) {
|
|||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($servicegroups->hasResult()): ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<?= $this->translate('No servicegroups found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -18,13 +18,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($services) === 0) {
|
||||
echo $this->translate('No services found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table data-base-target="<?= isset($baseTarget) ? $baseTarget : '_next'; ?>"
|
||||
class="action multiselect <?php if ($this->compact): ?> compact<?php endif ?>" style="table-layout: auto;"
|
||||
data-icinga-multiselect-url="<?= $this->href("monitoring/services/show") ?>"
|
||||
|
@ -91,4 +84,7 @@ if (count($services) === 0) {
|
|||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $services->hasResult()): ?>
|
||||
<?= $this->translate('No services found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
<?php
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
function contactsLink($match, $view) {
|
||||
$links = array();
|
||||
foreach (preg_split('/,\s/', $match[1]) as $contact) {
|
||||
$links[] = $view->qlink(
|
||||
$contact,
|
||||
'monitoring/show/contact',
|
||||
array('contact_name' => $contact),
|
||||
array('title' => sprintf($view->translate('Show detailed information about %s'), $contact))
|
||||
);
|
||||
}
|
||||
return '[' . implode(', ', $links) . ']';
|
||||
}
|
||||
|
||||
$self = $this;
|
||||
|
||||
if (! $this->compact): ?>
|
||||
|
@ -15,29 +28,6 @@ if (! $this->compact): ?>
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php
|
||||
|
||||
if (count($history) === 0) {
|
||||
echo $this->translate('No history events found matching the filter') . '</div>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
function contactsLink($match, $view) {
|
||||
$links = array();
|
||||
foreach (preg_split('/,\s/', $match[1]) as $contact) {
|
||||
$links[] = $view->qlink(
|
||||
$contact,
|
||||
'monitoring/show/contact',
|
||||
array('contact_name' => $contact),
|
||||
array('title' => sprintf($view->translate('Show detailed information about %s'), $contact))
|
||||
);
|
||||
}
|
||||
return '[' . implode(', ', $links) . ']';
|
||||
}
|
||||
?>
|
||||
|
||||
<table data-base-target="_next" class="action objecthistory">
|
||||
<tbody>
|
||||
<?php foreach ($history as $event): ?>
|
||||
|
@ -126,7 +116,10 @@ function contactsLink($match, $view) {
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $history->hasResult()): ?>
|
||||
<?= $this->translate('No history events found matching the filter'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -433,6 +433,16 @@ abstract class DataView implements QueryInterface, SortRules, IteratorAggregate
|
|||
return $this->query->hasMore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this query will or has yielded any result
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResult()
|
||||
{
|
||||
return $this->query->hasResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a limit count and offset
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue