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>
<?= $this->qlink(
sprintf(
$this->translate('Remove all %d scheduled comments'),
$this->translate('Remove %d comments'),
count($comments)
),
$removeAllLink,

View File

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

View File

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

View File

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

View File

@ -17,62 +17,55 @@
<?php if (($serviceCount = count($objects)) === 0): ?>
<?= $this->translate('No services found matching the filter'); ?>
<?php else: ?>
<p>
<?= sprintf($this->translatePlural(
'Issue commands to %s selected service:',
'Issue commands to all %s selected services:',
count($objects)
), '<b>' . count($objects) . '</b>') ?>
<p>
<div>
</p>
<?= $checkNowForm; ?>
</div>
<div>
<br>
<?= $this->qlink(
$this->translate('Reschedule next checks'),
$rescheduleAllLink,
null,
array('icon' => 'reschedule')
); ?>
</div>
<div>
<br>
<?= $this->qlink(
$this->translate('Schedule downtimes'),
$downtimeAllLink,
null,
array('icon' => 'plug')
); ?>
</div>
<div>
<br>
<?= $this->qlink(
$this->translate('Submit passive check results'),
$processCheckResultAllLink,
null,
array('icon' => 'reply')
); ?>
</div>
<div>
<br>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
</div>
<?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),
$sendCustomNotificationLink,
null,
array('icon' => 'comment')
); ?></div>
); ?>
<?php endif; ?>
</p>
<?php
$unhandledCount = count($unhandledObjects);
@ -96,8 +89,7 @@
),
'<b>' . $problemCount . '</b>'
); ?>
<div>
</p>
<?= $this->qlink(
sprintf(
$this->translatePlural(
@ -111,19 +103,20 @@
null,
array('icon' => 'plug')
); ?>
</div>
<?php endif ?>
<?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:'),
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
<div>
</p>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled service problem',
'Schedule a downtime for %u unhandled service problems',
'Schedule a downtime for %u unhandled problem service',
'Schedule a downtime for %u unhandled problem services',
$unhandledCount
),
$unhandledCount
@ -132,13 +125,13 @@
null,
array('icon' => 'plug')
); ?>
</div>
<div><?= $this->qlink(
<br>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unhandled service problem',
'Acknowledge %u unhandled service problems',
'Acknowledge %u unhandled problem service',
'Acknowledge %u unhandled problem services',
$unhandledCount
),
$unhandledCount
@ -146,8 +139,7 @@
$acknowledgeUnhandledLink,
null,
array('icon' => 'ok')
); ?></div>
</p>
); ?>
<?php endif ?>
</div>
@ -167,55 +159,56 @@
</p>
<?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>
<p> <?= sprintf($this->translatePlural(
'%s service currently in downtime.',
'%s services currently in downtime.',
$inDowntimeCount
), '<b>' . $inDowntimeCount . '</b>') ?>
<?= $this->qlink(
$this->translate('List all'),
sprintf(
$this->translatePlural(
'%s scheduled downtime',
'%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(
sprintf($this->translatePlural(
'%s service',
'%s services',
$inDowntimeCount
), $inDowntimeCount),
$inDowntimeLink,
null,
array('data-base-target' => '_next')
);?>
</p>
<?= sprintf($this->translate('are currently in downtime.')) ?>
<?php endif ?>
<?php endif ?>
<?php $commentCount = count($objects->getComments()) ?>
<?php if ($commentCount > 0): ?>
<h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3>
<p><?= sprintf(
$this->translatePlural(
'There is %s comment.',
'There are %s comments.',
$commentCount
), '<b>' . $commentCount . '</b>');
?>
<?= $this->qlink(
$this->translate('List all'),
sprintf(
$this->translatePlural(
'%s comment.',
'%s comments.',
$commentCount
), $commentCount),
$commentsLink,
null,
array('data-base-target' => '_next')
); ?>
<p>
<!--
</p>
<div><?= $this->qlink(
$this->translate('Remove all'),
$deleteCommentLink,
null,
array('icon' => 'trash')
); ?></div>
</p>
-->
<?= $this->translate('on all selected services.') ?>
<?php endif ?>
<?php endif ?>
</div>

View File

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