Add section for problem hosts and services to multi-view

Add a section to handle all problems, in contrast to the already existing section for handling all unhandled problems.

refs #8565
This commit is contained in:
Matthias Jentsch 2015-04-07 17:41:38 +02:00
parent 46da404452
commit eeb5a38b6c
4 changed files with 178 additions and 95 deletions

View File

@ -8,7 +8,7 @@
<br> <br>
<div class="hbox-item"> <div class="hbox-item">
<?= $this->translate('Host States:') ?> <?= $this->translate('States:') ?>
&nbsp;<?= $hostStatesPieChart; ?> &nbsp;<?= $hostStatesPieChart; ?>
</div> </div>
@ -21,7 +21,11 @@
<?= $this->icon('reschedule') ?> <?= $this->icon('reschedule') ?>
<?= $this->translate('Commands') ?> <?= $this->translate('Commands') ?>
</h3> </h3>
<?= sprintf($this->translate('Issue commands to all %d selected hosts:'), count($objects)) ?> <?= sprintf($this->translatePlural(
'Issue commands to %s selected host:',
'Issue commands to all %s selected hosts:',
count($objects)
), '<b>' . count($objects) . '</b>') ?>
<?php if (($hostCount = count($objects)) === 0): ?> <?php if (($hostCount = count($objects)) === 0): ?>
<?= $this->translate('No hosts matching the filter'); ?> <?= $this->translate('No hosts matching the filter'); ?>
@ -69,29 +73,66 @@
</div> </div>
</p> </p>
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?> <?php
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
?>
<?php if ($problemCount || $unhandledCount): ?>
<div> <div>
<h3> <h3>
<?= $this->icon('attention-alt') ?> <?= $this->icon('attention-alt') ?>
<?= $this->translatePlural( <?= $this->translatePlural(
'Unhandled Problem', 'Problem',
'Unhandled Problems', 'Problems',
$unhandledCount $unhandledCount + $problemCount
) ?> ) ?>
</h3> </h3>
<?php if ($problemCount): ?>
<p> <p>
<?= sprintf( <?= sprintf(
$this->translate('There are %s unhandled problems. Issue commands to the problematic hosts:'), $this->translatePlural(
'<span class="badge badge-critical">' . $unhandledCount . '</span>' 'There is %s problem, issue commands to the problematic host:',
) ?> 'There are %s problems, issue commands to the problematic hosts:',
$problemCount
),
'<b>' . $problemCount . '</b>'
); ?>
<div><?= $this->qlink( <div><?= $this->qlink(
sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'Schedule a downtime for %u host', 'Schedule a downtime for %u problem host',
'Schedule a downtime for %u hosts', 'Schedule a downtime for %u problem hosts',
$problemCount
),
$problemCount
),
$downtimeLink,
null,
array('icon' => 'plug')
); ?></div>
</p>
<?php endif; ?>
<?php if ($unhandledCount): ?>
<p>
<?= sprintf(
$this->translatePlural(
'There is %s unhandled problem host, issue commands to the problematic host:',
'There are %s unhandled problem hosts, issue commands to the problematic hosts:',
$unhandledCount
),
'<span class="badge badge-critical">' . $unhandledCount . '</span>'
); ?>
<div><?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled problem host',
'Schedule a downtime for %u unhandled problem hosts',
$unhandledCount $unhandledCount
), ),
$unhandledCount $unhandledCount
@ -105,8 +146,8 @@
<div><?= $this->qlink( <div><?= $this->qlink(
sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'Acknowledge %u unhandled host', 'Acknowledge %u unhandled problem host',
'Acknowledge %u unhandled hosts', 'Acknowledge %u unhandled problem hosts',
$unhandledCount $unhandledCount
), ),
$unhandledCount $unhandledCount
@ -115,11 +156,12 @@
null, null,
array('icon' => 'ok') array('icon' => 'ok')
); ?></div> ); ?></div>
</p> </p>
<?php endif; ?>
</div> </div>
<?php endif ?> <?php endif;?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?> <?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<div> <div>
@ -127,11 +169,11 @@
<p><?= sprintf( <p><?= sprintf(
$this->translatePlural( $this->translatePlural(
'%u Acknowledged Host Problem', '%s Acknowledged Host Problem',
'%u Acknowledged Host Problems', '%s Acknowledged Host Problems',
$acknowledgedCount $acknowledgedCount
), ),
$acknowledgedCount '<b>' . $acknowledgedCount . '</b>'
); ?></p> ); ?></p>
<?= $removeAckForm ?> <?= $removeAckForm ?>
@ -143,11 +185,11 @@
<h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3> <h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3>
<p><?= sprintf( <p><?= sprintf(
$this->translatePlural( $this->translatePlural(
'%u Host currently in downtime.', '%s Host currently in downtime.',
'%u Hosts currently in downtime.', '%s Hosts currently in downtime.',
$inDowntimeCount $inDowntimeCount
), ),
$inDowntimeCount '<b>' . $inDowntimeCount . '</b>'
) ?> <?= $this->qlink( ) ?> <?= $this->qlink(
$this->translate('List all'), $this->translate('List all'),
$inDowntimeLink, $inDowntimeLink,
@ -163,11 +205,11 @@
<p> <p>
<?= sprintf( <?= sprintf(
$this->translatePlural( $this->translatePlural(
'There is %u host comment.', 'There is %s host comment.',
'There are %u host comments.', 'There are %s host comments.',
$commentCount $commentCount
), ),
$commentCount '<b>' . $commentCount . '</b>'
) ?> ) ?>
<?= $this->qlink( <?= $this->qlink(

View File

@ -59,21 +59,24 @@ $hiddenRich = array();
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
<?php if (count($hidden)): ?>
<tr> <tr>
<td class="state"> <td class="state">
<div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>" <div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>"
title="<?= join(', ', $hidden) ?>"> title="<?= join(', ', $hidden) ?>">
<?php
<?= $this->qlink( echo $this->qlink(
sprintf($this->translate('%d more ...'), count($hidden)), count($hidden) ? sprintf(
$this->translate('%d more ...'),
count($hidden)
) : $this->translate('list all ...'),
$listAllLink, $listAllLink,
null null,
) ?> array('data-base-target' => '_next')
);
?>
</div> </div>
</td> </td>
</tr> </tr>
<?php endif ?>
</tbody> </tbody>
</table> </table>

View File

@ -60,21 +60,25 @@ use Icinga\Module\Monitoring\Object\Service;
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
<?php if (count($hidden)): ?>
<tr> <tr>
<td class="state"> <td class="state">
<div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>" <div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>"
title="<?= join(', ', $hidden) ?>"> title="<?= join(', ', $hidden) ?>">
<?= $this->qlink( <?php
sprintf($this->translate('%d more ...'), count($hidden)), echo $this->qlink(
count($hidden) ? sprintf(
$this->translate('%d more ...'),
count($hidden)
) : $this->translate('list all ...'),
$listAllLink, $listAllLink,
null null,
) ?> array('data-base-target' => '_next')
);
?>
</div> </div>
</td> </td>
</tr> </tr>
<?php endif ?>
</tbody> </tbody>
</table> </table>

View File

@ -7,11 +7,11 @@
<?= $this->render('list/components/servicesummary.phtml') ?> <?= $this->render('list/components/servicesummary.phtml') ?>
<br> <br>
<div class="hbox-item"> <div class="hbox-item">
<?= $this->translate('Service States:') ?> <?= $this->translate('Service states:') ?>
&nbsp;<?= $serviceStatesPieChart; ?> &nbsp;<?= $serviceStatesPieChart; ?>
</div> </div>
<div class="hbox-item"> <div class="hbox-item">
<?= $this->translate('Host States:') ?> <?= $this->translate('Host states:') ?>
&nbsp;<?= $hostStatesPieChart; ?> &nbsp;<?= $hostStatesPieChart; ?>
</div> </div>
@ -27,7 +27,11 @@
<?php if (($serviceCount = count($objects)) === 0): ?> <?php if (($serviceCount = count($objects)) === 0): ?>
<?= $this->translate('No services matching the filter'); ?> <?= $this->translate('No services matching the filter'); ?>
<?php else: ?> <?php else: ?>
<?= sprintf($this->translate('Issue commands to all %d selected services:'), count($objects)) ?> <?= sprintf($this->translatePlural(
'Issue commands to %s selected service:',
'Issue commands to all %s selected services:',
count($objects)
), '<b>' . count($objects) . '</b>') ?>
<p> <p>
<div> <div>
@ -71,21 +75,50 @@
</div> </div>
</p> </p>
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?> <?php
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
?>
<?php if ($problemCount || $unhandledCount): ?>
<div> <div>
<h3> <h3>
<?= $this->icon('attention-alt') ?> <?= $this->icon('attention-alt') ?>
<?= $this->translatePlural( <?= $this->translate('Problems') ?>
'Unhandled Problem',
'Unhandled Problems',
$unhandledCount
) ?>
</h3> </h3>
<?php if ($problemCount): ?>
<p>
<?= 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>'
); ?>
<div>
<?= $this->qlink(
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 if ($unhandledCount): ?>
<p><?= sprintf($this->translate('There are %s unhandled problems. ' . <p><?= sprintf($this->translate('There are %s unhandled problems. ' .
'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> <div>
<?= $this->qlink( <?= $this->qlink(
sprintf( sprintf(
@ -116,20 +149,21 @@
array('icon' => 'ok') array('icon' => 'ok')
); ?></div> ); ?></div>
</p> </p>
<?php endif ?>
</div> </div>
<?php endif ?> <?php endif; ?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?> <?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3> <h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
<p> <p>
<?= sprintf( <?= sprintf(
$this->translatePlural( $this->translatePlural(
'%u Acknowledged Service Problem.', '%s Acknowledged Service Problem.',
'%u Acknowledged Service Problems.', '%s Acknowledged Service Problems.',
$acknowledgedCount $acknowledgedCount
), ),
$acknowledgedCount '<b>' . $acknowledgedCount . '</b>'
); ?> <?= $removeAckForm ?> ); ?> <?= $removeAckForm ?>
</p> </p>
<?php endif ?> <?php endif ?>
@ -138,10 +172,10 @@
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0 /*&& $auth->hasPermission('monitoring/command/comment/delete')*/): ?> <?php if (($inDowntimeCount = count($objectsInDowntime)) > 0 /*&& $auth->hasPermission('monitoring/command/comment/delete')*/): ?>
<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( <p> <?= sprintf($this->translatePlural(
'%u service currently in downtime.', '%s service currently in downtime.',
'%u services currently in downtime.', '%s services currently in downtime.',
$inDowntimeCount $inDowntimeCount
), $inDowntimeCount) ?> ), '<b>' . $inDowntimeCount) . '</b>' ?>
<?= $this->qlink( <?= $this->qlink(
$this->translate('List all'), $this->translate('List all'),
@ -158,10 +192,10 @@
<h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3> <h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3>
<p><?= sprintf( <p><?= sprintf(
$this->translatePlural( $this->translatePlural(
'There is %d comment.', 'There is %s comment.',
'There are %d comments.', 'There are %s comments.',
$commentCount $commentCount
), $commentCount); ), '<b>' . $commentCount . '</b>');
?> ?>
<?= $this->qlink( <?= $this->qlink(
$this->translate('List all'), $this->translate('List all'),