Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new layout for service multi-view
refs #8565
- Loading branch information
Showing
12 changed files
with
425 additions
and
172 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
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
28 changes: 8 additions & 20 deletions
28
modules/monitoring/application/views/scripts/partials/command/objects-command-form.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,31 +1,19 @@ | ||
<div class="controls"> | ||
|
||
<?php if (! $this->compact): ?> | ||
<?= $tabs; ?> | ||
<?php endif ?> | ||
|
||
<?php if (isset($serviceStates)): ?> | ||
<h1><?= sprintf($this->translate('%d Services Selected'), count($objects)) ?></h1> | ||
<?= $this->render('partials/service/objects-header.phtml'); ?> | ||
<?php else: ?> | ||
<h1><?= sprintf($this->translate('%d Hosts Selected'), count($objects)) ?></h1> | ||
<?= $this->render('partials/host/objects-header.phtml'); ?> | ||
<?php endif ?> | ||
</div> | ||
|
||
<div class="content objects-command"> | ||
<table class="objectlist"> | ||
<thead> | ||
<tr> | ||
<th><?= $this->icon('host'); ?> <?= $this->translate('Host'); ?></th> | ||
<th><?= $this->icon('conf'); ?> <?= $this->translate('Service'); ?></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($form->getObjects() as $object): /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ ?> | ||
<tr> | ||
<?php if ($object->getType() === $object::TYPE_HOST): ?> | ||
<td colspan="2"><?= $this->escape($object->getName()); ?></td> | ||
<?php else: ?> | ||
<td><?= $this->escape($object->getHost()->getName()); ?></td> | ||
<td><?= $this->escape($object->getName()); ?></td> | ||
<?php endif ?> | ||
</tr> | ||
<?php endforeach ?> | ||
</tbody> | ||
</table> | ||
<hr class="command-separator"> | ||
<?= $form; ?> | ||
</div> |
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
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
117 changes: 84 additions & 33 deletions
117
modules/monitoring/application/views/scripts/partials/service/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,34 +1,85 @@ | ||
<?php if (! $this->compact): ?> | ||
<?= $tabs; ?> | ||
<?php endif ?> | ||
<?php | ||
use Icinga\Module\Monitoring\Object\Service; | ||
use Icinga\Web\Url; | ||
?> | ||
|
||
<?php | ||
$i = 0; | ||
$hidden = array(); | ||
$hiddenRich = array(); | ||
?> | ||
<?php if (($serviceCount = count($objects)) > 0): ?> | ||
<div class="hbox"> | ||
<div class="hbox-item" style="width: 6em;"> | ||
<h1 tabindex="-1"> | ||
<?= sprintf($this->translatePlural('Service (%u)', 'Services (%u)', $serviceCount), $serviceCount); ?> | ||
</h1> | ||
</div> | ||
<div class="hbox-item"> | ||
<?= $serviceStatesPieChart; ?> | ||
</div> | ||
<div class="hbox-item" style="font-size: 14px"> | ||
<?php foreach (array_filter($serviceStates) as $text => $count): ?> | ||
<?= sprintf('%s: %u', $this->translate(strtoupper($text)), $count); ?><br> | ||
<?php endforeach ?> | ||
</div> | ||
</div> | ||
<div class="hbox"> | ||
<div class="hbox-item" style="width: 6em;"> | ||
<?php $hostCount = array_sum(array_values($hostStates)); ?> | ||
<strong><?= sprintf($this->translatePlural('Host (%u)', 'Hosts (%u)', $hostCount), $hostCount); ?></strong> | ||
</div> | ||
<div class="hbox-item"> | ||
<?= $hostStatesPieChart; ?> | ||
</div> | ||
<div class="hbox-item" style="font-size: 14px"> | ||
<?php foreach (array_filter($hostStates) as $text => $count): ?> | ||
<?= sprintf('%s: %u', $this->translate(strtoupper($text)), $count); ?><br> | ||
<?php endforeach ?> | ||
</div> | ||
</div> | ||
<?php endif ?> | ||
<p> | ||
<table class="state statesummary"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th></th> | ||
<th><?= $this->icon('service'); ?> <?= $this->translate('Service'); ?></th> | ||
<th><?= $this->icon('host'); ?> <?= $this->translate('Host'); ?></th> | ||
<th class="collapse"><?= $this->translate('Output'); ?></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<?php foreach ($objects as $service): /** @var Service $service */ ?> | ||
<?php | ||
$i++; | ||
if ($i > 5) { | ||
$desc = $service->getHost()->getName() . ' on ' . $service->getName(); | ||
$hidden[] = $desc; | ||
$hiddenRich[] = sprintf("<div class='color-box badge-%s'></div>%s", $service->getStateText($service->service_state) ,$desc); | ||
continue; | ||
} | ||
?> | ||
|
||
<tr class="state <?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>"> | ||
<td class="state"><?= Service::getStateText($service->service_state, true); ?><br /></td> | ||
<td> | ||
<?php if (!$service->service_handled && $service->service_state > 0): ?> | ||
<?= $this->icon('attention-alt', $this->translate('Unhandled')) ?> | ||
<?php endif ?> | ||
|
||
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?> | ||
<?= $this->icon('ok', $this->translate('Acknowledged') . ( | ||
$service->service_last_ack ? ': ' . $service->service_last_ack : '' | ||
)) ?> | ||
<?php endif ?> | ||
|
||
<?php if ($service->service_is_flapping): ?> | ||
<?= $this->icon('flapping', $this->translate('Flapping')) ?> | ||
<?php endif ?> | ||
|
||
<?php if (!$service->service_notifications_enabled): ?> | ||
<?= $this->icon('bell-off-empty', $this->translate('Notifications Disabled')) ?> | ||
<?php endif ?> | ||
|
||
<?php if ($service->service_in_downtime): ?> | ||
<?= $this->icon('plug', $this->translate('In Downtime')) ?> | ||
<?php endif ?> | ||
|
||
<?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?> | ||
<?= $this->icon('comment', $this->translate('Last Comment: ') . $service->service_last_comment) ?> | ||
<?php endif ?> | ||
</td> | ||
<td><?= $this->escape($service->getName()); ?></td> | ||
<td><?= $this->escape($service->getHost()->getName()); ?></b></td> | ||
<td><p class="pluginoutput collapse"><?= $this->escape($service->service_output) ?></p></td> | ||
</tr> | ||
<?php endforeach ?> | ||
|
||
<?php if (count($hidden)): ?> | ||
<tr> | ||
<td> | ||
<div class="selection-info" data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>" | ||
title="<?= join(', ', $hidden) ?>"> | ||
<?= sprintf(t('%d more ...'), count($hidden)) ?> | ||
</div> | ||
</td> | ||
</tr> | ||
<?php endif ?> | ||
|
||
</tbody> | ||
</table> | ||
</p> | ||
<?php endif ?> |
Oops, something went wrong.