Skip to content

Commit

Permalink
monitoring: Reduce header size for multiple selected services
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Nov 10, 2015
1 parent 848882b commit 818105b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 76 deletions.
50 changes: 16 additions & 34 deletions modules/monitoring/application/controllers/ServicesController.php
Expand Up @@ -53,28 +53,20 @@ public function init()
protected function handleCommandForm(ObjectsCommandForm $form)
{
$this->serviceList->setColumns(array(
'host_icon_image',
'host_icon_image_alt',
'host_display_name',
'host_name',
'host_address',
'host_address6',
'host_output',
'host_state',
'host_problem',
'host_handled',
'service_icon_image',
'service_icon_image_alt',
'service_acknowledged',
'service_active_checks_enabled',
'service_description',
'service_state',
'service_problem',
'service_display_name',
'service_handled',
'service_acknowledged',
'service_in_downtime',
'service_is_flapping',
'service_output',
'service_last_state_change',
'service_notifications_enabled',
'service_active_checks_enabled',
'service_passive_checks_enabled'
'service_passive_checks_enabled',
'service_state'
));

$form
Expand All @@ -99,32 +91,22 @@ public function showAction()
->handleRequest();
$this->view->checkNowForm = $checkNowForm;
$this->serviceList->setColumns(array(
'host_icon_image',
'host_icon_image_alt',
'host_display_name',
'host_name',
'host_address',
'host_address6',
'host_output',
'host_state',
'host_problem',
'host_handled',
'service_icon_image',
'service_icon_image_alt',
'service_output',
'host_state',
'service_acknowledged',
'service_active_checks_enabled',
'service_description',
'service_state',
'service_problem',
'service_display_name',
'service_handled',
'service_acknowledged',
'service_in_downtime',
'service_is_flapping',
'service_last_state_change',
'service_notifications_enabled',
'service_active_checks_enabled',
'service_passive_checks_enabled'
/*
'service_event_handler_enabled',
'service_flap_detection_enabled',
'service_obsessing'*/
'service_passive_checks_enabled',
'service_problem',
'service_state'
));

$acknowledgedObjects = $this->serviceList->getAcknowledgedObjects();
Expand Down
2 changes: 1 addition & 1 deletion modules/monitoring/application/views/helpers/Link.php
Expand Up @@ -52,7 +52,7 @@ public function host($host, $linkText)
public function service($service, $serviceLinkText, $host, $hostLinkText, $class = null)
{
return sprintf(
'%s: %s',
'%s: %s',
$this->host($host, $hostLinkText),
$this->view->qlink(
$serviceLinkText,
Expand Down
@@ -1,46 +1,45 @@
<?php
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;

$i = 0;
?>
<?php if (($serviceCount = count($objects)) > 0): ?>
<table class='action state statesummary'>
<tbody>
<?php foreach ($objects as $service): /** @var Service $service */ ?>
<?php
if (++ $i > 5) {
continue;
}
?>
<tr>
<td class="state-col state-<?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>"?>
<?= Service::getStateText($service->service_state, true); ?><br />
</td>
<td>
<?= $this->iconImage()->service($service) ?>
if (! ($serviceCount = count($objects))): return; endif ?>
<table class="state-table">
<tbody>
<?php foreach ($objects as $i => $service): /** @var Service $service */
if ($i === 5) {
break;
} ?>
<tr>
<td class="state-col state-<?= Service::getStateText($service->service_state) ?><?= $service->service_handled ? ' handled' : '' ?>">
<span class="sr-only"><?= Service::getStateText($service->service_state) ?></span>
<div class="state-meta">
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?>
</div>
</td>
<td>
<?= $this->link()->service(
$service->service_description,
$service->service_display_name,
$service->host_name,
$service->host_display_name
. ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : '')
) ?>
<?= implode(' ', $this->serviceFlags($service)) ?>
<b>
<?= $this->escape($service->getHost()->getName()); ?>:
<?= $this->escape($service->getName()); ?> <br>
</b>
<?= $this->escape($service->service_output) ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<div class="hbox-item multi-commands">
<?php if ($i > 5): ?>
<?= $this->qlink(
sprintf($this->translate('List all %d services'), $i),
$listAllLink,
null,
array(
'icon' => 'down-open',
'data-base-target' => '_next'
)
);
?>
<?php endif ?>
</div>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($serviceCount > 5): ?>
<div class="services-link">
<?= $this->qlink(
sprintf($this->translate('List all %d services'), $serviceCount),
$this->url()->setPath('monitoring/list/services'),
null,
array(
'data-base-target' => '_next',
'icon' => 'forward'
)
) ?>
</div>
<?php endif ?>

0 comments on commit 818105b

Please sign in to comment.