monitoring: Add restrictable filter columns to the comment data view

refs #9009
This commit is contained in:
Eric Lippmann 2015-05-29 15:37:05 +02:00
parent 41bc4e3b21
commit 54eb0eaf22

View File

@ -4,32 +4,57 @@
namespace Icinga\Module\Monitoring\DataView; namespace Icinga\Module\Monitoring\DataView;
/** /**
* View representation for comments * Host and service comments view
*/ */
class Comment extends DataView class Comment extends DataView
{ {
/**
* {@inheritdoc}
*/
public function isValidFilterTarget($column)
{
if ($column[0] === '_'
&& preg_match('/^_(?:host|service)_/', $column)
) {
return true;
}
return parent::isValidFilterTarget($column);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getColumns() public function getColumns()
{ {
return array( return array(
'comment_objecttype',
'comment_internal_id',
'comment_data',
'comment_author_name', 'comment_author_name',
'comment_data',
'comment_expiration',
'comment_internal_id',
'comment_is_persistent',
'comment_timestamp', 'comment_timestamp',
'comment_type', 'comment_type',
'comment_is_persistent',
'comment_expiration',
'host_name',
'service_description',
'host_display_name', 'host_display_name',
'host_name',
'object_type',
'service_description',
'service_display_name', 'service_display_name',
'service_host_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} * {@inheritdoc}
*/ */
@ -55,12 +80,4 @@ class Comment extends DataView
) )
); );
} }
/**
* {@inheritdoc}
*/
public function getFilterColumns()
{
return array('comment_author', 'host', 'service', 'service_host');
}
} }