list/services: flip host/service for readability

Re-allow table.action to manually choose row action link if it should not
be the first one. This existed once but got lost.
This commit is contained in:
Thomas Gelf 2015-06-16 02:36:53 +02:00
parent 3f926b1568
commit 09c0ebcacd
2 changed files with 30 additions and 21 deletions

View File

@ -6,15 +6,15 @@ $selfUrl = 'monitoring/list/services';
if (! $this->compact): ?> if (! $this->compact): ?>
<div class="controls separated"> <div class="controls separated">
<?= $this->tabs; ?> <?= $this->tabs ?>
<div class="dontprint"> <div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml'); ?> <?= $this->render('list/components/selectioninfo.phtml') ?>
<?= $this->render('list/components/servicesummary.phtml'); ?> <?= $this->render('list/components/servicesummary.phtml') ?>
</div> </div>
<?= $this->sortBox; ?> <?= $this->sortBox ?>
<?= $this->limiter; ?> <?= $this->limiter ?>
<?= $this->paginator; ?> <?= $this->paginator ?>
<?= $this->filterEditor; ?> <?= $this->filterEditor ?>
</div> </div>
<?php endif ?> <?php endif ?>
<div class="content"> <div class="content">
@ -48,7 +48,7 @@ if (count($services) === 0) {
?> ?>
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>"> <tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<td class="state"> <td class="state">
<strong><?= Service::getStateText($service->service_state, true); ?></strong> <strong><?= Service::getStateText($service->service_state, true) ?></strong>
<?php if ((int) $service->service_state !== 99): ?> <?php if ((int) $service->service_state !== 99): ?>
<br /> <br />
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?> <?= $this->timeSince($service->service_last_state_change, $this->compact) ?>
@ -62,23 +62,27 @@ if (count($services) === 0) {
<td> <td>
<?= $this->iconImage()->service($service) ?> <?= $this->iconImage()->service($service) ?>
<span class="objectflags"><?= implode(' ', $this->serviceFlags($service)) ?></span> <span class="objectflags"><?= implode(' ', $this->serviceFlags($service)) ?></span>
<?= $this->qlink( <?php if ($this->showHost): ?><?= $this->qlink(
$service->service_display_name,
$serviceLink,
null,
array('title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$service->service_display_name,
$service->host_display_name
))
); ?><?php if ($this->showHost): ?> on <?= $this->qlink(
$service->host_display_name . ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : ''), $service->host_display_name . ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : ''),
$hostLink, $hostLink,
null, null,
array('title' => sprintf($this->translate('Show detailed information for host %s'), $service->host_display_name)) array('title' => sprintf($this->translate('Show detailed information for host %s'), $service->host_display_name))
); ?><?php endif ?><br> ) ?>:
<?php endif ?><?= $this->qlink(
$service->service_display_name,
$serviceLink,
null,
array(
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$service->service_display_name,
$service->host_display_name
),
'class' => 'rowaction'
)
) ?><br />
<div class="sparkline-box"><?= $this->perfdata($service->service_perfdata, true, 8) ?> </div> <div class="sparkline-box"><?= $this->perfdata($service->service_perfdata, true, 8) ?> </div>
<p class="pluginoutput"><?= $this->escape($this->ellipsis($service->service_output, 10000)); ?></p> <p class="pluginoutput"><?= $this->escape($this->ellipsis($service->service_output, 10000)) ?></p>
</td> </td>
<?php foreach($this->addColumns as $col): ?> <?php foreach($this->addColumns as $col): ?>
<td><?= $this->escape($service->$col) ?></td> <td><?= $this->escape($service->$col) ?></td>

View File

@ -42,10 +42,15 @@
// Set first links href in a action table tr as row href: // Set first links href in a action table tr as row href:
$('table.action tr', el).each(function(idx, el) { $('table.action tr', el).each(function(idx, el) {
var $a = $('a[href]', el).first(); var $a = $('a[href].rowaction', el).first();
if ($a.length) { if ($a.length) {
// TODO: Find out whether we leak memory on IE with this: // TODO: Find out whether we leak memory on IE with this:
$(el).attr('href', $a.attr('href')); $(el).attr('href', $a.attr('href'));
return;
}
$a = $('a[href]', el).first();
if ($a.length) {
$(el).attr('href', $a.attr('href'));
} }
}); });