From 18b6409557d3be08c452dc1bdaecaf96747c9adf Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 29 Sep 2015 19:29:43 +0200 Subject: [PATCH] Add new layout for comment view refs #5543 --- .../views/scripts/comment/show.phtml | 6 +- .../views/scripts/comments/show.phtml | 2 +- .../views/scripts/hosts/show.phtml | 4 +- .../views/scripts/list/comments.phtml | 67 ++--------------- .../comment/comment-description.phtml | 7 +- .../partials/comment/comment-detail.phtml | 74 +++++++++++++++---- .../partials/comment/comment-header.phtml | 10 +-- .../partials/comment/comments-header.phtml | 18 ++--- .../partials/host/objects-header.phtml | 7 +- .../partials/service/objects-header.phtml | 6 +- modules/monitoring/public/css/tables.less | 18 +++++ 11 files changed, 116 insertions(+), 103 deletions(-) diff --git a/modules/monitoring/application/views/scripts/comment/show.phtml b/modules/monitoring/application/views/scripts/comment/show.phtml index 17e72e7c94..7dee4fcfa1 100644 --- a/modules/monitoring/application/views/scripts/comment/show.phtml +++ b/modules/monitoring/application/views/scripts/comment/show.phtml @@ -9,10 +9,10 @@
-

translate('Comment detail information') ?>

- +

translate('Comment detail information') ?>

+
- + comment->objecttype === 'service'): ?>
translate('Service') ?> diff --git a/modules/monitoring/application/views/scripts/comments/show.phtml b/modules/monitoring/application/views/scripts/comments/show.phtml index d1c8431eee..67e1c6be1b 100644 --- a/modules/monitoring/application/views/scripts/comments/show.phtml +++ b/modules/monitoring/application/views/scripts/comments/show.phtml @@ -6,7 +6,7 @@
-

icon('reschedule') ?>translate('Commands') ?>

+

translate('Commands') ?>

qlink( sprintf($this->translate('Remove %d comments'), $comments->count()), $removeAllLink, diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 053c445201..fe336f101a 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -11,10 +11,10 @@
-

+

icon('reschedule') ?> translate('Commands') ?> -

+

translatePlural( diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml index 5cd7d298b8..759e47feaa 100644 --- a/modules/monitoring/application/views/scripts/list/comments.phtml +++ b/modules/monitoring/application/views/scripts/list/comments.phtml @@ -13,77 +13,26 @@

" data-icinga-multiselect-data="comment_id"> peekAhead($this->compact) as $comment): ?> - - - - - +
+ partial('partials/comment/comment-description.phtml', array('comment' => $comment)); ?> - objecttype === 'service'): ?> - icon('service', $this->translate('Service')); ?> qlink( - $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' - ) - ); ?> - - icon('host', $this->translate('Host')); ?> 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' - ) - ); ?> - -
- icon('comment', $this->translate('Comment')); ?> author) - ? '[' . $this->escape($comment->author) . '] ' - : ''; - ?>escape($comment->comment); ?> -
- persistent - ? $this->translate('This comment is persistent.') - : $this->translate('This comment is not persistent.'); - ?> -
- expiration ? sprintf( - $this->translate('This comment expires %s.'), - $this->timeUntil($comment->expiration) - ) : $this->translate('This comment does not expire.'); ?> -
- populate( + partial( + 'partials/comment/comment-detail.phtml', array( - 'comment_id' => $comment->id, - 'comment_is_service' => isset($comment->service_description) - ) - ); - echo $delCommentForm; - ?> + 'comment' => $comment, + 'delCommentForm' => $delCommentForm // Form is unset if the current user lacks the respective permission + )) ?>
hasResult()): ?> diff --git a/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml b/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml index da0ce7886d..b2ad29eadb 100644 --- a/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml +++ b/modules/monitoring/application/views/scripts/partials/comment/comment-description.phtml @@ -22,7 +22,6 @@ switch ($comment->type) { break; } ?> -escape($title) ?> -
-icon($icon, $tooltip) ?> -timeAgo($comment->timestamp, $this->compact) ?> + + icon($icon, $tooltip); ?> + diff --git a/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml b/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml index 9d5da0648d..1b78fbcf0a 100644 --- a/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml +++ b/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml @@ -1,17 +1,59 @@ -objecttype === 'service'): ?> - icon('service', $this->translate('Service')) ?> - host_display_name, - $comment->service_display_name - ) ?> - - icon('host', $this->translate('Host')) ?> - link()->host($comment->host_name, $comment->host_display_name) ?> - + + objecttype === 'service'): ?> + icon('service', $this->translate('Service')); ?> qlink( + $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' + ) + ); ?> + + icon('host', $this->translate('Host')); ?> 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' + ) + ); ?> + + translate('by') ?> + escape($comment->author) ?> + + timeAgo($comment->timestamp) ?> + + + persistent ? $this->icon('attach', 'This comment is persistent.') : ''; ?> + expiration ? $this->icon('clock', sprintf( + $this->translate('This comment expires %s.'), + $this->timeUntil($comment->expiration) + )) : '' ?> + populate( + array( + 'comment_id' => $comment->id, + 'comment_is_service' => isset($comment->service_description) + ) + ); + echo $delCommentForm; + } + ?> + + +
-icon('comment', $this->translate('Comment')) ?> -author)): ?> - [escape($comment->author) ?>] - -escape($comment->comment) ?> + + escape($comment->comment) ?> + diff --git a/modules/monitoring/application/views/scripts/partials/comment/comment-header.phtml b/modules/monitoring/application/views/scripts/partials/comment/comment-header.phtml index c3e0fadda4..3dcb479cd1 100644 --- a/modules/monitoring/application/views/scripts/partials/comment/comment-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/comment/comment-header.phtml @@ -1,10 +1,10 @@ - - - - + + - + +
- render('partials/comment/comment-description.phtml'); ?> + + +
+ render('partials/comment/comment-description.phtml') ?> - render('partials/comment/comment-detail.phtml'); ?> + render('partials/comment/comment-detail.phtml') ?>
diff --git a/modules/monitoring/application/views/scripts/partials/comment/comments-header.phtml b/modules/monitoring/application/views/scripts/partials/comment/comments-header.phtml index 6d5ba8f883..68cc1f9584 100644 --- a/modules/monitoring/application/views/scripts/partials/comment/comments-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/comment/comments-header.phtml @@ -1,4 +1,4 @@ - +
$comment): @@ -6,14 +6,14 @@ break; } ?> - - - - + + + +
- partial('partials/comment/comment-description.phtml', array('comment' => $comment)) ?> - - partial('partials/comment/comment-detail.phtml', array('comment' => $comment)) ?> -
+ partial('partials/comment/comment-description.phtml', array('comment' => $comment)) ?> + + partial('partials/comment/comment-detail.phtml', array('comment' => $comment)) ?> +
diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml index bce62db6ba..0a3fdbaf67 100644 --- a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml @@ -14,8 +14,11 @@ $i = 0; } ?> -
host_state, true); ?>
+ host_state, true); ?> +
+
iconImage()->host($host) ?> hostFlags($host)) ?> diff --git a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml index 907e7b3494..d75de6029d 100644 --- a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml @@ -12,8 +12,10 @@ $i = 0; continue; } ?> -
service_state, true); ?>
+ service_state, true); ?>
+
iconImage()->service($service) ?> serviceFlags($service)) ?> diff --git a/modules/monitoring/public/css/tables.less b/modules/monitoring/public/css/tables.less index d8ede21636..07413ae029 100644 --- a/modules/monitoring/public/css/tables.less +++ b/modules/monitoring/public/css/tables.less @@ -68,3 +68,21 @@ text-align: center; 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; +}