monitoring: New layout for host and service multi views

refs #5543
This commit is contained in:
Matthias Jentsch 2015-09-30 13:58:02 +02:00
parent 52a53ec406
commit 5a6aa1c073
3 changed files with 351 additions and 403 deletions

View File

@ -149,7 +149,7 @@ class HostsController extends Controller
->setQueryString( ->setQueryString(
$this->hostList $this->hostList
->objectsFilter() ->objectsFilter()
->andFilter(FilterEqual::where('downtime_objecttype', 'host')) ->andFilter(FilterEqual::where('object_type', 'host'))
->toQueryString() ->toQueryString()
); );
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments'); $this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');

View File

@ -2,233 +2,199 @@
<?php if (! $this->compact): ?> <?php if (! $this->compact): ?>
<?= $tabs; ?> <?= $tabs; ?>
<?php endif ?> <?php endif ?>
<?= $this->render('list/components/hostssummary.phtml') ?> <?= $this->render('list/components/hostssummary.phtml') ?>
<?= $this->render('partials/host/objects-header.phtml'); ?> <?= $this->render('partials/host/objects-header.phtml'); ?>
<?php
$hostCount = count($objects);
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
$unackCount = count($unacknowledgedObjects);
$scheduledDowntimeCount = count($objects->getScheduledDowntimes());
?>
</div> </div>
<div class="content multi-commands"> <div class="content">
<h2> <?php if ($hostCount === 0): ?>
<?= $this->icon('reschedule') ?>
<?= $this->translate('Commands') ?>
</h2>
<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'); ?> <?= $this->translate('No hosts found matching the filter'); ?>
<?php else: ?> <?php else: ?>
<?= $checkNowForm; ?> <h2><?= $this->translate('Problem Handling') ?></h2>
<table class="name-value-table">
<tbody>
<?php
<br> if ($unackCount > 0): ?>
<?= $this->qlink( <tr>
$this->translate('Reschedule next checks'), <th> <?= sprintf($this->translate('%d unhandled problems'), $unackCount) ?> </th>
$rescheduleAllLink, <td>
null, <?= $this->qlink(
array('icon' => 'reschedule') $this->translate('Acknowledge'),
); ?> $acknowledgeLink,
null,
<br> array(
<?= $this->qlink( 'icon' => 'ok',
$this->translate('Schedule downtimes'), 'class' => 'action-link'
$downtimeAllLink, )
null, ) ?>
array('icon' => 'plug') </td>
); ?> </tr>
<br>
<?= $this->qlink(
$this->translate('Submit passive check results'),
$processCheckResultAllLink,
null,
array('icon' => 'reply')
); ?>
<br>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
<br>
<?= $this->qlink(
sprintf($this->translate('Send a custom notification for all %u hosts'), $hostCount),
$sendCustomNotificationLink,
null,
array('icon' => 'comment')
); ?>
<?php endif; ?>
<?php
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
$unackCount = count($unacknowledgedObjects);
?>
<?php if ($problemCount || $unhandledCount || $unackCount): ?>
<h3>
<?= $this->icon('attention-alt') ?>
<?= $this->translatePlural(
'Problem',
'Problems',
$unhandledCount + $problemCount
) ?>
</h3>
<?php if ($problemCount): ?>
<p>
<?= sprintf(
$this->translatePlural(
'There is %s problem.',
'There are %s problems.',
$problemCount
),
'<b>' . $problemCount . '</b>'
); ?>
</p>
<?= $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')
); ?>
<?php endif; ?> <?php endif; ?>
<?php <?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
if ($unackCount > 0): ?> <tr>
<br> <th> <?= sprintf(
$this->translatePlural(
'%s acknowledgedment',
'%s acknowledgedments',
$acknowledgedCount
),
'<b>' . $acknowledgedCount . '</b>'
); ?> </th>
<td>
<?= $removeAckForm ?>
</td>
</tr>
<?php endif ?>
<tr>
<th> <?= $this->translate('Comments') ?> </th>
<td>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array(
'icon' => 'comment',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?php if (($commentCount = count($objects->getComments())) > 0): ?>
<tr>
<th></th>
<td>
<?= $this->qlink( <?= $this->qlink(
sprintf( sprintf(
$this->translatePlural( $this->translatePlural(
'Acknowledge %u unacknowledged problem hosts', '%s comment',
'Acknowledge %u unacknowledged problem hosts', '%s comments',
$unackCount $commentCount
), ),
$unackCount $commentCount
), ),
$acknowledgeLink, $commentsLink,
null, null,
array('icon' => 'ok') array('data-base-target' => '_next')
); ?> ); ?>
<?php endif; ?> </td>
</tr>
<?php endif ?>
<?php if ($unhandledCount): ?> <tr>
<p> <th>
<?= sprintf( <?= $this->translate('Downtimes') ?>
$this->translatePlural( </th>
'There is %s unhandled problem host, issue commands to the problematic host:', <td>
'There are %s unhandled problem hosts, issue commands to the problematic hosts:', <?= $this->qlink(
$unhandledCount $this->translate('Schedule downtimes'),
), $downtimeAllLink,
'<span class="badge badge-critical">' . $unhandledCount . '</span>' null,
); ?> array(
</p> 'icon' => 'plug',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?= $this->qlink( <?php if ($scheduledDowntimeCount > 0): ?>
sprintf( <tr>
$this->translatePlural( <th></th>
'Schedule a downtime for %u unhandled problem host', <td>
'Schedule a downtime for %u unhandled problem hosts', <?= $this->qlink(
$unhandledCount sprintf(
), $this->translatePlural(
$unhandledCount '%d scheduled downtime',
), '%d scheduled downtimes',
$downtimeUnhandledLink, $scheduledDowntimeCount
null, ),
array('icon' => 'plug') $scheduledDowntimeCount
); ?> ),
$showDowntimesLink,
null,
array(
'data-base-target' => '_next'
)
) ?>
</td>
</tr>
<?php endif ?>
</tbody>
</table>
<?php endif; ?> <?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
<?php endif;?> <h2> <?= $this->translate('Notifications') ?> </h2>
<table class="name-value-table">
<tbody>
<tr>
<th> <?= $this->translate('Notifications') ?> </th>
<td>
<?= $this->qlink(
$this->translate('Send notifications'),
$sendCustomNotificationLink,
null,
array(
'icon' => 'bell-alt',
'class' => 'action-link'
)
) ?>
</td>
</tr>
</tbody>
</table>
<?php endif ?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?> <h2> <?= $this->translate('Check Execution') ?> </h2>
<div>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
<?= sprintf( <table class="name-value-table">
$this->translatePlural( <tbody>
'%s Acknowledged Host Problem', <tr>
'%s Acknowledged Host Problems', <th> <?= $this->translate('Command') ?> </th>
$acknowledgedCount <td>
), <?= $this->qlink(
'<b>' . $acknowledgedCount . '</b>' $this->translate('Process check result'),
); ?> $processCheckResultAllLink,
null,
array(
'icon' => 'reply',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?= $removeAckForm ?> <tr>
</div> <th> <?= $this->translate('Schedule Check') ?> </th>
<?php endif ?> <td> <?= $checkNowForm ?> </td>
</tr>
<?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?> <tr>
<th></th>
<?php if ($scheduledDowntimeCount): ?> <td>
<h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3> <?= $this->qlink(
<?= $this->qlink( $this->translate('Reschedule'),
sprintf( $rescheduleAllLink,
$this->translatePlural( null,
'%s scheduled downtime', array(
'%s scheduled downtimes', 'icon' => 'reschedule',
$scheduledDowntimeCount 'class' => 'action-link'
), )
$scheduledDowntimeCount ) ?>
), </td>
$showDowntimesLink, </tr>
null, </tbody>
array('data-base-target' => '_next') </table>
);?>
<?= 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
),
$inDowntimeLink,
null,
array('data-base-target' => '_next')
); ?>
<?= $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>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'%s comment',
'%s comments',
$commentCount
),
$commentCount
),
$commentsLink,
null,
array('data-base-target' => '_next')
); ?>
<?= $this->translate('on all selected hosts.') ?>
<?php endif ?>
<?php endif ?> <?php endif ?>
</div> </div>

View File

@ -1,219 +1,201 @@
<div class="controls"> <div class="controls">
<?php if (! $this->compact): ?> <?php if (! $this->compact): ?>
<?= $tabs; ?> <?= $tabs ?>
<?php endif ?> <?php endif ?>
<?= $this->render('list/components/servicesummary.phtml') ?> <?= $this->render('list/components/servicesummary.phtml') ?>
<?= $this->render('partials/service/objects-header.phtml'); ?> <?= $this->render('partials/service/objects-header.phtml') ?>
<?php
$serviceCount = count($objects);
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
$unackCount = count($unacknowledgedObjects);
$scheduledDowntimeCount = count($objects->getScheduledDowntimes());
?>
</div> </div>
<div class="content multi-commands">
<h3>
<?= $this->icon('reschedule') ?>
<?= $this->translate('Commands') ?>
</h3>
<?php if (($serviceCount = count($objects)) === 0): ?> <div class="content">
<?= $this->translate('No services found matching the filter'); ?>
<?php if ($serviceCount === 0): ?>
<?= $this->translate('No services found matching the filter') ?>
<?php else: ?> <?php else: ?>
<p> <h2> <?= $this->translate('Problem handling') ?> </h2>
<?= sprintf($this->translatePlural( <table class="name-value-table">
'Issue commands to %s selected service:', <tbody>
'Issue commands to all %s selected services:',
count($objects)
), '<b>' . count($objects) . '</b>') ?>
</p>
<?= $checkNowForm; ?>
<br>
<?= $this->qlink(
$this->translate('Reschedule next checks'),
$rescheduleAllLink,
null,
array('icon' => 'reschedule')
); ?>
<br>
<?= $this->qlink(
$this->translate('Schedule downtimes'),
$downtimeAllLink,
null,
array('icon' => 'plug')
); ?>
<br>
<?= $this->qlink(
$this->translate('Submit passive check results'),
$processCheckResultAllLink,
null,
array('icon' => 'reply')
); ?>
<br>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
<br>
<?= $this->qlink(
sprintf($this->translate('Send a custom notification for all %u services'), $serviceCount),
$sendCustomNotificationLink,
null,
array('icon' => 'comment')
); ?>
<?php endif; ?>
<?php
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
$unackCount = count($unacknowledgedObjects);
?>
<?php if ($problemCount || $unhandledCount || $unackCount): ?>
<div>
<h3>
<?= $this->icon('attention-alt') ?>
<?= $this->translate('Problems') ?>
</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>'
); ?>
</p>
<?= $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')
); ?>
<?php endif ?>
<?php if ($unackCount > 0): ?> <?php if ($unackCount > 0): ?>
<br> <tr>
<?= $this->qlink( <th> <?= sprintf($this->translate('%d unhandled problems'), $unackCount) ?> </th>
sprintf( <td> <?= $this->qlink(
$this->translatePlural( $this->translate('Acknowledge'),
'Acknowledge %u unacknowledged problem service', $acknowledgeLink,
'Acknowledge %u unacknowledged problem services', null,
$unackCount array(
), 'icon' => 'ok',
$unackCount 'class' => 'action-link'
), )
$acknowledgeLink, ) ?> </td>
null, </tr>
array('icon' => 'ok')
); ?>
<?php endif; ?> <?php endif; ?>
<?php if ($unhandledCount): ?> <?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<p> <tr>
<?= sprintf($this->translate('There are %s unhandled problem services. ' . <th> <?= sprintf(
'Issue commands to the problematic services:'), $this->translatePlural(
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?> '%s acknowledgedment',
'%s acknowledgedments',
</p> $acknowledgedCount
<?= $this->qlink( ),
sprintf( '<b>' . $acknowledgedCount . '</b>'
$this->translatePlural( ) ?>
'Schedule a downtime for %u unhandled problem service', </th>
'Schedule a downtime for %u unhandled problem services', <td>
$unhandledCount <?= $removeAckForm ?>
), </td>
$unhandledCount </tr>
),
$downtimeUnhandledLink,
null,
array('icon' => 'plug')
); ?>
<?php endif ?> <?php endif ?>
</div> <tr>
<?php endif; ?> <th> <?= $this->translate('Comments') ?> </th>
<td>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array(
'icon' => 'comment',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?> <?php if (($commentCount = count($objects->getComments())) > 0): ?>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3> <tr>
<p> <th></th>
<?= sprintf( <td>
$this->translatePlural( <?= $this->qlink(
'%s Acknowledged Service Problem.', sprintf(
'%s Acknowledged Service Problems.', $this->translatePlural(
$acknowledgedCount '%s comment',
), '%s comments',
'<b>' . $acknowledgedCount . '</b>' $commentCount
); ?> <?= $removeAckForm ?> ),
</p> $commentCount
<?php endif ?> ),
$commentsLink,
null,
array('data-base-target' => '_next')
) ?>
</td>
</tr>
<?php endif ?>
<?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?> <tr>
<th>
<?= $this->translate('Downtimes') ?>
</th>
<td>
<?= $this->qlink(
$this->translate('Schedule downtimes'),
$downtimeAllLink,
null,
array(
'icon' => 'plug',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?php if ($scheduledDowntimeCount): ?> <?php if ($scheduledDowntimeCount > 0): ?>
<h3><?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?></h3> <tr>
<?= $this->qlink( <th></th>
sprintf( <td>
$this->translatePlural( <?= $this->qlink(
'%s scheduled downtime', sprintf(
'%s scheduled downtimes', $this->translatePlural(
$scheduledDowntimeCount '%d scheduled downtime',
), '%d scheduled downtimes',
$scheduledDowntimeCount $scheduledDowntimeCount
), ),
$showDowntimesLink, $scheduledDowntimeCount
null, ),
array('data-base-target' => '_next') $showDowntimesLink,
);?> null,
<?= sprintf($this->translate('on all selected services.')) ?> array(
'data-base-target' => '_next'
)
) ?>
</td>
</tr>
<?php endif ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?> </tbody>
<br> </table>
<?= $this->qlink(
sprintf($this->translatePlural( <?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
'%s service',
'%s services', <h2> <?= $this->translate('Notifications') ?> </h2>
$inDowntimeCount
), $inDowntimeCount), <table class="name-value-table">
$inDowntimeLink, <tbody>
null, <tr>
array('data-base-target' => '_next') <th> <?= $this->translate('Notifications') ?> </th>
);?> <td>
<?= sprintf($this->translate('are currently in downtime.')) ?> <?= $this->qlink(
$this->translate('Send notifications'),
$sendCustomNotificationLink,
null,
array(
'icon' => 'bell-alt',
'class' => 'action-link'
)
) ?>
</td>
</tr>
</tbody>
</table>
<?php endif ?> <?php endif ?>
<?php endif ?>
<?php $commentCount = count($objects->getComments()) ?> <h2> <?= $this->translate('Check Execution') ?> </h2>
<?php if ($commentCount > 0): ?>
<h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3> <table class="name-value-table">
<?= $this->qlink( <tbody>
sprintf( <tr>
$this->translatePlural( <th> <?= $this->translate('Command') ?> </th>
'%s comment.', <td>
'%s comments.', <?= $this->qlink(
$commentCount $this->translate('Process check result'),
), $commentCount), $processCheckResultAllLink,
$commentsLink, null,
null, array(
array('data-base-target' => '_next') 'icon' => 'reply',
); ?> 'class' => 'action-link'
<?= $this->translate('on all selected services.') ?> )
) ?>
</td>
</tr>
<tr>
<th> <?= $this->translate('Schedule Check') ?> </th>
<td> <?= $checkNowForm ?> </td>
</tr>
<tr>
<th></th>
<td>
<?= $this->qlink(
$this->translate('Reschedule'),
$rescheduleAllLink,
null,
array(
'icon' => 'reschedule',
'class' => 'action-link'
)
) ?>
</td>
</tr>
</tbody>
</table>
<?php endif ?> <?php endif ?>
<?php endif ?>
</div> </div>