Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monitoring: Reduce header size for multiple selected hosts
refs #5543
- Loading branch information
Showing
2 changed files
with
53 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 37 additions & 44 deletions
81
modules/monitoring/application/views/scripts/partials/host/objects-header.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,41 @@ | ||
<?php | ||
use Icinga\Module\Monitoring\Object\Host; | ||
|
||
$i = 0; | ||
?> | ||
|
||
<?php if (($hostCount = count($objects)) > 0): ?> | ||
<table class="action state statesummary"> | ||
<tbody> | ||
<?php foreach ($objects as $host): /** @var Host $host */ ?> | ||
<?php | ||
if (++ $i > 5) { | ||
continue; | ||
} | ||
?> | ||
|
||
<tr> | ||
<td class="state-col state-<?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>"> | ||
<?= Host::getStateText($host->host_state, true); ?> | ||
<br /> | ||
</td> | ||
<td> | ||
<?= $this->iconImage()->host($host) ?> | ||
<?= implode(' ', $this->hostFlags($host)) ?> | ||
<b><?= $this->escape($host->getName()); ?></b><br> | ||
<?= $this->escape($host->host_output) ?> | ||
</td> | ||
</tr> | ||
<?php endforeach ?> | ||
</tbody> | ||
</table> | ||
<div class="hbox-item multi-commands"> | ||
<?php if ($i > 5): ?> | ||
<?= | ||
$this->qlink( | ||
sprintf($this->translate('show all %d hosts'), $i), | ||
$listAllLink, | ||
null, | ||
array( | ||
'icon' => 'down-open', | ||
'data-base-target' => '_next' | ||
) | ||
); | ||
?> | ||
<?php endif ?> | ||
</div> | ||
if (! ($hostCount = count($objects))): return; endif ?> | ||
<table class="state-table"> | ||
<tbody> | ||
<?php foreach ($objects as $i => $host): /** @var Host $host */ | ||
if ($i === 5) { | ||
break; | ||
} ?> | ||
<tr> | ||
<td class="state-col state-<?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>"> | ||
<span class="sr-only"><?= Host::getStateText($host->host_state) ?></span> | ||
<div class="state-meta"> | ||
<?= $this->timeSince($host->host_last_state_change, $this->compact) ?> | ||
</div> | ||
</td> | ||
<td> | ||
<?= $this->link()->host( | ||
$host->host_name, | ||
$host->host_display_name | ||
) ?> | ||
<?= implode(' ', $this->hostFlags($host)) ?> | ||
</td> | ||
</tr> | ||
<?php endforeach ?> | ||
</tbody> | ||
</table> | ||
<?php if ($hostCount > 5): ?> | ||
<div class="hosts-link"> | ||
<?= $this->qlink( | ||
sprintf($this->translate('List all %d hosts'), $hostCount), | ||
$this->url()->setPath('monitoring/list/hosts'), | ||
null, | ||
array( | ||
'data-base-target' => '_next', | ||
'icon' => 'forward' | ||
) | ||
) ?> | ||
</div> | ||
<?php endif ?> | ||
|