2013-09-26 17:02:56 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2013-09-26 17:02:56 +02:00
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\DataView;
|
|
|
|
|
|
|
|
/**
|
2015-05-29 15:37:05 +02:00
|
|
|
* Host and service comments view
|
2013-09-26 17:02:56 +02:00
|
|
|
*/
|
|
|
|
class Comment extends DataView
|
|
|
|
{
|
2015-05-29 15:37:05 +02:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function isValidFilterTarget($column)
|
|
|
|
{
|
|
|
|
if ($column[0] === '_'
|
|
|
|
&& preg_match('/^_(?:host|service)_/', $column)
|
|
|
|
) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return parent::isValidFilterTarget($column);
|
|
|
|
}
|
|
|
|
|
2013-09-26 17:02:56 +02:00
|
|
|
/**
|
2015-03-11 10:43:19 +01:00
|
|
|
* {@inheritdoc}
|
2013-09-26 17:02:56 +02:00
|
|
|
*/
|
|
|
|
public function getColumns()
|
|
|
|
{
|
|
|
|
return array(
|
2015-04-09 13:06:38 +02:00
|
|
|
'comment_author_name',
|
2015-05-29 15:37:05 +02:00
|
|
|
'comment_data',
|
|
|
|
'comment_expiration',
|
|
|
|
'comment_internal_id',
|
|
|
|
'comment_is_persistent',
|
2013-09-26 17:02:56 +02:00
|
|
|
'comment_timestamp',
|
|
|
|
'comment_type',
|
2015-05-29 15:37:05 +02:00
|
|
|
'host_display_name',
|
2015-04-09 12:49:06 +02:00
|
|
|
'host_name',
|
2015-05-29 15:37:05 +02:00
|
|
|
'object_type',
|
2015-04-09 12:49:06 +02:00
|
|
|
'service_description',
|
2015-04-09 12:56:31 +02:00
|
|
|
'service_display_name',
|
|
|
|
'service_host_name'
|
2013-09-26 17:02:56 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-05-29 15:37:05 +02:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getFilterColumns()
|
|
|
|
{
|
|
|
|
return array(
|
2015-06-25 12:59:57 +02:00
|
|
|
'comment_author',
|
2015-06-05 15:48:05 +02:00
|
|
|
'host', 'host_alias',
|
|
|
|
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
|
|
|
'service',
|
|
|
|
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
2015-05-29 15:37:05 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-06-25 12:59:57 +02:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getSearchColumns()
|
|
|
|
{
|
|
|
|
return array('host', 'host_display_name', 'service', 'service_display_name', 'comment_author');
|
|
|
|
}
|
|
|
|
|
2013-09-26 17:02:56 +02:00
|
|
|
/**
|
2015-03-11 10:43:19 +01:00
|
|
|
* {@inheritdoc}
|
2013-09-26 17:02:56 +02:00
|
|
|
*/
|
|
|
|
public function getSortRules()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'comment_timestamp' => array(
|
2014-03-09 19:29:23 +01:00
|
|
|
'order' => self::SORT_DESC
|
2013-09-26 17:02:56 +02:00
|
|
|
),
|
2015-01-21 16:15:09 +01:00
|
|
|
'host_display_name' => array(
|
2014-03-09 19:29:23 +01:00
|
|
|
'columns' => array(
|
2015-01-21 16:15:09 +01:00
|
|
|
'host_display_name',
|
|
|
|
'service_display_name'
|
2013-09-26 17:02:56 +02:00
|
|
|
),
|
2014-03-09 19:29:23 +01:00
|
|
|
'order' => self::SORT_ASC
|
2013-09-26 17:02:56 +02:00
|
|
|
),
|
2015-01-21 16:15:09 +01:00
|
|
|
'service_display_name' => array(
|
|
|
|
'columns' => array(
|
|
|
|
'service_display_name',
|
|
|
|
'host_display_name'
|
|
|
|
),
|
|
|
|
'order' => self::SORT_ASC
|
|
|
|
)
|
2013-09-26 17:02:56 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|