mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 05:44:36 +02:00
GroupsummaryQuery: distinct columns/desiredColumns
I guess this needs some more investigation, desiredColumns are the ones the user asked for ([alias => ]column), with column being once again an alias in the "real" query. Alias resolution used to work better long time ago, we should reflect on this.
This commit is contained in:
parent
027ef6ede3
commit
dab90d6c4a
@ -71,8 +71,9 @@ class GroupSummaryQuery extends IdoQuery
|
|||||||
'host_state',
|
'host_state',
|
||||||
'host_name'
|
'host_name'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Prepend group column since we'll use columns index 0 later for grouping
|
// Prepend group column since we'll use columns index 0 later for grouping
|
||||||
if (in_array('servicegroup', $this->getColumns())) {
|
if (in_array('servicegroup', $this->desiredColumns)) {
|
||||||
array_unshift($columns, 'servicegroup');
|
array_unshift($columns, 'servicegroup');
|
||||||
} else {
|
} else {
|
||||||
array_unshift($columns, 'hostgroup');
|
array_unshift($columns, 'hostgroup');
|
||||||
@ -80,21 +81,22 @@ class GroupSummaryQuery extends IdoQuery
|
|||||||
$hosts = $this->createSubQuery(
|
$hosts = $this->createSubQuery(
|
||||||
'Hoststatus',
|
'Hoststatus',
|
||||||
$columns + array(
|
$columns + array(
|
||||||
'state' => 'host_state',
|
'state' => 'host_state',
|
||||||
'acknowledged' => 'host_acknowledged',
|
'acknowledged' => 'host_acknowledged',
|
||||||
'in_downtime' => 'host_in_downtime'
|
'in_downtime' => 'host_in_downtime'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$services = $this->createSubQuery(
|
$services = $this->createSubQuery(
|
||||||
'Status',
|
'Status',
|
||||||
$columns + array(
|
$columns + array(
|
||||||
'state' => 'service_state',
|
'state' => 'service_state',
|
||||||
'acknowledged' => 'service_acknowledged',
|
'acknowledged' => 'service_acknowledged',
|
||||||
'in_downtime' => 'service_in_downtime'
|
'in_downtime' => 'service_in_downtime'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$union = $this->db->select()->union(array($hosts, $services), Zend_Db_Select::SQL_UNION_ALL);
|
$union = $this->db->select()->union(array($hosts, $services), Zend_Db_Select::SQL_UNION_ALL);
|
||||||
$this->select->from(array('statussummary' => $union), array())->group($columns[0]);
|
$this->select->from(array('statussummary' => $union), '*')->group($columns[0]);
|
||||||
$this->joinedVirtualTables = array(
|
$this->joinedVirtualTables = array(
|
||||||
'servicestatussummary' => true,
|
'servicestatussummary' => true,
|
||||||
'hoststatussummary' => true
|
'hoststatussummary' => true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user