From 54eb0eaf221b5957c2816903fe4f804058ab6cc1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 29 May 2015 15:37:05 +0200 Subject: [PATCH] monitoring: Add restrictable filter columns to the comment data view refs #9009 --- .../library/Monitoring/DataView/Comment.php | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/modules/monitoring/library/Monitoring/DataView/Comment.php b/modules/monitoring/library/Monitoring/DataView/Comment.php index 1fadd8b62..9d7aa612e 100644 --- a/modules/monitoring/library/Monitoring/DataView/Comment.php +++ b/modules/monitoring/library/Monitoring/DataView/Comment.php @@ -4,32 +4,57 @@ namespace Icinga\Module\Monitoring\DataView; /** - * View representation for comments + * Host and service comments view */ class Comment extends DataView { + /** + * {@inheritdoc} + */ + public function isValidFilterTarget($column) + { + if ($column[0] === '_' + && preg_match('/^_(?:host|service)_/', $column) + ) { + return true; + } + return parent::isValidFilterTarget($column); + } + /** * {@inheritdoc} */ public function getColumns() { return array( - 'comment_objecttype', - 'comment_internal_id', - 'comment_data', 'comment_author_name', + 'comment_data', + 'comment_expiration', + 'comment_internal_id', + 'comment_is_persistent', 'comment_timestamp', 'comment_type', - 'comment_is_persistent', - 'comment_expiration', - 'host_name', - 'service_description', 'host_display_name', + 'host_name', + 'object_type', + 'service_description', 'service_display_name', 'service_host_name' ); } + /** + * {@inheritdoc} + */ + public function getFilterColumns() + { + return array( + 'comment_author ', + 'host', 'hostgroup', 'hostgroup_alias', 'hostgroup_name', + 'service', 'servicegroup', 'servicegroup_alias', 'servicegroup_name' + ); + } + /** * {@inheritdoc} */ @@ -55,12 +80,4 @@ class Comment extends DataView ) ); } - - /** - * {@inheritdoc} - */ - public function getFilterColumns() - { - return array('comment_author', 'host', 'service', 'service_host'); - } }