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(
$this->hostList
->objectsFilter()
->andFilter(FilterEqual::where('downtime_objecttype', 'host'))
->andFilter(FilterEqual::where('object_type', 'host'))
->toQueryString()
);
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');

View File

@ -2,218 +2,78 @@
<?php if (! $this->compact): ?>
<?= $tabs; ?>
<?php endif ?>
<?= $this->render('list/components/hostssummary.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 class="content multi-commands">
<h2>
<?= $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): ?>
<div class="content">
<?php if ($hostCount === 0): ?>
<?= $this->translate('No hosts found matching the filter'); ?>
<?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->translate('Reschedule next checks'),
$rescheduleAllLink,
$this->translate('Acknowledge'),
$acknowledgeLink,
null,
array('icon' => 'reschedule')
); ?>
array(
'icon' => 'ok',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?php endif; ?>
<br>
<?= $this->qlink(
$this->translate('Schedule downtimes'),
$downtimeAllLink,
null,
array('icon' => 'plug')
); ?>
<?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 ?>
<br>
<?= $this->qlink(
$this->translate('Submit passive check results'),
$processCheckResultAllLink,
null,
array('icon' => 'reply')
); ?>
<br>
<tr>
<th> <?= $this->translate('Comments') ?> </th>
<td>
<?= $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
array(
'icon' => 'comment',
'class' => 'action-link'
)
) ?>
</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
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 ?>
</td>
</tr>
<?php if (($commentCount = count($objects->getComments())) > 0): ?>
<h3> <?= $this->icon('comment', $this->translate('Comments'))?> <?=$this->translate('Comments') ?></h3>
<tr>
<th></th>
<td>
<?= $this->qlink(
sprintf(
$this->translatePlural(
@ -227,8 +87,114 @@
null,
array('data-base-target' => '_next')
); ?>
<?= $this->translate('on all selected hosts.') ?>
</td>
</tr>
<?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 ?>
</div>

View File

@ -1,219 +1,201 @@
<div class="controls">
<?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 ?>
<?= $this->render('list/components/servicesummary.phtml') ?>
<?= $this->render('partials/service/objects-header.phtml'); ?>
</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>
<tr>
<th> <?= $this->translate('Comments') ?> </th>
<td>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
array(
'icon' => 'comment',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?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>
<?php if (($commentCount = count($objects->getComments())) > 0): ?>
<tr>
<th></th>
<td>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %s problem service',
'Schedule downtimes for %s problem services',
$problemCount
'%s comment',
'%s comments',
$commentCount
),
$problemCount
$commentCount
),
$downtimeLink,
$commentsLink,
null,
array('icon' => 'plug')
); ?>
array('data-base-target' => '_next')
) ?>
</td>
</tr>
<?php endif ?>
<?php if ($unackCount > 0): ?>
<br>
<tr>
<th>
<?= $this->translate('Downtimes') ?>
</th>
<td>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unacknowledged problem service',
'Acknowledge %u unacknowledged problem services',
$unackCount
),
$unackCount
),
$acknowledgeLink,
$this->translate('Schedule downtimes'),
$downtimeAllLink,
null,
array('icon' => 'ok')
); ?>
<?php endif; ?>
array(
'icon' => 'plug',
'class' => 'action-link'
)
) ?>
</td>
</tr>
<?php if ($unhandledCount): ?>
<p>
<?= sprintf($this->translate('There are %s unhandled problem services. ' .
'Issue commands to the problematic services:'),
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
</p>
<?php if ($scheduledDowntimeCount > 0): ?>
<tr>
<th></th>
<td>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled problem service',
'Schedule a downtime for %u unhandled problem services',
$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',
'%d scheduled downtime',
'%d 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')
);?>
<?= sprintf($this->translate('are currently in downtime.')) ?>
<?php endif ?>
array(
'data-base-target' => '_next'
)
) ?>
</td>
</tr>
<?php endif ?>
<?php $commentCount = count($objects->getComments()) ?>
<?php if ($commentCount > 0): ?>
<h3> <?= $this->icon('comment') ?> <?= $this->translate('Comments') ?> </h3>
</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(
sprintf(
$this->translatePlural(
'%s comment.',
'%s comments.',
$commentCount
), $commentCount),
$commentsLink,
$this->translate('Send notifications'),
$sendCustomNotificationLink,
null,
array('data-base-target' => '_next')
); ?>
<?= $this->translate('on all selected services.') ?>
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 ?>
</div>