List view script adjustments

This commit is contained in:
Thomas Gelf 2014-02-21 10:50:39 +00:00
parent 1634fcd662
commit 20b7b4bbf7
5 changed files with 289 additions and 352 deletions

View File

@ -1,43 +1,21 @@
<?php <?php
$dateHelper = $this->getHelper('DateFormat'); $dateHelper = $this->getHelper('DateFormat');
$commandHelper = $this->getHelper('CommandForm');
$viewHelper = $this->getHelper('MonitoringState');
/** @var Zend_View_Helper_CommandForm $commandHelper */
$commandHelper = $this->getHelper('CommandForm');
$viewHelper = $this->getHelper('MonitoringState');
?> ?>
<div class="controls">
<div class="row"> <?= $this->tabs ?>
<div class="pull-left"> <?= $this->sortControl->render($this); ?>
<h1>Comments</h1> <?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="pull-right">
<?= $this->tabs->render($this); ?>
</div>
</div> </div>
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single">
<div class="container pull-left"> <div class="content">
<table class="action">
<tbody>
<?php foreach ($comments as $comment):
<div class="row">
<div class="col-md-12">
<?= $this->sortControl->render($this); ?>
</div>
</div>
<div class="row">
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="row">
<?= $this->selectionToolbar('single'); ?>
</div>
</div>
<table class="table table-condensed pull-left">
<tbody>
<?php foreach ($comments as $comment): ?>
<?php
$objectType = ($comment->comment_objecttype_id === '1') ? 'host' : 'service'; $objectType = ($comment->comment_objecttype_id === '1') ? 'host' : 'service';
$objectName = ($objectType === 'host') ? $comment->host_name : $comment->service_name; $objectName = ($objectType === 'host') ? $comment->host_name : $comment->service_name;
$hrefParameters = array( $hrefParameters = array(
@ -60,7 +38,7 @@
) )
); );
?> ?>
<tr> <tr>
<td> <td>
<?= date('d.m. H:i', $comment->comment_timestamp); ?> <?= date('d.m. H:i', $comment->comment_timestamp); ?>
</td> </td>
@ -142,7 +120,7 @@
} }
echo $commandHelper->iconSubmitForm( echo $commandHelper->iconSubmitForm(
'icinga-icon-remove', 'img/icons/remove.png',
'Remove comment', 'Remove comment',
'btn-small', 'btn-small',
'removecomment', 'removecomment',
@ -152,11 +130,8 @@
</td> </td>
</div> </div>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<div class="container pull-left">
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div> </div>

View File

@ -1,38 +1,15 @@
<?php <?php
$commandHelper = $this->getHelper('CommandForm'); $helper = $this->getHelper('CommandForm');
?> ?>
<div class="row"> <div class="controls">
<div class="pull-left"> <?= $this->tabs ?>
<h1>Downtimes</h1> <?= $this->sortControl->render($this); ?>
</div> <?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
<div class="pull-right">
<?= $this->tabs->render($this); ?>
</div>
</div> </div>
<table class="action">
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single"> <tbody>
<?php foreach ($downtimes as $downtime): ?>
<div class="container pull-left"> <tr>
<div class="row">
<div class="col-md-12">
<?= $this->sortControl->render($this); ?>
</div>
</div>
<div class="row">
<?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="row">
<?= $this->selectionToolbar('single'); ?>
</div>
</div>
<?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
<table class="table table-condensed">
<tbody>
<?php foreach ($downtimes as $downtime): ?>
<tr>
<td> <td>
<?= $this->dateFormat()->formatDateTime((int) $downtime->downtime_start); ?> - <?= $this->dateFormat()->formatDateTime((int) $downtime->downtime_start); ?> -
<?= $this->dateFormat()->formatDateTime((int) $downtime->downtime_end); ?> <?= $this->dateFormat()->formatDateTime((int) $downtime->downtime_end); ?>
@ -67,8 +44,8 @@ $commandHelper = $this->getHelper('CommandForm');
if (isset($downtime->service)) { if (isset($downtime->service)) {
$data['service'] = $downtime->service; $data['service'] = $downtime->service;
} }
echo $commandHelper->iconSubmitForm( echo $helper->iconSubmitForm(
'icinga-icon-remove', 'img/icons/remove.png',
'Remove Downtime', 'Remove Downtime',
'btn-small', 'btn-small',
'removedowntime', 'removedowntime',
@ -76,12 +53,7 @@ $commandHelper = $this->getHelper('CommandForm');
); );
?> ?>
</td> </td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<div class="container pull-left">
<?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
</div>
</div>

View File

@ -1,29 +1,22 @@
<div class="controls"> <div class="controls">
<?= $this->tabs ?> <?= $this->tabs ?>
<?= $this->paginationControl($hostgroups, null, null, array('preserve' => $this->preserve)); ?>
<table class="action wide">
<thead>
<tr>
<th style="width: 40%; padding-left: 1em;">Hosts</th>
<th style="width: 60%; padding-left: 1em;">Services</th>
</tr>
</thead>
</table>
</div> </div>
<div class="content">
<table class="action wide"> <div class="summary" data-base-target="col2">
<tbody>
<?php foreach($hostgroups as $h): ?> <?php foreach($hostgroups as $h): ?>
<tr> <span class="state">
<td style="width: 40%" class="summary">
<a href="<?= $this->href( <table><tr><td>
<strong><a href="<?= $this->href(
'monitoring/list/services', 'monitoring/list/services',
array('hostgroup' => $h->hostgroup)) array('hostgroup' => $h->hostgroup))
?>"><?= $h->hostgroup; ?></a> ?>"><?= $h->hostgroup; ?></a></strong>
<?php if ($h->hosts_up): ?> <?php if ($h->hosts_up): ?>
<!-- Hosts UP --> <!-- Hosts UP -->
<span class="state up"> <span class="state up">
<a href="<?= $this->href( <a href="<?= $this->href(
'monitoring/list/hosts', 'monitoring/list/hosts',
array('host_state' => 0, 'hostgroup' => $h->hostgroup) array('host_state' => 0, 'hostgroup' => $h->hostgroup)
@ -75,8 +68,9 @@
</span> </span>
<!-- End of hosts PENDING --> <!-- End of hosts PENDING -->
<?php endif ?> <?php endif ?>
</td>
<td style="width: 60%" class="summary"> </td><td>
Services
<?php if ($h->services_ok): ?> <?php if ($h->services_ok): ?>
<!-- Services OK --> <!-- Services OK -->
<span class="state ok"> <span class="state ok">
@ -97,7 +91,8 @@
'monitoring/list/services', 'monitoring/list/services',
array( array(
'service_state' => 2, 'service_state' => 2,
'hostgroup' => $h->hostgroup 'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
)) ?>" title="Services Critical"><?= $h->services_critical ?> CRITICAL: </a> )) ?>" title="Services Critical"><?= $h->services_critical ?> CRITICAL: </a>
<?php if ($h->services_critical_unhandled): ?> <?php if ($h->services_critical_unhandled): ?>
@ -106,7 +101,8 @@
array( array(
'service_state' => 2, 'service_state' => 2,
'service_unhandled' => 1, 'service_unhandled' => 1,
'hostgroup' => $h->hostgroup 'hostgroup' => $h->hostgroup,
'sort' => 'service_severity'
) )
) ?>" title="Services Critical Unhandled"><?= $h->services_critical_unhandled ?> Unhandled</a> ) ?>" title="Services Critical Unhandled"><?= $h->services_critical_unhandled ?> Unhandled</a>
<?php endif ?> <?php endif ?>
@ -178,8 +174,8 @@
) ?>" title="Services Pending"><?= $h->services_pending ?></a> ) ?>" title="Services Pending"><?= $h->services_pending ?></a>
</span> </span>
<?php endif ?> <?php endif ?>
</td> </td></tr></table>
</tr> </span><!-- end of services -->
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </div>
</table> </div>

View File

@ -1,16 +1,22 @@
<?php <?php
$helper = $this->getHelper('MonitoringState');
$viewHelper = $this->getHelper('MonitoringState');
?> ?>
<div class="controls"> <div class="controls">
<?= $this->tabs ?> <?= $this->tabs ?>
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->filterBox->render($this); ?> <?= $this->filterBox->render($this); ?>
<?= $this->sortControl->render($this); ?><br /> </div>
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?> <div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->sortControl->render($this); ?>
</div><br />
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?> <?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?>
</div> </div>
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="content"> <div class="content">
<?php <?php
if ($hosts->count() === 0) { if ($hosts->count() === 0) {
echo '<p>No host found</p>'; echo '<p>No host found</p>';
return; return;
@ -18,86 +24,79 @@ if ($hosts->count() === 0) {
?> ?>
<table class="action multiselect"> <table class="action multiselect">
<tbody> <tbody>
<?php foreach($hosts as $host): ?> <?php foreach($hosts as $host):
<?php $hostStateName = strtolower($this->util()->getHostStateName($host->host_state)); ?>
<?php $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name)); ?> $hostStateName = strtolower($this->util()->getHostStateName($host->host_state));
<!--<tr> --> $hostLink = $this->href('monitoring/show/host', array('host' => $host->host_name));
$icons = array();
if (!$host->host_handled && $host->host_state > 0){
$icons[] = $this->img('img/icons/unhandled.png', array(
'title' => 'Unhandled'
));
}
if ($host->host_acknowledged && !$host->host_in_downtime) {
$icons[] = $this->img('img/icons/acknowledgement.png', array(
'title' => 'Acknowledged'
));
}
if ($host->host_is_flapping) {
$icons[] = $this->img('img/icons/flapping.png', array(
'title' => 'Flapping'
));
}
if (!$host->host_notifications_enabled) {
$icons[] = $this->img('img/icons/notification_disabled.png', array(
'title' => 'Notifications Disabled'
));
}
if (!$host->host_in_downtime) {
$icons[] = $this->img('img/icons/in_downtime.png', array(
'title' => 'In Downtime'
));
}
if (!$host->host_active_checks_enabled) {
if (!$host->host_passive_checks_enabled) {
$icons[] = $this->img('img/icons/active_passive_checks_disabled.png', array(
'title' => 'Active And Passive Checks Disabled'
));
} else {
$icons[] = $this->img('img/icons/active_checks_disabled.png', array(
'title' => 'Active Checks Disabled'
));
}
}
// Not available right now:
if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
$icons[] = $this->img('img/icons/comment.png', array(
'title' => 'Comments'
));
}
?>
<tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>"> <tr class="state <?= $hostStateName ?><?= $host->host_handled ? ' handled' : '' ?>">
<!-- Color column -->
<!-- <td class="tacheader-status-<?= $hostStateName; ?>">
<a style="visibility:hidden" href="<?= $hostLink; ?>"></a>
</td>
-->
<!-- Icons -->
<!-- <td>
<?php if (!$host->host_handled && $host->host_state > 0): ?>
<a href="#" title="Unhandled">
<i class="icon-table icinga-icon-unhandled"></i>
</a>
<?php endif; ?>
<?php if ($host->host_acknowledged && !$host->host_in_downtime): ?>
<a href="#" title="Acknowledged">
<i class="icon-table icinga-icon-acknowledgement"></i>
</a>
<?php endif; ?>
<?php if ($host->host_is_flapping): ?>
<a href="#" title="Flapping">
<i class="icon-table icinga-icon-flapping"></i>
</a>
<?php endif; ?>
<?php if (!$host->host_notifications_enabled): ?>
<a href="#" title="Notifications Disabled">
<i class="icon-table icinga-icon-notification-disabled"></i>
</a>
<?php endif; ?>
<?php if ($host->host_in_downtime): ?>
<a href="#" title="In Downtime">
<i class="icon-table icinga-icon-in-downtime"></i>
</a>
<?php endif; ?>
<?php if (!$host->host_active_checks_enabled): ?>
<?php if (!$host->host_passive_checks_enabled): ?>
<a href="#" title="Active And Passive Checks Disabled">
<i class="icinga-icon-active-passive-checks-disabled"></i>
</a>
<?php else: ?>
<a href="#" title="Active Checks Disabled">
<i class="icon-table icinga-icon-active-checks-disabled"></i>
</a>
<?php endif; ?>
<?php endif; ?>
<?php if (isset($host->host_last_comment) && $host->host_last_comment !== null): ?>
<a href="#" title="Comments">
<i class="icon-table icinga-icon-comment"></i>
</a>
<?php endif; ?>
</td>
-->
<!-- State --> <!-- State -->
<td class="state" title="<?= $viewHelper->getStateTitle($host, 'host'); ?>"> <td class="state" title="<?= $helper->getStateTitle($host, 'host'); ?>">
<div> <div>
<?php if (isset($host->host_unhandled_service_count) && $host->host_unhandled_service_count > 0): ?> <?php if (isset($host->host_unhandled_service_count) && $host->host_unhandled_service_count > 0): ?>
<span class="badge pull-right" title="<?= $host->host_unhandled_service_count; ?> Service Problems on Host"> <span class="badge pull-right" title="<?= $host->host_unhandled_service_count; ?> Service Problems on Host">
<a data-icinga-target="detail" href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name, 'service_problem' => 1)); ?>"> <a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name, 'service_problem' => 1)) ?>"><?= $host->host_unhandled_service_count; ?></a>
<?= $host->host_unhandled_service_count; ?>
</a>
</span> </span>
<?php endif; ?> <?php endif; ?>
<strong><?= ucfirst($viewHelper->monitoringState($host, 'host')); ?></strong><br /> <strong><?= ucfirst($helper->monitoringState($host, 'host')); ?></strong><br />
<div class="small-row"> <div class="small-row">
Since <?= $this->timeSince($host->host_last_state_change); ?> Since <?= $this->timeSince($host->host_last_state_change); ?>
<?php if ($host->host_state > 0): ?> <?php if ($host->host_state > 0): ?>
<br /> <br />
<strong><?= ($host->host_state_type === '1') ? 'Hard' : 'Soft'; ?> </strong> <?= $host->host_current_check_attempt; ?>/<?= $host->host_max_check_attempts; ?> <strong><?= ($host->host_state_type === '1') ? 'Hard' : 'Soft'; ?> </strong> <?= $host->host_current_check_attempt; ?>/<?= $host->host_max_check_attempts; ?>
<?php endif; ?> <?php endif ?>
</div> </div>
</div> </div>
</td> </td>
@ -105,20 +104,13 @@ if ($hosts->count() === 0) {
<!-- Host / Status / Output --> <!-- Host / Status / Output -->
<td> <td>
<?php if ($host->host_icon_image) : ?> <?php if ($host->host_icon_image) : ?>
<div class="pull-left" style="margin-right: 2px;"> <?= $this->img($this->resolveMacros($host->host_icon_image, $host), array('align' => 'right')) ?>
<i class="inline-image" style="background-image: url(<?= $this->escape($this->resolveMacros($host->host_icon_image, $host)); ?>);"></i> <?php endif ?>
</div> <a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name)) ?>"><?= $host->host_name ?></a><br />
<?php endif; ?>
<a href="<?= $this->href('monitoring/list/services', array('host' => $host->host_name)) ?>">
<strong><?= $host->host_name ?></strong>
</a>
<div class="output-text">
<?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?> <?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)); ?>
</div>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -9,7 +9,8 @@ $helper = $this->getHelper('MonitoringState');
<div style="display: inline-block; margin: 1em; vertical-align: top;"> <div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->sortControl->render($this); ?> <?= $this->sortControl->render($this); ?>
</div><br /> </div><br />
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?> <?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?> <div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?></div> <?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
</div> </div>
<div class="content"> <div class="content">
@ -92,7 +93,7 @@ foreach ($services as $service):
</td> </td>
--> -->
<td class="state" title="<?= $helper->getStateTitle($service, 'service'); ?>"> <td class="state" title="<?= $helper->getStateTitle($service, 'service'); ?>">
<strong><?= ucfirst($helper->monitoringState($service, 'service')); ?></strong><br /> <strong><?= strtoupper($helper->monitoringState($service, 'service')); ?></strong><br />
<div class="small-row"> <div class="small-row">
Since <?= $this->timeSince($service->service_last_state_change); ?> Since <?= $this->timeSince($service->service_last_state_change); ?>
@ -106,6 +107,7 @@ foreach ($services as $service):
</td> </td>
<td title="<?= $helper->getStateTitle($service, 'host'); ?>"> <td title="<?= $helper->getStateTitle($service, 'host'); ?>">
<?= $this->perfdata($service->service_perfdata, true) ?>
<!-- <?php if ($service->service_icon_image): ?> <!-- <?php if ($service->service_icon_image): ?>
<div class="pull-left" style="margin-right: 2px;"> <div class="pull-left" style="margin-right: 2px;">
<i class="inline-image" style="background-image: url(<?= $this->escape($this->resolveMacros($service->service_icon_image, $service)); ?>);"></i> <i class="inline-image" style="background-image: url(<?= $this->escape($this->resolveMacros($service->service_icon_image, $service)); ?>);"></i>
@ -116,7 +118,7 @@ foreach ($services as $service):
(<?= ucfirst($helper->monitoringState($service, 'host')); ?>) (<?= ucfirst($helper->monitoringState($service, 'host')); ?>)
<?php endif; ?> <?php endif; ?>
</a><br /> </a><br />
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?> <p class="pluginoutput"><?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?></p>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>