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

View File

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

View File

@ -5,27 +5,21 @@
action="<?= $form->getAction() ?>"
method="post"
>
<table class="avp">
<tr class="newsection"><th></th><td></td></tr>
<?php foreach($this->form->getElements() as $name => $element):
if ($element instanceof \Icinga\Web\Form\Element\TriStateCheckbox):
$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 class="avp newsection">
<?php foreach($this->form->getElements() as $name => $element):
if ($element instanceof \Icinga\Web\Form\Element\TriStateCheckbox):
$element->setDecorators(array('ViewHelper'));
?>
</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>

View File

@ -1,34 +1,65 @@
<?php for ($i = 0; $i < count($objects) && $i < 5; $i++) {
$object = $objects[$i]; ?>
<a data-base-target='_next' href="<?php
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>';
}
<?php
$objectCount = count($objects);
if (!$this->is_service) {
$link = 'monitoring/list/hosts';
$target = array(
'host' => $this->hostquery
$links = array();
for ($i = 0; $i < $objectCount && $i < 5; $i++) {
$object = $objects[$i];
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 {
$link = 'monitoring/list/services';
$target = array(
'host' => $this->hostquery,
'service' => $this->servicequery
$links[] = $this->qlink(
$object->host_name,
'monitoring/show/host',
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
/** @var Zend_View_Helper_CommandForm $cf */
$cf = $this->getHelper('CommandForm');
$servicequery = isset($this->servicequery) ? $this->servicequery : '';
$objectName = $this->is_service ? 'Services' : 'Hosts';
$cf = $this->getHelper('CommandForm');
$servicequery = isset($this->servicequery) ? $this->servicequery : '';
$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>
<th>
<?= count($objects) . ' ' . $objectName ?>
</th>
<td>
<a
href="<?=$this->href(
'monitoring/command/reschedulenextcheck',
array(
'host' => $this->target['host'],
'service' => array_key_exists('service', $this->target) ? $this->target['service'] : null,
'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 class="newsection">
<th><?= count($objects) . ' ' . $objectName ?></th>
<td>
<a href="<?=
$this->href('monitoring/command/reschedulenextcheck', $params) ?>"><?=
$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 class="newsection">
<th>
<?= $this->problems ?> Problems
</th>
<td>
<a
title="Schedule downtimes for all selected hosts"
href="<?= $this->href('monitoring/command/scheduledowntime', $this->target); ?>"
>
<?= $this->icon('in_downtime_petrol.png') ?> Schedule Downtimes
</a>
</td>
<td>
Handle <?= $this->problems ?> problems on <span> <?= count($this->objects) ?> </span> <?= $objectName ?>.
</td>
<th><?= $this->problems ?> Problems</th>
<td>
<a title="Schedule downtimes for all selected hosts" href="<?=
$this->href('monitoring/command/scheduledowntime', $this->target) ?>"><?=
$this->icon('in_downtime_petrol.png')
?> Schedule Downtimes</a>
</td>
<td><?= sprintf(
'Handle %d problems on %d %s.',
$this->problems,
count($this->objects),
$objectName
) ?></td>
</tr>
<tr>
<th>
<?= count($this->unhandled) ?> Unhandled
</th>
<td>
<a
title="Acknowledge all problems on the selected hosts or services"
href="<?= $this->href('monitoring/command/acknowledgeproblem', $this->target);?>"
>
<?= $this->icon('acknowledgement_petrol.png') ?> Acknowledge
</a> <br />
<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>
<th><?= count($this->unhandled) ?> Unhandled</th>
<td colspan="2">
<a title="Acknowledge all problems on the selected hosts or services" href="<?=
$this->href('monitoring/command/acknowledgeproblem', $this->target) ?>"><?=
$this->icon('acknowledgement_petrol.png')
?> Acknowledge</a><br />
<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>
</tr>

View File

@ -9,71 +9,49 @@ $this->target = array(
?>
<div class="controls">
<?= $this->tabs; ?>
<?= $this->tabs ?>
</div>
<div class="content">
<h1> Summary for <?= count($objects) ?> services </h1>
<h1> Summary for <?= count($objects) ?> services </h1>
<?= $this->render('multi/components/objectlist.phtml'); ?>
<table class="avp">
<tr>
<th align="center">
<h3><?= array_sum(array_values($service_states)) ?> Services</h3>
</th>
<th></th>
<th align="center">
<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>
<table style="width: 100%; font-size: 0.8em;">
<tr>
<th colspan="2"><?= array_sum(array_values($service_states)) ?> Services</th>
<th colspan="2"><?= array_sum(array_values($host_states)) ?> Hosts</th>
</tr>
<tr>
<td align="center"><?= $this->service_pie->render() ?></td>
<td><?php
<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">
<tbody>
<?= $this->render('multi/components/summary.phtml'); ?>
<?= $this->render('multi/components/comments.phtml'); ?>
<?= $this->render('multi/components/downtimes.phtml'); ?>
</tbody>
</table>
?></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>
</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>
<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>