MonitoredObject: Only select history entries for the respective object

And fix that the default sort order is not applied.

fixes #9963
This commit is contained in:
Johannes Meyer 2015-08-19 11:53:00 +02:00
parent 7812f6ddcc
commit 65806fafbf
2 changed files with 21 additions and 12 deletions

View File

@ -496,7 +496,8 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
*/
public function peekAhead($state = true)
{
return $this->query->peekAhead($state);
$this->query->peekAhead($state);
return $this;
}
/**

View File

@ -450,21 +450,29 @@ abstract class MonitoredObject implements Filterable
*/
public function fetchEventhistory()
{
$eventHistory = $this->backend->select()->from('eventhistory', array(
'object_type',
'host_name',
'host_display_name',
'service_description',
'service_display_name',
'timestamp',
'state',
'output',
'type'
))
$eventHistory = $this->backend
->select()
->from(
'eventhistory',
array(
'object_type',
'host_name',
'host_display_name',
'service_description',
'service_display_name',
'timestamp',
'state',
'output',
'type'
)
)
->where('object_type', $this->type)
->where('host_name', $this->host_name);
if ($this->type === self::TYPE_SERVICE) {
$eventHistory->where('service_description', $this->service_description);
}
$this->eventhistory = $eventHistory->applyFilter($this->getFilter());
return $this;
}