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:
parent
1e6f292910
commit
cb95f53dba
|
@ -474,8 +474,8 @@ class Monitoring_ListController extends Controller
|
||||||
'type' => 'comment_type',
|
'type' => 'comment_type',
|
||||||
'persistent' => 'comment_is_persistent',
|
'persistent' => 'comment_is_persistent',
|
||||||
'expiration' => 'comment_expiration',
|
'expiration' => 'comment_expiration',
|
||||||
'host' => 'comment_host',
|
'host_name',
|
||||||
'service' => 'comment_service',
|
'service_description',
|
||||||
'host_display_name',
|
'host_display_name',
|
||||||
'service_display_name'
|
'service_display_name'
|
||||||
));
|
));
|
||||||
|
|
|
@ -52,11 +52,14 @@
|
||||||
<?php if ($comment->objecttype === 'service'): ?>
|
<?php if ($comment->objecttype === 'service'): ?>
|
||||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||||
<?= $this->link()->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: ?>
|
<?php else: ?>
|
||||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
<?= $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 ?>
|
<?php endif ?>
|
||||||
<br>
|
<br>
|
||||||
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
||||||
|
@ -81,11 +84,13 @@
|
||||||
$delCommentForm = clone $delCommentForm;
|
$delCommentForm = clone $delCommentForm;
|
||||||
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
|
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
|
||||||
if ($comment->objecttype === 'host') {
|
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 {
|
} else {
|
||||||
$delCommentForm->setAction($this->url('monitoring/service/delete-comment', array(
|
$delCommentForm->setAction($this->url('monitoring/service/delete-comment', array(
|
||||||
'host_name' => $comment->host,
|
'host_name' => $comment->host_name,
|
||||||
'service_description' => $comment->service
|
'service_description' => $comment->service_description
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
echo $delCommentForm;
|
echo $delCommentForm;
|
||||||
|
|
|
@ -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_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_is_persistent' => 'cm.is_persistent',
|
||||||
'comment_expiration' => 'CASE cm.expires WHEN 1 THEN UNIX_TIMESTAMP(cm.expiration_time) ELSE NULL END',
|
'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",
|
'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',
|
'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'
|
'service_host_name' => 'so.name1'
|
||||||
),
|
),
|
||||||
'hosts' => array(
|
'hosts' => array(
|
||||||
|
|
|
@ -22,10 +22,10 @@ class Comment extends DataView
|
||||||
'comment_type',
|
'comment_type',
|
||||||
'comment_is_persistent',
|
'comment_is_persistent',
|
||||||
'comment_expiration',
|
'comment_expiration',
|
||||||
'comment_host',
|
|
||||||
'comment_service',
|
|
||||||
'host',
|
'host',
|
||||||
'service',
|
'service',
|
||||||
|
'host_name',
|
||||||
|
'service_description',
|
||||||
'host_display_name',
|
'host_display_name',
|
||||||
'service_display_name'
|
'service_display_name'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue