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