monitoring: Fix select columns for the comment data views

refs #9009
This commit is contained in:
Eric Lippmann 2015-05-29 15:38:03 +02:00
parent 54eb0eaf22
commit 46fdaf4698
6 changed files with 32 additions and 6 deletions

View File

@ -27,7 +27,7 @@ class Monitoring_CommentController extends Controller
$this->comment = $this->backend->select()->from('comment', array( $this->comment = $this->backend->select()->from('comment', array(
'id' => 'comment_internal_id', 'id' => 'comment_internal_id',
'objecttype' => 'comment_objecttype', 'objecttype' => 'object_type',
'comment' => 'comment_data', 'comment' => 'comment_data',
'author' => 'comment_author_name', 'author' => 'comment_author_name',
'timestamp' => 'comment_timestamp', 'timestamp' => 'comment_timestamp',

View File

@ -32,7 +32,7 @@ class Monitoring_CommentsController extends Controller
)); ));
$this->comments = $this->backend->select()->from('comment', array( $this->comments = $this->backend->select()->from('comment', array(
'id' => 'comment_internal_id', 'id' => 'comment_internal_id',
'objecttype' => 'comment_objecttype', 'objecttype' => 'object_type',
'comment' => 'comment_data', 'comment' => 'comment_data',
'author' => 'comment_author_name', 'author' => 'comment_author_name',
'timestamp' => 'comment_timestamp', 'timestamp' => 'comment_timestamp',
@ -44,11 +44,11 @@ class Monitoring_CommentsController extends Controller
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
))->addFilter($this->filter)->getQuery()->fetchAll(); ))->addFilter($this->filter)->getQuery()->fetchAll();
if (false === $this->comments) { if (false === $this->comments) {
throw new Zend_Controller_Action_Exception($this->translate('Comment not found')); throw new Zend_Controller_Action_Exception($this->translate('Comment not found'));
} }
$this->getTabs()->add( $this->getTabs()->add(
'comments', 'comments',
array( array(

View File

@ -431,7 +431,7 @@ class Monitoring_ListController extends Controller
$query = $this->backend->select()->from('comment', array( $query = $this->backend->select()->from('comment', array(
'id' => 'comment_internal_id', 'id' => 'comment_internal_id',
'objecttype' => 'comment_objecttype', 'objecttype' => 'object_type',
'comment' => 'comment_data', 'comment' => 'comment_data',
'author' => 'comment_author_name', 'author' => 'comment_author_name',
'timestamp' => 'comment_timestamp', 'timestamp' => 'comment_timestamp',

View File

@ -87,6 +87,19 @@ class HostList extends ObjectList
return FilterOr::matchAny($filterExpression); return FilterOr::matchAny($filterExpression);
} }
/**
* Get the comments
*
* @return \Icinga\Module\Monitoring\DataView\Hostcomment
*/
public function getComments()
{
return $this->backend
->select()
->from('hostcomment', array('host_name'))
->applyFilter(clone $this->filter);
}
/** /**
* Get the scheduled downtimes * Get the scheduled downtimes
* *

View File

@ -253,7 +253,7 @@ abstract class MonitoredObject implements Filterable
'type' => 'comment_type', 'type' => 'comment_type',
)) ))
->where('comment_type', array('comment', 'ack')) ->where('comment_type', array('comment', 'ack'))
->where('comment_objecttype', $this->type); ->where('object_type', $this->type);
if ($this->type === self::TYPE_SERVICE) { if ($this->type === self::TYPE_SERVICE) {
$comments $comments
->where('service_host_name', $this->host_name) ->where('service_host_name', $this->host_name)

View File

@ -135,6 +135,19 @@ class ServiceList extends ObjectList
return FilterOr::matchAny($filterExpression); return FilterOr::matchAny($filterExpression);
} }
/**
* Get the comments
*
* @return \Icinga\Module\Monitoring\DataView\Hostcomment
*/
public function getComments()
{
return $this->backend
->select()
->from('servicecomment', array('host_name', 'service_description'))
->applyFilter(clone $this->filter);
}
/** /**
* Get the scheduled downtimes * Get the scheduled downtimes
* *