monitoring/multi: view script cleanup

They now play fine with new filters, tried to improve usability
This commit is contained in:
Thomas Gelf 2014-06-20 13:46:09 +02:00
parent 76219b025b
commit f4b7075293
6 changed files with 202 additions and 226 deletions

View File

@ -1,33 +1,25 @@
<?php <?php
$objectName = $this->is_service ? 'Services' : 'Hosts';
?>
<tr class="newsection"> $objectName = $this->is_service ? 'Services' : 'Hosts';
<th>
<?= count($comments) ?> Comments ?><tr class="newsection" data-base-target="_next">
</th> <th><a href=<?= count($comments) ?> <?= $this->translate('Comments') ?></th>
<td> <td>
<a <a href="<?= $this->href('monitoring/command/removecomment', $this->target) ?>"><?=
href="<?= $this->href('monitoring/command/removecomment', $this->target); ?>" $this->icon('remove_petrol.png')
> ?> <?= $this->translate('Remove Comments') ?></a><br />
<?= $this->icon('remove_petrol.png') ?> Remove Comments <a href="<?= $this->href('monitoring/command/delaynotifications', $this->target); ?>"><?=
</a> <br > $this->icon('notification_disabled_petrol.png')
<a ?> <?= $this->translate('Delay Notifications') ?></a><br />
href="<?= $this->href('monitoring/command/delaynotifications', $this->target); ?>" <a title="<?= $this->translate('Acknowledge all problems on the selected hosts or services') ?>"
> href="<?= $this->href('monitoring/command/acknowledgeproblem') ?>, $this->target); ?>">
<?= $this->icon('notification_disabled_petrol.png') ?> Delay Notifications <?= $this->icon('acknowledgement_petrol.png') ?> Acknowledge
</a> <br > </a>
<a </td>
title="Acknowledge all problems on the selected hosts or services" <td><a href=" <?= $this->href(
href="<?= $this->href('monitoring/command/acknowledgeproblem', $this->target); ?>" 'monitoring/list/comments',
> array('comment_internal_id' => '(' . implode('|', $this->comments) . ')')
<?= $this->icon('acknowledgement_petrol.png') ?> Acknowledge );
</a> ?>"> <?= count($comments) ?> comments </a>.
</td> </td>
<td>Change <a data-base-target='_next' href=" <?= $this->href(
'monitoring/list/comments',
array('comment_internal_id' => implode(',', $this->comments))
);
?>"> <?= count($comments) ?> comments </a>.
</td>
</tr> </tr>

View File

@ -1,25 +1,19 @@
<?php <?php
$objectName = $this->is_service ? 'Services' : 'Hosts';
?>
$objectName = $this->is_service ? 'Services' : 'Hosts';
?>
<tr class="newsection"> <tr class="newsection">
<th> <th><?= count($downtimes) ?> Downtimes</th>
<?= count($downtimes) ?> Downtimes <td>
</th> <a href="<?=$this->href('monitoring/command/removedowntime', $this->target); ?>"><?=
<td> $this->icon('remove_petrol.png') ?>Remove Downtimes</a><br />
<a href="<?=$this->href('monitoring/command/removedowntime', $this->target); ?>"> <a title="Schedule downtimes for all selected <?= $objectName ?>" href="<?=
<?= $this->icon('remove_petrol.png') ?> Remove Downtimes $this->href('monitoring/command/scheduledowntime', $this->target) ?>"><?=
</a> <br /> $this->icon('in_downtime_petrol.png')
<a ?> Schedule Downtimes</a>
title="Schedule downtimes for all selected <?= $objectName ?>" </td>
href="<?= $this->href('monitoring/command/scheduledowntime', $this->target); ?>" <td>
> Change <a data-base-target='_next' href="<?= $this->href('') ?>"> <?= count($downtimes) ?> downtimes</a>.
<?= $this->icon('in_downtime_petrol.png') ?> Schedule Downtimes </td>
</a>
</td>
<td>
Change <a data-base-target='_next' href="<?= $this->href('') ?>"
> <?= count($downtimes) ?> downtimes
</a>.
</td>
</tr> </tr>

View File

@ -5,27 +5,21 @@
action="<?= $form->getAction() ?>" action="<?= $form->getAction() ?>"
method="post" method="post"
> >
<table class="avp"> <table class="avp newsection">
<tr class="newsection"><th></th><td></td></tr> <?php foreach($this->form->getElements() as $name => $element):
<?php foreach($this->form->getElements() as $name => $element): if ($element instanceof \Icinga\Web\Form\Element\TriStateCheckbox):
if ($element instanceof \Icinga\Web\Form\Element\TriStateCheckbox): $element->setDecorators(array('ViewHelper'));
$element->setDecorators(array('ViewHelper'));
?>
<tr>
<th>
<label for="<?= $element->getName() ?>"> <?= $element->getLabel() ?> </label>
</th>
<td>
<?= $element->render() ?>
</td>
</tr>
<?php else: ?>
<tr>
<td> <?= $element->render() ?></td>
</tr>
<?php
endif;
endforeach;
?> ?>
</table> <tr>
<th><label for="<?= $element->getName() ?>"> <?= $element->getLabel() ?> </label></th>
<td><?= $element->render() ?></td>
</tr>
<?php else: ?>
<tr>
<th></th>
<td><?= $element->render() ?></td>
</tr>
<?php endif ?>
<?php endforeach ?>
</table>
</form> </form>

View File

@ -1,34 +1,65 @@
<?php for ($i = 0; $i < count($objects) && $i < 5; $i++) { <?php
$object = $objects[$i]; ?>
<a data-base-target='_next' href="<?php $objectCount = count($objects);
if ($this->is_service) {
echo $this->href(
'monitoring/show/service',
array('host' => $object->host_name, 'service' => $object->service_description)
);
echo '">' . $object->host_name . ' ' . $object->service_description . '</a>';
} else {
echo $this->href(
'monitoring/show/host',
array('host' => $object->host_name)
);
echo '">' . $object->host_name . '</a>';
}?>,
<?php } ?> <?php
if (count($objects) > 5) {
echo '<i> ... ' . (count($objects) - 5) . ' more ... </i>';
}
if (!$this->is_service) { $links = array();
$link = 'monitoring/list/hosts'; for ($i = 0; $i < $objectCount && $i < 5; $i++) {
$target = array( $object = $objects[$i];
'host' => $this->hostquery
if ($this->is_service) {
$links[] = $this->qlink(
$object->host_name . ' ' . $object->service_description,
'monitoring/show/service',
array(
'host' => $object->host_name,
'service' => $object->service_description
)
); );
} else { } else {
$link = 'monitoring/list/services'; $links[] = $this->qlink(
$target = array( $object->host_name,
'host' => $this->hostquery, 'monitoring/show/host',
'service' => $this->servicequery array(
'host' => $object->host_name
)
); );
} }
?> <a data-base-target='_next' href='<?= $this->href($link, $this->query); ?>'><b> list all </b></a> }
if ($this->is_service) {
$objectName = $this->translate('Services');
$link = 'monitoring/list/services';
$target = array(
'host' => $this->hostquery,
'service' => $this->servicequery
);
} else {
$objectName = $this->translate('Hosts');
$link = 'monitoring/list/hosts';
$target = array(
'host' => $this->hostquery
);
}
$more = clone $this->url;
?><tr class="newsection" data-base-target="_next">
<th><?= $this->qlink(
$this->translate('List all'),
$more->setPath($link),
null,
array('title' => $this->translate('List all selected objects'))
) ?></th>
<td colspan="3">
<?php
echo implode(', ', $links);
if ($objectCount > 5) {
echo ' ' . sprintf($this->translate('and %d more'), count($objects) - 5);
}
?>
</td>
</tr>

View File

@ -1,72 +1,59 @@
<?php <?php
/** @var Zend_View_Helper_CommandForm $cf */
$cf = $this->getHelper('CommandForm'); $cf = $this->getHelper('CommandForm');
$servicequery = isset($this->servicequery) ? $this->servicequery : ''; $servicequery = isset($this->servicequery) ? $this->servicequery : '';
$objectName = $this->is_service ? 'Services' : 'Hosts'; $objectName = $this->is_service ? $this->translate('Services') : $this->translate('Hosts');
$params = array(
'host' => $this->target['host'],
'service' => null,
'checktime' => time(),
'forcecheck' => '1'
);
if (array_key_exists('service', $this->target)) {
$params['service'] = $this->target['service'];
} else {
unset($params['service']);
}
?> ?>
<tr class="newsection">
<tr> <th><?= count($objects) . ' ' . $objectName ?></th>
<th> <td>
<?= count($objects) . ' ' . $objectName ?> <a href="<?=
</th> $this->href('monitoring/command/reschedulenextcheck', $params) ?>"><?=
<td> $this->icon('refresh_petrol.png')
<a ?> Recheck</a><br />
href="<?=$this->href( <a href="<?= $this->href('monitoring/command/reschedulenextcheck', $this->target) ?>"><?=
'monitoring/command/reschedulenextcheck', $this->icon('reschedule_petrol.png')
array( ?> Reschedule</a><br />
'host' => $this->target['host'], </td>
'service' => array_key_exists('service', $this->target) ? $this->target['service'] : null, <td>Perform actions on <?= count($objects) . ' ' . $objectName ?>.</td>
'checktime' => time(),
'forcecheck' => '1'
)
); ?>"
>
<?= $this->icon('refresh_petrol.png') ?> Recheck
</a> <br/>
<a href="<?= $this->href('monitoring/command/reschedulenextcheck', $this->target) ?>">
<?= $this->icon('reschedule_petrol.png') ?> Reschedule
</a> <br />
</td>
<td>
Perform actions on <?= count($objects) . ' ' . $objectName ?>.
</td>
</tr> </tr>
<tr class="newsection"> <tr class="newsection">
<th> <th><?= $this->problems ?> Problems</th>
<?= $this->problems ?> Problems <td>
</th> <a title="Schedule downtimes for all selected hosts" href="<?=
<td> $this->href('monitoring/command/scheduledowntime', $this->target) ?>"><?=
<a $this->icon('in_downtime_petrol.png')
title="Schedule downtimes for all selected hosts" ?> Schedule Downtimes</a>
href="<?= $this->href('monitoring/command/scheduledowntime', $this->target); ?>" </td>
> <td><?= sprintf(
<?= $this->icon('in_downtime_petrol.png') ?> Schedule Downtimes 'Handle %d problems on %d %s.',
</a> $this->problems,
</td> count($this->objects),
<td> $objectName
Handle <?= $this->problems ?> problems on <span> <?= count($this->objects) ?> </span> <?= $objectName ?>. ) ?></td>
</td>
</tr> </tr>
<tr> <tr>
<th> <th><?= count($this->unhandled) ?> Unhandled</th>
<?= count($this->unhandled) ?> Unhandled <td colspan="2">
</th> <a title="Acknowledge all problems on the selected hosts or services" href="<?=
<td> $this->href('monitoring/command/acknowledgeproblem', $this->target) ?>"><?=
<a $this->icon('acknowledgement_petrol.png')
title="Acknowledge all problems on the selected hosts or services" ?> Acknowledge</a><br />
href="<?= $this->href('monitoring/command/acknowledgeproblem', $this->target);?>" <a title="Remove all acknowledgements from all selected hosts or services" href="<?=
> $this->href('monitoring/command/removeacknowledgement', $target) ?>"><?=
<?= $this->icon('acknowledgement_petrol.png') ?> Acknowledge $this->icon('remove_petrol.png') ?> Remove Acknowledgements</a>
</a> <br /> </td>
<a
title="Remove all acknowledgements from all selected hosts or services"
href="<?=$this->href('monitoring/command/removeacknowledgement', $target);?>"
>
<?= $this->icon('remove_petrol.png') ?> Remove Acknowledgements
</a>
</td>
<td>
</td>
</tr> </tr>

View File

@ -9,71 +9,49 @@ $this->target = array(
?> ?>
<div class="controls"> <div class="controls">
<?= $this->tabs; ?> <?= $this->tabs ?>
</div> </div>
<div class="content"> <div class="content">
<h1> Summary for <?= count($objects) ?> services </h1> <h1> Summary for <?= count($objects) ?> services </h1>
<?= $this->render('multi/components/objectlist.phtml'); ?> <table style="width: 100%; font-size: 0.8em;">
<table class="avp"> <tr>
<tr> <th colspan="2"><?= array_sum(array_values($service_states)) ?> Services</th>
<th align="center"> <th colspan="2"><?= array_sum(array_values($host_states)) ?> Hosts</th>
<h3><?= array_sum(array_values($service_states)) ?> Services</h3> </tr>
</th> <tr>
<th></th> <td align="center"><?= $this->service_pie->render() ?></td>
<th align="center"> <td><?php
<h3><?= array_sum(array_values($host_states)) ?> Hosts</h3>
</th>
<th></th>
</tr>
<tr>
<td align="center">
<?= $this->service_pie->render(); ?>
</td>
<td>
<?php
foreach ($service_states as $state => $count) {
if ($count > 0) {
echo ucfirst($state) . ': ' . $count . '<br />';
}
}
?>
</td>
<td align="center">
<?= $this->host_pie->render(); ?>
</td>
<td>
<?php
foreach ($host_states as $state => $count) {
if ($count > 0) {
echo ucfirst($state) . ': ' . $count . '<br />';
}
}
?>
</td>
<td></td>
</tr>
</table>
<h2> <?=$this->icon('servicegroup.png')?> Service Actions </h2> foreach ($service_states as $state => $count) {
if ($count > 0) {
echo ucfirst($state) . ': ' . $count . '<br />';
}
}
<table class="avp newsection"> ?></td>
<tbody> <td align="center"><?= $this->host_pie->render() ?></td>
<?= $this->render('multi/components/summary.phtml'); ?> <td><?php
<?= $this->render('multi/components/comments.phtml'); ?> foreach ($host_states as $state => $count) {
<?= $this->render('multi/components/downtimes.phtml'); ?> if ($count > 0) {
</tbody> echo ucfirst($state) . ': ' . $count . '<br />';
</table> }
}
?></td>
</tr>
</table>
<?= $this->render('multi/components/flags.phtml') ?> <h2><?=$this->icon('servicegroup.png')?> Service Actions</h2>
<table class="avp newsection">
<tbody>
<?= $this->render('multi/components/objectlist.phtml') ?>
<?= $this->render('multi/components/summary.phtml') ?>
<?= $this->render('multi/components/comments.phtml') ?>
<?= $this->render('multi/components/downtimes.phtml') ?>
</tbody>
</table>
<?= $this->render('multi/components/flags.phtml') ?>
</div> </div>
<a
rel="tooltip"
title="Submit passive checkresults"
href="<?= $this->href('monitoring/command/submitpassivecheckresult', $this->target); ?>"
class="button btn-cta btn-common btn-small"
>
<i class="icinga-icon-submit"></i>
</a>