CommentQuery: Fetch and display object names with their initial collation

i.e. `host_name' instead of `comment_host' alias `host'
and `service_description' instead of `comment_service' alias `service'.

refs #8613
This commit is contained in:
Johannes Meyer 2015-04-09 12:49:06 +02:00
parent 1e6f292910
commit cb95f53dba
4 changed files with 18 additions and 15 deletions

View File

@ -474,8 +474,8 @@ class Monitoring_ListController extends Controller
'type' => 'comment_type',
'persistent' => 'comment_is_persistent',
'expiration' => 'comment_expiration',
'host' => 'comment_host',
'service' => 'comment_service',
'host_name',
'service_description',
'host_display_name',
'service_display_name'
));

View File

@ -52,11 +52,14 @@
<?php if ($comment->objecttype === 'service'): ?>
<?= $this->icon('service', $this->translate('Service')); ?>
<?= $this->link()->service(
$comment->service, $comment->service_display_name, $comment->host, $comment->host_display_name
) ?>
$comment->service_description,
$comment->service_display_name,
$comment->host_name,
$comment->host_display_name
); ?>
<?php else: ?>
<?= $this->icon('host', $this->translate('Host')); ?>
<?= $this->link()->host($comment->host, $comment->host_display_name) ?>
<?= $this->link()->host($comment->host_name, $comment->host_display_name); ?>
<?php endif ?>
<br>
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
@ -81,11 +84,13 @@
$delCommentForm = clone $delCommentForm;
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
if ($comment->objecttype === 'host') {
$delCommentForm->setAction($this->url('monitoring/host/delete-comment', array('host_name' => $comment->host)));
$delCommentForm->setAction(
$this->url('monitoring/host/delete-comment', array('host_name' => $comment->host_name))
);
} else {
$delCommentForm->setAction($this->url('monitoring/service/delete-comment', array(
'host_name' => $comment->host,
'service_description' => $comment->service
'host_name' => $comment->host_name,
'service_description' => $comment->service_description
)));
}
echo $delCommentForm;

View File

@ -17,13 +17,11 @@ class CommentQuery extends IdoQuery
'comment_type' => "CASE cm.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'downtime' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END",
'comment_is_persistent' => 'cm.is_persistent',
'comment_expiration' => 'CASE cm.expires WHEN 1 THEN UNIX_TIMESTAMP(cm.expiration_time) ELSE NULL END',
'comment_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279
'comment_service' => 'so.name2 COLLATE latin1_general_ci',
'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279
'comment_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
'service_description' => 'so.name2',
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
'host_name' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END',
'service' => 'so.name2 COLLATE latin1_general_ci',
'service_description' => 'so.name2',
'service_host_name' => 'so.name1'
),
'hosts' => array(

View File

@ -22,10 +22,10 @@ class Comment extends DataView
'comment_type',
'comment_is_persistent',
'comment_expiration',
'comment_host',
'comment_service',
'host',
'service',
'host_name',
'service_description',
'host_display_name',
'service_display_name'
);