monitoring: Reduce header size for multiple selected hosts

refs #5543
This commit is contained in:
Eric Lippmann 2015-11-10 16:54:02 +01:00
parent 92a2727a0b
commit 317bb24856
2 changed files with 53 additions and 69 deletions

View File

@ -52,21 +52,18 @@ class HostsController extends Controller
protected function handleCommandForm(ObjectsCommandForm $form) protected function handleCommandForm(ObjectsCommandForm $form)
{ {
$this->hostList->setColumns(array( $this->hostList->setColumns(array(
'host_icon_image',
'host_icon_image_alt',
'host_name',
'host_address',
'host_address6',
'host_state',
'host_problem',
'host_handled',
'host_acknowledged', 'host_acknowledged',
'host_active_checks_enabled',
'host_display_name',
'host_handled',
'host_in_downtime', 'host_in_downtime',
'host_is_flapping', 'host_is_flapping',
'host_output', 'host_last_state_change',
'host_name',
'host_notifications_enabled', 'host_notifications_enabled',
'host_active_checks_enabled', 'host_passive_checks_enabled',
'host_passive_checks_enabled' 'host_problem',
'host_state'
)); ));
$form $form
@ -90,24 +87,18 @@ class HostsController extends Controller
->handleRequest(); ->handleRequest();
$this->view->checkNowForm = $checkNowForm; $this->view->checkNowForm = $checkNowForm;
$this->hostList->setColumns(array( $this->hostList->setColumns(array(
'host_icon_image',
'host_icon_image_alt',
'host_name',
'host_address',
'host_address6',
'host_state',
'host_problem',
'host_handled',
'host_acknowledged', 'host_acknowledged',
'host_active_checks_enabled',
'host_display_name',
'host_handled',
'host_in_downtime', 'host_in_downtime',
'host_is_flapping', 'host_is_flapping',
'host_output', 'host_last_state_change',
'host_name',
'host_notifications_enabled', 'host_notifications_enabled',
'host_active_checks_enabled', 'host_passive_checks_enabled',
'host_passive_checks_enabled' 'host_problem',
/*'host_event_handler_enabled', 'host_state'
'host_flap_detection_enabled',
'host_obsessing'*/
)); ));
$acknowledgedObjects = $this->hostList->getAcknowledgedObjects(); $acknowledgedObjects = $this->hostList->getAcknowledgedObjects();

View File

@ -1,48 +1,41 @@
<?php <?php
use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Host;
$i = 0; if (! ($hostCount = count($objects))): return; endif ?>
?> <table class="state-table">
<tbody>
<?php if (($hostCount = count($objects)) > 0): ?> <?php foreach ($objects as $i => $host): /** @var Host $host */
<table class="action state statesummary"> if ($i === 5) {
<tbody> break;
<?php foreach ($objects as $host): /** @var Host $host */ ?> } ?>
<?php <tr>
if (++ $i > 5) { <td class="state-col state-<?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>">
continue; <span class="sr-only"><?= Host::getStateText($host->host_state) ?></span>
} <div class="state-meta">
?> <?= $this->timeSince($host->host_last_state_change, $this->compact) ?>
</div>
<tr> </td>
<td class="state-col state-<?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>"> <td>
<?= Host::getStateText($host->host_state, true); ?> <?= $this->link()->host(
<br /> $host->host_name,
</td> $host->host_display_name
<td> ) ?>
<?= $this->iconImage()->host($host) ?> <?= implode(' ', $this->hostFlags($host)) ?>
<?= implode(' ', $this->hostFlags($host)) ?> </td>
<b><?= $this->escape($host->getName()); ?></b><br> </tr>
<?= $this->escape($host->host_output) ?> <?php endforeach ?>
</td> </tbody>
</tr> </table>
<?php endforeach ?> <?php if ($hostCount > 5): ?>
</tbody> <div class="hosts-link">
</table> <?= $this->qlink(
<div class="hbox-item multi-commands"> sprintf($this->translate('List all %d hosts'), $hostCount),
<?php if ($i > 5): ?> $this->url()->setPath('monitoring/list/hosts'),
<?= null,
$this->qlink( array(
sprintf($this->translate('show all %d hosts'), $i), 'data-base-target' => '_next',
$listAllLink, 'icon' => 'forward'
null, )
array( ) ?>
'icon' => 'down-open', </div>
'data-base-target' => '_next'
)
);
?>
<?php endif ?>
</div>
<?php endif ?> <?php endif ?>