Add new layout for comment view

refs #5543
This commit is contained in:
Matthias Jentsch 2015-09-29 19:29:43 +02:00
parent 9753d94907
commit 18b6409557
11 changed files with 116 additions and 103 deletions

View File

@ -9,10 +9,10 @@
</div> </div>
<div class="content"> <div class="content">
<h3><?= $this->translate('Comment detail information') ?></h3> <h2><?= $this->translate('Comment detail information') ?></h2>
<table class="avp"> <table class="name-value-table">
<tbody> <tbody>
<tr data-base-target='_next'> <tr>
<?php if ($this->comment->objecttype === 'service'): ?> <?php if ($this->comment->objecttype === 'service'): ?>
<th> <?= $this->translate('Service') ?> </th> <th> <?= $this->translate('Service') ?> </th>
<td> <td>

View File

@ -6,7 +6,7 @@
</div> </div>
<div class="content multi-commands"> <div class="content multi-commands">
<h3><?= $this->icon('reschedule') ?><?= $this->translate('Commands') ?></h3> <h2><?= $this->translate('Commands') ?></h2>
<?= $this->qlink( <?= $this->qlink(
sprintf($this->translate('Remove %d comments'), $comments->count()), sprintf($this->translate('Remove %d comments'), $comments->count()),
$removeAllLink, $removeAllLink,

View File

@ -11,10 +11,10 @@
</div> </div>
<div class="content multi-commands"> <div class="content multi-commands">
<h3> <h2>
<?= $this->icon('reschedule') ?> <?= $this->icon('reschedule') ?>
<?= $this->translate('Commands') ?> <?= $this->translate('Commands') ?>
</h3> </h2>
<p> <p>
<?= sprintf($this->translatePlural( <?= sprintf($this->translatePlural(

View File

@ -13,77 +13,26 @@
<?php endif ?> <?php endif ?>
<div class="content"> <div class="content">
<table data-base-target="_next" <table data-base-target="_next"
class="action comments multiselect" class="action action-table comments multiselect"
data-icinga-multiselect-url="<?= $this->href('monitoring/comments/show'); ?>" data-icinga-multiselect-url="<?= $this->href('monitoring/comments/show'); ?>"
data-icinga-multiselect-related="<?= $this->href("monitoring/comments") ?>" data-icinga-multiselect-related="<?= $this->href("monitoring/comments") ?>"
data-icinga-multiselect-data="comment_id"> data-icinga-multiselect-data="comment_id">
<tbody> <tbody>
<?php foreach ($comments->peekAhead($this->compact) as $comment): ?> <?php foreach ($comments->peekAhead($this->compact) as $comment): ?>
<tr class="state invalid"> <tr class="state invalid">
<td class="state" style="width: 12em;"> <td class="comment-col">
<?= $this->partial('partials/comment/comment-description.phtml', array('comment' => $comment)); ?> <?= $this->partial('partials/comment/comment-description.phtml', array('comment' => $comment)); ?>
</td> </td>
<td> <td>
<?php if ($comment->objecttype === 'service'): ?> <?= $this->partial(
<?= $this->icon('service', $this->translate('Service')); ?> <?= $this->qlink( 'partials/comment/comment-detail.phtml',
$this->escape($comment->host_display_name) . ': ' . $this->escape($comment->service_display_name),
'monitoring/comment/show',
array('comment_id' => $comment->id),
array(
'title' => sprintf(
$this->translate('Show detailed information for this comment about service %s on host %s'),
$comment->service_display_name,
$comment->host_display_name
),
'class' => 'rowaction'
)
); ?>
<?php else: ?>
<?= $this->icon('host', $this->translate('Host')); ?> <?= $this->qlink(
$this->escape($comment->host_display_name),
'monitoring/comment/show',
array('comment_id' => $comment->id),
array(
'title' => sprintf(
$this->translate('Show detailed information for this comment about host %s'),
$comment->host_display_name
),
'class' => 'rowaction'
)
); ?>
<?php endif ?>
<br>
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
? '[' . $this->escape($comment->author) . '] '
: '';
?><?= $this->escape($comment->comment); ?>
<br>
<?= $comment->persistent
? $this->translate('This comment is persistent.')
: $this->translate('This comment is not persistent.');
?>
<br>
<?= $comment->expiration ? sprintf(
$this->translate('This comment expires %s.'),
$this->timeUntil($comment->expiration)
) : $this->translate('This comment does not expire.'); ?>
</td>
<?php if (isset($delCommentForm)): // Form is unset if the current user lacks the respective permission ?>
<td style="width: 2em" data-base-target="_self">
<?php
$delCommentForm = clone $delCommentForm;
$delCommentForm->populate(
array( array(
'comment_id' => $comment->id, 'comment' => $comment,
'comment_is_service' => isset($comment->service_description) 'delCommentForm' => $delCommentForm // Form is unset if the current user lacks the respective permission
) )) ?>
);
echo $delCommentForm;
?>
</td> </td>
<?php endif ?>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?php if (! $comments->hasResult()): ?> <?php if (! $comments->hasResult()): ?>

View File

@ -22,7 +22,6 @@ switch ($comment->type) {
break; break;
} }
?> ?>
<strong><?= $this->escape($title) ?></strong> <span style="font-size: 1.8em">
<br> <?= $this->icon($icon, $tooltip); ?>
<?= $this->icon($icon, $tooltip) ?> </span>
<?= $this->timeAgo($comment->timestamp, $this->compact) ?>

View File

@ -1,17 +1,59 @@
<?php if ($comment->objecttype === 'service'): ?> <span class="comment-header">
<?= $this->icon('service', $this->translate('Service')) ?> <?php if ($comment->objecttype === 'service'): ?>
<?= sprintf( <?= $this->icon('service', $this->translate('Service')); ?> <?= $this->qlink(
'%s: %s', $this->escape($comment->host_display_name) . ': ' . $this->escape($comment->service_display_name),
$comment->host_display_name, 'monitoring/comment/show',
$comment->service_display_name array('comment_id' => $comment->id),
) ?> array(
<?php else: ?> 'title' => sprintf(
<?= $this->icon('host', $this->translate('Host')) ?> $this->translate('Show detailed information for this comment about service %s on host %s'),
<?= $this->link()->host($comment->host_name, $comment->host_display_name) ?> $comment->service_display_name,
<?php endif ?> $comment->host_display_name
),
'class' => 'rowaction'
)
); ?>
<?php else: ?>
<?= $this->icon('host', $this->translate('Host')); ?> <?= $this->qlink(
$this->escape($comment->host_display_name),
'monitoring/comment/show',
array('comment_id' => $comment->id),
array(
'title' => sprintf(
$this->translate('Show detailed information for this comment about host %s'),
$comment->host_display_name
),
'class' => 'rowaction'
)
); ?>
<?php endif ?>
<?= $this->translate('by') ?>
<?= $this->escape($comment->author) ?>
<?= $this->timeAgo($comment->timestamp) ?>
<span class="pull-right" data-base-target="_self">
<?= $comment->persistent ? $this->icon('attach', 'This comment is persistent.') : ''; ?>
<?= $comment->expiration ? $this->icon('clock', sprintf(
$this->translate('This comment expires %s.'),
$this->timeUntil($comment->expiration)
)) : '' ?>
<?php
if (isset($delCommentForm)) {
$delCommentForm = clone $delCommentForm;
$delCommentForm->populate(
array(
'comment_id' => $comment->id,
'comment_is_service' => isset($comment->service_description)
)
);
echo $delCommentForm;
}
?>
</span>
</span>
<br> <br>
<?= $this->icon('comment', $this->translate('Comment')) ?> <span class="comment-content">
<?php if (isset($comment->author)): ?> <?= $this->escape($comment->comment) ?>
[<?= $this->escape($comment->author) ?>] </span>
<?php endif ?>
<?= $this->escape($comment->comment) ?>

View File

@ -1,10 +1,10 @@
<table class="action"> <table>
<tr class="state invalid"> <tr>
<td class="state" style="width: 12em;"> <td class="comment-col">
<?= $this->render('partials/comment/comment-description.phtml'); ?> <?= $this->render('partials/comment/comment-description.phtml') ?>
</td> </td>
<td> <td>
<?= $this->render('partials/comment/comment-detail.phtml'); ?> <?= $this->render('partials/comment/comment-detail.phtml') ?>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -1,4 +1,4 @@
<table class="action" data-base-target="_next"> <table>
<tbody> <tbody>
<?php <?php
foreach ($comments as $i => $comment): foreach ($comments as $i => $comment):
@ -6,14 +6,14 @@
break; break;
} }
?> ?>
<tr class="state invalid"> <tr>
<td class="state" style="width: 12em;"> <td class="comment-col">
<?= $this->partial('partials/comment/comment-description.phtml', array('comment' => $comment)) ?> <?= $this->partial('partials/comment/comment-description.phtml', array('comment' => $comment)) ?>
</td> </td>
<td> <td>
<?= $this->partial('partials/comment/comment-detail.phtml', array('comment' => $comment)) ?> <?= $this->partial('partials/comment/comment-detail.phtml', array('comment' => $comment)) ?>
</td> </td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>

View File

@ -14,8 +14,11 @@ $i = 0;
} }
?> ?>
<tr class="state <?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>"> <tr>
<td class="state"><?= Host::getStateText($host->host_state, true); ?><br /></td> <td class="state-col state-<?= Host::getStateText($host->host_state); ?><?= $host->host_handled ? ' handled' : '' ?>">
<?= Host::getStateText($host->host_state, true); ?>
<br />
</td>
<td> <td>
<?= $this->iconImage()->host($host) ?> <?= $this->iconImage()->host($host) ?>
<?= implode(' ', $this->hostFlags($host)) ?> <?= implode(' ', $this->hostFlags($host)) ?>

View File

@ -12,8 +12,10 @@ $i = 0;
continue; continue;
} }
?> ?>
<tr class="state <?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>"> <tr>
<td class="state"><?= Service::getStateText($service->service_state, true); ?><br /></td> <td class="state-col state-<?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>"?>
<?= Service::getStateText($service->service_state, true); ?><br />
</td>
<td> <td>
<?= $this->iconImage()->service($service) ?> <?= $this->iconImage()->service($service) ?>
<?= implode(' ', $this->serviceFlags($service)) ?> <?= implode(' ', $this->serviceFlags($service)) ?>

View File

@ -68,3 +68,21 @@
text-align: center; text-align: center;
width: 100px; width: 100px;
} }
.comment-col {
padding-top: 0.5em;
vertical-align: top;
width: 3em;
}
.comment-content {
line-height: 1.5em;
padding-top: 0.4em;
padding-bottom: 0.7em;
max-width: 15em;
color: @text-color-light;
}
.comment-header {
line-height: 1.8em;
}