Service detail view: Template fixes

refs #4181
This commit is contained in:
Marius Hein 2013-07-23 14:03:32 +02:00
parent 4ededd5179
commit 1492245788
12 changed files with 99 additions and 59 deletions

View File

@ -26,7 +26,7 @@
use Icinga\Monitoring\Command\Meta;
/**
* Class MonitoringCommands
* Display a bunch of commands
*
* Helper which produces a list of command buttons
* depending on object states
@ -34,8 +34,10 @@ use Icinga\Monitoring\Command\Meta;
class Zend_View_Helper_MonitoringCommands extends Zend_View_Helper_Abstract
{
/**
* Helper function called externally
*
* @param stdClass $object host or service object or something other
* @param string $type small or full
* @param string $type small or full
* @return string html output
*/
public function monitoringCommands(\stdClass $object, $type)

View File

@ -1,10 +1,29 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Icinga 2 Web - Head for multiple monitoring frontends
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Class Zend_View_Helper_MonitoringFlags
*
* Rendering helper for flags depending on objects
*/
class Zend_View_Helper_MonitoringFlags extends Zend_View_Helper_Abstract
@ -15,10 +34,10 @@ class Zend_View_Helper_MonitoringFlags extends Zend_View_Helper_Abstract
*/
private static $keys = array(
'passive_checks_enabled' => 'Passive checks',
'active_checks_enabled' => 'Active checks',
'obsess_over_host' => 'Obsessing',
'notifications_enabled' => 'Notifications',
'event_handler_enabled' => 'Event handler',
'active_checks_enabled' => 'Active checks',
'obsess_over_host' => 'Obsessing',
'notifications_enabled' => 'Notifications',
'event_handler_enabled' => 'Event handler',
'flap_detection_enabled' => 'Flap detection',
);

View File

@ -1,9 +1,30 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Icinga 2 Web - Head for multiple monitoring frontends
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
/**
* Class Zend_View_Helper_MonitoringProperties
* Helper to display monitoring properties
*/
class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
{
@ -45,16 +66,16 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
* @var array
*/
private static $keys = array(
'buildAttempt' => 'Current attempt',
'last_check' => 'Last check time',
'buildCheckType' => 'Check type',
'buildLatency' => 'Check latency / duration',
'buildNextCheck' => 'Next scheduled active check',
'buildLastStateChange' => 'Last state change',
'buildLastNotification' => 'Last notification',
'buildFlapping' => 'Is this %s flapping?',
'buildAttempt' => 'Current attempt',
'last_check' => 'Last check time',
'buildCheckType' => 'Check type',
'buildLatency' => 'Check latency / duration',
'buildNextCheck' => 'Next scheduled active check',
'buildLastStateChange' => 'Last state change',
'buildLastNotification' => 'Last notification',
'buildFlapping' => 'Is this %s flapping?',
'buildScheduledDowntime' => 'In scheduled downtime?',
'status_update_time' => 'Last update'
'status_update_time' => 'Last update'
);
/**

View File

@ -1,5 +1,5 @@
<?php if (! empty($this->comments)) { ?>
<?php if (! empty($this->comments)): ?>
<?
$list = array();
foreach ($this->comments as $comment) {
@ -28,4 +28,4 @@ foreach ($this->comments as $comment) {
<blockquote> <?= implode('<br />', $list) ?></blockquote>
</div>
<?php } ?>
<?php endif; ?>

View File

@ -1,4 +1,4 @@
<?php if (!empty($this->downtimes)) { ?>
<?php if (!empty($this->downtimes)): ?>
<?php
$list = array();
foreach ($this->downtimes as $downtime) {
@ -40,4 +40,4 @@
</table>
</div>
</div>
<?php } ?>
<?php endif; ?>

View File

@ -10,16 +10,16 @@
$flags = $this->monitoringFlags($object);
?>
<table class="flag-container">
<?php foreach ($flags as $name => $value) { ?>
<?php foreach ($flags as $name => $value): ?>
<tr>
<th><?= $name; ?></th>
<td>
<?php if ($value === true) { ?>
<?php if ($value === true): ?>
<span class="flag flag-enabled">ENABLED</span>
<?php } else { ?>
<?php else: ?>
<span class="flag flag-disabled">DISABLED</span>
<?php } ?>
<?php endif; ?>
</td>
</tr>
<?php } ?>
<?php endforeach; ?>
</table>

View File

@ -10,10 +10,10 @@ if (isset($this->service)) {
$properties = $this->monitoringProperties($object);
?>
<table>
<?php foreach ($properties as $label => $value) { ?>
<?php foreach ($properties as $label => $value): ?>
<tr>
<th><?= $label ?></th>
<td><?= $value ?></td>
</tr>
<?php } ?>
<?php endforeach; ?>
</table>

View File

@ -17,7 +17,7 @@ if (!$this->compact) {
}
?>
<div class="information-container">
<?php if ($inlineCommands === true) { ?>
<?php if ($inlineCommands === true): ?>
<div class="pull-right">
<?=
$this->monitoringCommands(
@ -26,35 +26,35 @@ if (!$this->compact) {
);
?>
</div>
<?php } ?>
<?php endif; ?>
<table>
<tr class="<?= $this->monitoringState($this->host, 'host') ?><?= $this->host->host_handled ? ' handled' : '' ?>">
<td>
<?php if ($this->host->host_icon_image) : ?>
<?php if ($this->host->host_icon_image): ?>
<div class="monitoring_icon">
<img src="<?= $this->host->host_icon_image; ?>" alt="Host image" />
</div>
<?php endif; ?>
<strong>
<?= $this->escape($this->host->host_name); ?>
<?php if ($this->host->host_address && $this->host->host_address !== $this->host->host_name) { ?>
<?php if ($this->host->host_address && $this->host->host_address !== $this->host->host_name): ?>
(<?= $this->escape($this->host->host_address); ?>)
<?php } ?>
<?php endif; ?>
</strong>
<?php if (isset($this->host->host_alias) && $this->host->host_alias !== $this->host->host_name) { ?>
<?php if (isset($this->host->host_alias) && $this->host->host_alias !== $this->host->host_name): ?>
<br />
<sup>(<?= $this->host->host_alias; ?>)</sup>
<?php } ?>
<?php endif; ?>
</td>
<td class="state"<?= $showService ? '' : ' rowspan="2"'; ?>
<?= $this->util()->getHostStateName($this->host->host_state); ?>
since <?= $this->timeSince($this->host->host_last_state_change); ?>
<?php if ($this->host->host_acknowledged === '1') { ?>
<?php if ($this->host->host_acknowledged === '1'): ?>
(Has been acknowledged)
<?php } ?>
<?php endif; ?>
</td>
</tr>
@ -91,9 +91,9 @@ if (!$this->compact) {
<td class="state">
<?= $this->util()->getServiceStateName($this->service->service_state); ?>
since <?= $this->timeSince($this->service->service_last_state_change); ?>
<?php if ($this->service->service_acknowledged === '1') { ?>
<?php if ($this->service->service_acknowledged === '1'): ?>
(Has been acknowledged)
<?php } ?>
<?php endif; ?>
</td>
</tr>

View File

@ -52,10 +52,10 @@
<div class="head">
<span>Groups and Contacts</span>
</div>
<?php if (count($hostgroupLinkList)) { ?>
<?php if (count($hostgroupLinkList)): ?>
<strong>Hostgroups:</strong>
<?= implode(' ', $hostgroupLinkList); ?>
<?php } ?>
<?php endif; ?>
<?= $this->render('show/components/contacts.phtml') ?>
</div>

View File

@ -26,7 +26,7 @@
namespace Icinga\Monitoring\Backend\Ido\Query;
/**
* Class DowntimeQuery
* Handling downtime queries
*/
class DowntimeQuery extends AbstractQuery
{
@ -36,25 +36,25 @@ class DowntimeQuery extends AbstractQuery
*/
protected $columnMap = array(
'downtime' => array(
'downtime_type' => 'sd.downtime_type',
'downtime_author_name' => 'sd.author_name',
'downtime_comment_data' => 'sd.comment_data',
'downtime_is_fixed' => 'sd.is_fixed',
'downtime_duration' => 'sd.duration',
'downtime_scheduled_start_time' => 'sd.scheduled_start_time',
'downtime_scheduled_end_time' => 'sd.scheduled_end_time',
'downtime_was_started' => 'sd.was_started',
'downtime_actual_start_time' => 'sd.actual_start_time',
'downtime_type' => 'sd.downtime_type',
'downtime_author_name' => 'sd.author_name',
'downtime_comment_data' => 'sd.comment_data',
'downtime_is_fixed' => 'sd.is_fixed',
'downtime_duration' => 'sd.duration',
'downtime_scheduled_start_time' => 'sd.scheduled_start_time',
'downtime_scheduled_end_time' => 'sd.scheduled_end_time',
'downtime_was_started' => 'sd.was_started',
'downtime_actual_start_time' => 'sd.actual_start_time',
'downtime_actual_start_time_usec' => 'sd.actual_start_time_usec',
'downtime_is_in_effect' => 'sd.is_in_effect',
'downtime_trigger_time' => 'sd.trigger_time',
'downtime_internal_downtime_id' => 'sd.internal_downtime_id'
'downtime_is_in_effect' => 'sd.is_in_effect',
'downtime_trigger_time' => 'sd.trigger_time',
'downtime_internal_downtime_id' => 'sd.internal_downtime_id'
),
'hosts' => array(
'host_name' => 'ho.name1',
),
'services' => array(
'service_host_name' => 'so.name1',
'service_host_name' => 'so.name1',
'service_description' => 'so.name2',
)
);

View File

@ -29,8 +29,6 @@ use Icinga\Authentication\User;
use Icinga\Exception\ProgrammingError;
/**
* Class Meta
*
* Deals with objects and available commands which can be used on the object
*/
class Meta

View File

@ -25,7 +25,7 @@
namespace Icinga\Monitoring\View;
/**
* Class DowntimeView
* View for downtimes
*/
class DowntimeView extends MonitoringView
{