Detail pane [WIP]

refs #4824
This commit is contained in:
Marius Hein 2013-10-10 17:58:30 +02:00 committed by Eric Lippmann
parent c02c18b23f
commit 31555fdb6b
4 changed files with 119 additions and 31 deletions

View File

@ -1,19 +1,49 @@
<div> <div>
<div class="panel-heading">
<div class="panel-hostname">
Comments Comments
<?php if (!empty($object->comments)): ?> <?php
<blockquote> $data = array(
<?php foreach ($object->comments as $comment): ?> 'host' => $object->host_name
<p> );
<?= sprintf( if ($object->service_description) {
'[%s] %s (%s): %s', $data['service'] = $object->service_description;
$this->escape($comment->comment_author), }
$this->format()->timeSince($comment->comment_timestamp), $addCommentHref = $this->href(
$comment->comment_type, 'monitoring/command/addComment',
$comment->comment_data $data
); ?> );
<a href="#" class="button">{{REMOVE_ICON}}</a> $sendNotificationHref = $this->href(
</p> 'monitoring/command/sendCustomNotification',
<?php endforeach; ?> $data
</blockquote> );
<?php endif; ?> ?>
<div class="pull-right">
<a href="<?= $addCommentHref; ?>" class="btn-common btn-small button">
<i class="icinga-icon-comment"></i>
</a>
<a href="<?= $sendNotificationHref; ?>" class="btn-common btn-small button">
<i class="icinga-icon-notification"></i>
</a>
</div>
</div>
</div>
<hr class="separator" />
<div class="panel-body">
<table class="table table-condensed table-detail">
<tbody>
<?php foreach ($object->comments as $comment): ?>
<tr>
<td>
<?= $this->escape($comment->comment_author); ?>, <?= $comment->comment_type; ?>
(<?= $this->format()->timeSince($comment->comment_timestamp); ?>)
<div class="small-row">
<?= $this->escape($comment->comment_data); ?>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div> </div>

View File

@ -4,8 +4,10 @@
if ($type === 'host') { if ($type === 'host') {
$objectStateName = strtolower($this->util()->getHostStateName($this->object->host_state)); $objectStateName = strtolower($this->util()->getHostStateName($this->object->host_state));
$objectState = (int) $object->host_state;
} else { } else {
$objectStateName = strtolower($this->util()->getServiceStateName($this->object->service_state)); $objectStateName = strtolower($this->util()->getServiceStateName($this->object->service_state));
$objectState = (int) $object->service_state;
} }
?> ?>
<div> <div>
@ -71,7 +73,12 @@
<p><?= $this->pluginOutput($object->output); ?></p> <p><?= $this->pluginOutput($object->output); ?></p>
<form> <form>
<button type="submit" class="button btn-cta btn-wide">Recheck</button>
<?php if ($objectState > 0): ?>
<button type="submit" class="button btn-cta btn-half-left">Acknowledge</button>
<?php endif; ?>
<button type="submit" class="button btn-cta <?= ($objectState > 0) ? 'btn-half-right' : 'btn-wide'; ?>">Recheck</button>
</form> </form>
</div> </div>
@ -88,6 +95,17 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if ($object->is_flapping): ?>
<div class="panel-row">
<div class="panel-label">
Flapping
</div>
<div class="panel-content">
<?= sprintf('%.2f', $object->percent_state_change) ?>% state change
</div>
</div>
<?php endif; ?>
<div class="panel-row"> <div class="panel-row">
<div class="panel-label"> <div class="panel-label">
Last Check Last Check
@ -112,5 +130,44 @@
</form> </form>
</div> </div>
</div> </div>
<?php if ($objectState > 0): ?>
<?php
if ($object->service_description) {
$notificationsHref = $this->href(
'monitoring/list/notifications',
array(
'host' => $object->host_name,
'service' => $object->service_description
)
);
} else {
$notificationsHref = $this->href(
'monitoring/list/notifications',
array(
'host' => $object->host_name
)
);
}
?>
<div class="panel-row">
<div class="panel-label">
Last Notification
</div>
<div class="panel-content">
<a href="<?= $notificationsHref ?>">
<?php if ($object->last_notification === '0000-00-00 00:00:00'): ?>
N/A
<?php else: ?>
<?= $object->last_notification ?>
<?php if ($object->current_notification_number > 0): ?>
<br />
<?= $object->current_notification_number ?> notifications sent during current problem state
<?php endif ;?>
<?php endif; ?>
</a>
</div>
</div>
<?php endif; ?>
</div> </div>
</div> </div>

View File

@ -1,11 +1,9 @@
<?= $this->tabs->render($this); ?> <?= $this->tabs->render($this); ?>
<?= $this->render('show/components/status.phtml'); ?> <?= $this->render('show/components/status.phtml'); ?>
<?= $this->render('show/components/command.phtml') ?>
<?= $this->render('show/components/downtime.phtml'); ?>
<?= $this->render('show/components/comments.phtml'); ?> <?= $this->render('show/components/comments.phtml'); ?>
<?= $this->render('show/components/properties.phtml'); ?> <?= $this->render('show/components/downtime.phtml'); ?>
<?= $this->render('show/components/flags.phtml'); ?> <?= $this->render('show/components/flags.phtml'); ?>
<?= $this->render('show/components/customvars.phtml'); ?> <?= $this->render('show/components/customvars.phtml'); ?>
<?= $this->render('show/components/servicegroups.phtml'); ?> <?= $this->render('show/components/servicegroups.phtml'); ?>
<?= $this->render('show/components/contacts.phtml'); ?> <?= $this->render('show/components/contacts.phtml'); ?>
<?= $this->render('show/components/eventHistory.phtml'); ?> <?= $this->render('show/components/command.phtml') ?>

View File

@ -44,6 +44,8 @@ class Host extends AbstractObject
'in_downtime' => 'host_in_downtime', 'in_downtime' => 'host_in_downtime',
'host_acknowledged', 'host_acknowledged',
'host_last_state_change', 'host_last_state_change',
'last_state_change' => 'host_last_state_change',
'last_notification' => 'host_last_notification',
'last_check' => 'host_last_check', 'last_check' => 'host_last_check',
'next_check' => 'host_next_check', 'next_check' => 'host_next_check',
'check_execution_time' => 'host_check_execution_time', 'check_execution_time' => 'host_check_execution_time',
@ -67,7 +69,8 @@ class Host extends AbstractObject
'is_flapping' => 'host_is_flapping', 'is_flapping' => 'host_is_flapping',
'last_comment' => 'host_last_comment', 'last_comment' => 'host_last_comment',
'action_url' => 'host_action_url', 'action_url' => 'host_action_url',
'notes_url' => 'host_notes_url' 'notes_url' => 'host_notes_url',
'percent_state_change' => 'host_percent_state_change'
))->where('host_name', $this->name1)->fetchRow(); ))->where('host_name', $this->name1)->fetchRow();
} }
} }