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

View File

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

View File

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

View File

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