Improve multi view layout

refs #8565
This commit is contained in:
Matthias Jentsch 2015-05-18 14:49:06 +02:00
parent 00bbb762a1
commit e84491d438
6 changed files with 239 additions and 248 deletions

View File

@ -19,7 +19,7 @@
<div> <div>
<?= $this->qlink( <?= $this->qlink(
sprintf( sprintf(
$this->translate('Remove all %d scheduled comments'), $this->translate('Remove %d comments'),
count($comments) count($comments)
), ),
$removeAllLink, $removeAllLink,

View File

@ -13,66 +13,61 @@
<?= $this->icon('reschedule') ?> <?= $this->icon('reschedule') ?>
<?= $this->translate('Commands') ?> <?= $this->translate('Commands') ?>
</h3> </h3>
<p>
<?= sprintf($this->translatePlural( <?= sprintf($this->translatePlural(
'Issue commands to %s selected host:', 'Issue commands to %s selected host:',
'Issue commands to all %s selected hosts:', 'Issue commands to all %s selected hosts:',
count($objects) count($objects)
), '<b>' . count($objects) . '</b>') ?> ), '<b>' . count($objects) . '</b>') ?>
</p>
<?php if (($hostCount = count($objects)) === 0): ?> <?php if (($hostCount = count($objects)) === 0): ?>
<?= $this->translate('No hosts found matching the filter'); ?> <?= $this->translate('No hosts found matching the filter'); ?>
<?php else: ?> <?php else: ?>
<?= $checkNowForm; ?>
<p> <br>
<div> <?= $this->qlink(
<?= $checkNowForm; ?> $this->translate('Reschedule next checks'),
</div> $rescheduleAllLink,
null,
array('icon' => 'reschedule')
); ?>
<div> <br>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Reschedule next checks'), $this->translate('Schedule downtimes'),
$rescheduleAllLink, $downtimeAllLink,
null, null,
array('icon' => 'reschedule') array('icon' => 'plug')
); ?> ); ?>
</div>
<div> <br>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Schedule downtimes'), $this->translate('Submit passive check results'),
$downtimeAllLink, $processCheckResultAllLink,
null, null,
array('icon' => 'plug') array('icon' => 'reply')
); ?> ); ?>
</div>
<div> <br>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Submit passive check results'), $this->translate('Add comments'),
$processCheckResultAllLink, $addCommentLink,
null, null,
array('icon' => 'reply') array('icon' => 'comment')
); ?> ); ?>
</div>
<div>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
</div>
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?> <?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
<div><?= $this->qlink( <br>
<?= $this->qlink(
sprintf($this->translate('Send a custom notification for all %u hosts'), $hostCount), sprintf($this->translate('Send a custom notification for all %u hosts'), $hostCount),
$sendCustomNotificationLink, $sendCustomNotificationLink,
null, null,
array('icon' => 'comment') array('icon' => 'comment')
); ?></div> ); ?>
<?php endif; ?> <?php endif; ?>
</p>
<?php <?php
$unhandledCount = count($unhandledObjects); $unhandledCount = count($unhandledObjects);
@ -80,7 +75,6 @@
?> ?>
<?php if ($problemCount || $unhandledCount): ?> <?php if ($problemCount || $unhandledCount): ?>
<div>
<h3> <h3>
<?= $this->icon('attention-alt') ?> <?= $this->icon('attention-alt') ?>
<?= $this->translatePlural( <?= $this->translatePlural(
@ -92,16 +86,16 @@
<?php if ($problemCount): ?> <?php if ($problemCount): ?>
<p> <p>
<?= sprintf( <?= sprintf(
$this->translatePlural( $this->translatePlural(
'There is %s problem, issue commands to the problematic host:', 'There is %s problem.',
'There are %s problems, issue commands to the problematic hosts:', 'There are %s problems.',
$problemCount $problemCount
), ),
'<b>' . $problemCount . '</b>' '<b>' . $problemCount . '</b>'
); ?> ); ?>
</p>
<div><?= $this->qlink( <?= $this->qlink(
sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'Schedule a downtime for %u problem host', 'Schedule a downtime for %u problem host',
@ -113,13 +107,11 @@
$downtimeLink, $downtimeLink,
null, null,
array('icon' => 'plug') array('icon' => 'plug')
); ?></div> ); ?>
</p>
<?php endif; ?> <?php endif; ?>
<?php if ($unhandledCount): ?> <?php if ($unhandledCount): ?>
<p> <p>
<?= sprintf( <?= sprintf(
$this->translatePlural( $this->translatePlural(
'There is %s unhandled problem host, issue commands to the problematic host:', 'There is %s unhandled problem host, issue commands to the problematic host:',
@ -128,8 +120,9 @@
), ),
'<span class="badge badge-critical">' . $unhandledCount . '</span>' '<span class="badge badge-critical">' . $unhandledCount . '</span>'
); ?> ); ?>
</p>
<div><?= $this->qlink( <?= $this->qlink(
sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'Schedule a downtime for %u unhandled problem host', 'Schedule a downtime for %u unhandled problem host',
@ -141,10 +134,10 @@
$downtimeUnhandledLink, $downtimeUnhandledLink,
null, null,
array('icon' => 'plug') array('icon' => 'plug')
); ?></div> ); ?>
<br>
<div><?= $this->qlink( <?= $this->qlink(
sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'Acknowledge %u unhandled problem host', 'Acknowledge %u unhandled problem host',
@ -156,19 +149,16 @@
$acknowledgeUnhandledLink, $acknowledgeUnhandledLink,
null, null,
array('icon' => 'ok') array('icon' => 'ok')
); ?></div> ); ?>
</p>
<?php endif; ?> <?php endif; ?>
</div>
<?php endif;?> <?php endif;?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?> <?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<div> <div>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3> <h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
<p><?= sprintf( <?= sprintf(
$this->translatePlural( $this->translatePlural(
'%s Acknowledged Host Problem', '%s Acknowledged Host Problem',
'%s Acknowledged Host Problems', '%s Acknowledged Host Problems',
@ -181,57 +171,60 @@
</div> </div>
<?php endif ?> <?php endif ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?> <?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?>
<h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3> <?php if ($scheduledDowntimeCount): ?>
<p><?= sprintf( <h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3>
$this->translatePlural( <?= $this->qlink(
'%s Host currently in downtime.', sprintf(
'%s Hosts currently in downtime.', $this->translatePlural(
$inDowntimeCount '%s scheduled downtime',
'%s scheduled downtimes',
$scheduledDowntimeCount
),
$scheduledDowntimeCount
), ),
'<b>' . $inDowntimeCount . '</b>' $showDowntimesLink,
) ?> <?= $this->qlink(
$this->translate('List all'),
$inDowntimeLink,
null, null,
array('data-base-target' => '_next') array('data-base-target' => '_next')
); ?> );?>
<?= sprintf($this->translate('on all selected hosts.')) ?>
</p> <?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
<br>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'%s host',
'%s hosts',
$inDowntimeCount
),
$inDowntimeCount
),
$inDowntimeLink,
null,
array('data-base-target' => '_next')
); ?>
<?= $this->translate('are currently in downtime.') ?>
<?php endif; ?>
<?php endif ?> <?php endif ?>
<?php if (($commentCount = count($objects->getComments())) > 0): ?> <?php if (($commentCount = count($objects->getComments())) > 0): ?>
<h3> <?= $this->icon('comment', $this->translate('Comments'))?> <?=$this->translate('Comments') ?></h3> <h3> <?= $this->icon('comment', $this->translate('Comments'))?> <?=$this->translate('Comments') ?></h3>
<p> <?= $this->qlink(
<?= sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'There is %s host comment.', '%s comment',
'There are %s host comments.', '%s comments',
$commentCount $commentCount
), ),
'<b>' . $commentCount . '</b>' $commentCount
) ?> ),
$commentsLink,
<?= $this->qlink( null,
$this->translate('List all'), array('data-base-target' => '_next')
$commentsLink, ); ?>
null, <?= $this->translate('on all selected hosts.') ?>
array('data-base-target' => '_next')
); ?>
</p>
<!--
<p>
<div><?= $this->qlink(
$this->translate('Remove all'),
$deleteCommentLink,
null,
array('icon' => 'trash')
); ?></div>
</p>
-->
<?php endif ?> <?php endif ?>
<?php endif ?> <?php endif ?>

View File

@ -5,22 +5,22 @@ $i = 0;
?> ?>
<?php if (($hostCount = count($objects)) > 0): ?> <?php if (($hostCount = count($objects)) > 0): ?>
<table class="state statesummary"> <table class="action state statesummary">
<tbody> <tbody>
<?php foreach ($objects as $host): /** @var Host $host */ ?> <?php foreach ($objects as $host): /** @var Host $host */ ?>
<?php <?php
$i++; if (++ $i > 5) {
if ($i > 5) {
continue; continue;
} }
?> ?>
<tr class="state <?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>"> <tr class="state <?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>">
<td class="state"><?= Host::getStateText($host->host_state, true); ?><br /></td> <td class="state"><?= Host::getStateText($host->host_state, true); ?><br /></td>
<td><?= implode(' ', $this->hostFlags($host)) ?></td> <td>
<td class="name oneline"><?= $this->escape($host->getName()); ?></td> <?= implode(' ', $this->hostFlags($host)) ?>
<td><?= $this->escape($host->host_output) ?></td> <b><?= $this->escape($host->getName()); ?></b><br>
<?= $this->escape($host->host_output) ?>
</td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>

View File

@ -4,20 +4,25 @@ use Icinga\Module\Monitoring\Object\Service;
$i = 0; $i = 0;
?> ?>
<?php if (($serviceCount = count($objects)) > 0): ?> <?php if (($serviceCount = count($objects)) > 0): ?>
<table class="state statesummary"> <table class="action state statesummary">
<tbody> <tbody>
<?php foreach ($objects as $service): /** @var Service $service */ ?> <?php foreach ($objects as $service): /** @var Service $service */ ?>
<?php <?php
if ($i ++ > 5) { if (++ $i > 5) {
continue; continue;
} }
?> ?>
<tr class="state <?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>"> <tr class="state <?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>">
<td class="state"><?= Service::getStateText($service->service_state, true); ?><br /></td> <td class="state"><?= Service::getStateText($service->service_state, true); ?><br /></td>
<td><?= implode(' ', $this->serviceFlags($service)) ?></td> <td>
<td class="name oneline"><?= $this->escape($service->getName()); ?></td> <?= implode(' ', $this->serviceFlags($service)) ?>
<td class="name oneline"><?= $this->escape($service->getHost()->getName()); ?></b></td> <b>
<td><?= $this->escape($service->service_output) ?></td> <?= $this->escape($service->getName()); ?>
<?= $this->translate('on') ?>
<?= $this->escape($service->getHost()->getName()); ?><br>
</b>
<?= $this->escape($service->service_output) ?>
</td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>

View File

@ -17,62 +17,55 @@
<?php if (($serviceCount = count($objects)) === 0): ?> <?php if (($serviceCount = count($objects)) === 0): ?>
<?= $this->translate('No services found matching the filter'); ?> <?= $this->translate('No services found matching the filter'); ?>
<?php else: ?> <?php else: ?>
<p>
<?= sprintf($this->translatePlural( <?= sprintf($this->translatePlural(
'Issue commands to %s selected service:', 'Issue commands to %s selected service:',
'Issue commands to all %s selected services:', 'Issue commands to all %s selected services:',
count($objects) count($objects)
), '<b>' . count($objects) . '</b>') ?> ), '<b>' . count($objects) . '</b>') ?>
</p>
<?= $checkNowForm; ?>
<br>
<?= $this->qlink(
$this->translate('Reschedule next checks'),
$rescheduleAllLink,
null,
array('icon' => 'reschedule')
); ?>
<p> <br>
<div> <?= $this->qlink(
<?= $checkNowForm; ?> $this->translate('Schedule downtimes'),
</div> $downtimeAllLink,
null,
array('icon' => 'plug')
); ?>
<div> <br>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Reschedule next checks'), $this->translate('Submit passive check results'),
$rescheduleAllLink, $processCheckResultAllLink,
null, null,
array('icon' => 'reschedule') array('icon' => 'reply')
); ?> ); ?>
</div>
<div> <br>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Schedule downtimes'), $this->translate('Add comments'),
$downtimeAllLink, $addCommentLink,
null, null,
array('icon' => 'plug') array('icon' => 'comment')
); ?> ); ?>
</div>
<div>
<?= $this->qlink(
$this->translate('Submit passive check results'),
$processCheckResultAllLink,
null,
array('icon' => 'reply')
); ?>
</div>
<div>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
</div>
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?> <?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
<div><?= $this->qlink( <br>
<?= $this->qlink(
sprintf($this->translate('Send a custom notification for all %u services'), $serviceCount), sprintf($this->translate('Send a custom notification for all %u services'), $serviceCount),
$sendCustomNotificationLink, $sendCustomNotificationLink,
null, null,
array('icon' => 'comment') array('icon' => 'comment')
); ?></div> ); ?>
<?php endif; ?> <?php endif; ?>
</p>
<?php <?php
$unhandledCount = count($unhandledObjects); $unhandledCount = count($unhandledObjects);
@ -88,66 +81,65 @@
<?php if ($problemCount): ?> <?php if ($problemCount): ?>
<p> <p>
<?= sprintf( <?= sprintf(
$this->translatePlural(
'There is %s problem, issue commands to the problem service',
'There are %s problems, issue commands to the problem services',
$problemCount
),
'<b>' . $problemCount . '</b>'
); ?>
</p>
<?= $this->qlink(
sprintf(
$this->translatePlural( $this->translatePlural(
'There is %s problem, issue commands to the problem service', 'Schedule a downtime for %s problem service',
'There are %s problems, issue commands to the problem services', 'Schedule downtimes for %s problem services',
$problemCount $problemCount
), ),
'<b>' . $problemCount . '</b>' $problemCount
); ?> ),
$downtimeLink,
<div> null,
<?= $this->qlink( array('icon' => 'plug')
sprintf( ); ?>
$this->translatePlural(
'Schedule a downtime for %s problem service',
'Schedule downtimes for %s problem services',
$problemCount
),
$problemCount
),
$downtimeLink,
null,
array('icon' => 'plug')
); ?>
</div>
<?php endif ?> <?php endif ?>
<?php if ($unhandledCount): ?> <?php if ($unhandledCount): ?>
<p><?= sprintf($this->translate('There are %s unhandled problems. ' . <p>
<?= sprintf($this->translate('There are %s unhandled problem services. ' .
'Issue commands to the problematic services:'), 'Issue commands to the problematic services:'),
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?> '<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
<div>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled service problem',
'Schedule a downtime for %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$downtimeUnhandledLink,
null,
array('icon' => 'plug')
); ?>
</div>
<div><?= $this->qlink( </p>
sprintf( <?= $this->qlink(
$this->translatePlural( sprintf(
'Acknowledge %u unhandled service problem', $this->translatePlural(
'Acknowledge %u unhandled service problems', 'Schedule a downtime for %u unhandled problem service',
$unhandledCount 'Schedule a downtime for %u unhandled problem services',
),
$unhandledCount $unhandledCount
), ),
$acknowledgeUnhandledLink, $unhandledCount
null, ),
array('icon' => 'ok') $downtimeUnhandledLink,
); ?></div> null,
</p> array('icon' => 'plug')
); ?>
<br>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unhandled problem service',
'Acknowledge %u unhandled problem services',
$unhandledCount
),
$unhandledCount
),
$acknowledgeUnhandledLink,
null,
array('icon' => 'ok')
); ?>
<?php endif ?> <?php endif ?>
</div> </div>
@ -167,55 +159,56 @@
</p> </p>
<?php endif ?> <?php endif ?>
<?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0 /*&& $auth->hasPermission('monitoring/command/comment/delete')*/): ?> <?php if ($scheduledDowntimeCount): ?>
<h3> <?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?> </h3> <h3><?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?></h3>
<p> <?= sprintf($this->translatePlural( <?= $this->qlink(
'%s service currently in downtime.', sprintf(
'%s services currently in downtime.', $this->translatePlural(
$inDowntimeCount '%s scheduled downtime',
), '<b>' . $inDowntimeCount . '</b>') ?> '%s scheduled downtimes',
$scheduledDowntimeCount
),
$scheduledDowntimeCount
),
$showDowntimesLink,
null,
array('data-base-target' => '_next')
);?>
<?= sprintf($this->translate('on all selected services.')) ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
<br>
<?= $this->qlink( <?= $this->qlink(
$this->translate('List all'), sprintf($this->translatePlural(
'%s service',
'%s services',
$inDowntimeCount
), $inDowntimeCount),
$inDowntimeLink, $inDowntimeLink,
null, null,
array('data-base-target' => '_next') array('data-base-target' => '_next')
);?> );?>
</p> <?= sprintf($this->translate('are currently in downtime.')) ?>
<?php endif ?>
<?php endif ?> <?php endif ?>
<?php $commentCount = count($objects->getComments()) ?>
<?php $commentCount = count($objects->getComments()) ?> <?php if ($commentCount > 0): ?>
<?php if ($commentCount > 0): ?> <h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3>
<h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3> <?= $this->qlink(
<p><?= sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'There is %s comment.', '%s comment.',
'There are %s comments.', '%s comments.',
$commentCount $commentCount
), '<b>' . $commentCount . '</b>'); ), $commentCount),
?> $commentsLink,
<?= $this->qlink(
$this->translate('List all'),
$commentsLink,
null,
array('data-base-target' => '_next')
); ?>
<p>
<!--
</p>
<div><?= $this->qlink(
$this->translate('Remove all'),
$deleteCommentLink,
null, null,
array('icon' => 'trash') array('data-base-target' => '_next')
); ?></div> ); ?>
</p> <?= $this->translate('on all selected services.') ?>
-->
<?php endif ?>
<?php endif ?> <?php endif ?>
<?php endif ?>
</div> </div>

View File

@ -944,7 +944,7 @@ table.statesummary {
} }
td { td {
font-size: 0.85em; font-size: 0.9em;
line-height: 1.2em; line-height: 1.2em;
padding-left: 0.2em; padding-left: 0.2em;
margin: 0; margin: 0;