From fedd2c3b18528252bf734415d76ea25a80c1ea4f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 25 Aug 2015 16:34:37 +0200 Subject: [PATCH] HostgroupQuery: Add query column `instance_name' refs #9943 --- .../Backend/Ido/Query/HostgroupQuery.php | 15 +++++++++++++++ .../library/Monitoring/DataView/Hostgroup.php | 1 + 2 files changed, 16 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php index 5144953c2..aaa72a166 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php @@ -17,6 +17,9 @@ class HostgroupQuery extends IdoQuery * {@inheritdoc} */ protected $columnMap = array( + 'instances' => array( + 'instance_name' => 'i.instance_name' + ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', 'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci', @@ -126,6 +129,18 @@ class HostgroupQuery extends IdoQuery ); } + /** + * Join instances + */ + protected function joinInstances() + { + $this->select->join( + array('i' => $this->prefix . 'instances'), + 'i.instance_id = hg.instance_id', + array() + ); + } + /** * {@inheritdoc} */ diff --git a/modules/monitoring/library/Monitoring/DataView/Hostgroup.php b/modules/monitoring/library/Monitoring/DataView/Hostgroup.php index 66cfee189..9350276b3 100644 --- a/modules/monitoring/library/Monitoring/DataView/Hostgroup.php +++ b/modules/monitoring/library/Monitoring/DataView/Hostgroup.php @@ -14,6 +14,7 @@ class Hostgroup extends DataView public function getColumns() { return array( + 'instance_name', 'hostgroup_alias', 'hostgroup_name' );