DowntimeQuery: Add query column `instance_name'

refs #9943
This commit is contained in:
Johannes Meyer 2015-08-25 16:34:18 +02:00
parent edb83c8b41
commit f70a861ff4
4 changed files with 33 additions and 1 deletions

View File

@ -30,7 +30,8 @@ class DowntimeQuery extends IdoQuery
'downtime_scheduled_end' => 'd.downtime_scheduled_end', 'downtime_scheduled_end' => 'd.downtime_scheduled_end',
'downtime_scheduled_start' => 'd.downtime_scheduled_start', 'downtime_scheduled_start' => 'd.downtime_scheduled_start',
'downtime_start' => 'd.downtime_start', 'downtime_start' => 'd.downtime_start',
'object_type' => 'd.object_type' 'object_type' => 'd.object_type',
'instance_name' => 'd.instance_name'
), ),
'hosts' => array( 'hosts' => array(
'host_display_name' => 'd.host_display_name', 'host_display_name' => 'd.host_display_name',

View File

@ -17,6 +17,9 @@ class HostdowntimeQuery extends IdoQuery
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $columnMap = array( protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'downtimes' => array( 'downtimes' => array(
'downtime_author' => 'sd.author_name COLLATE latin1_general_ci', 'downtime_author' => 'sd.author_name COLLATE latin1_general_ci',
'downtime_author_name' => 'sd.author_name', 'downtime_author_name' => 'sd.author_name',
@ -157,6 +160,18 @@ class HostdowntimeQuery extends IdoQuery
); );
} }
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sd.instance_id',
array()
);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -17,6 +17,9 @@ class ServicedowntimeQuery extends IdoQuery
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $columnMap = array( protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'downtimes' => array( 'downtimes' => array(
'downtime_author' => 'sd.author_name COLLATE latin1_general_ci', 'downtime_author' => 'sd.author_name COLLATE latin1_general_ci',
'downtime_author_name' => 'sd.author_name', 'downtime_author_name' => 'sd.author_name',
@ -171,6 +174,18 @@ class ServicedowntimeQuery extends IdoQuery
); );
} }
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sd.instance_id',
array()
);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -14,6 +14,7 @@ class Downtime extends DataView
public function getColumns() public function getColumns()
{ {
return array( return array(
'instance_name',
'downtime_author_name', 'downtime_author_name',
'downtime_comment', 'downtime_comment',
'downtime_duration', 'downtime_duration',