GroupsummaryQuery: Provide case insensitive filter columns for group names

I've renamed those and made them case sensitive as part of #8613 but
missed that they are required by the global search.

fixes #9056
This commit is contained in:
Johannes Meyer 2015-04-14 12:44:24 +02:00
parent 2618d4a468
commit 923bc11b39
3 changed files with 14 additions and 3 deletions

View File

@ -20,7 +20,8 @@ class GroupSummaryQuery extends IdoQuery
'hosts_down_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)', 'hosts_down_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
'hosts_pending' => 'SUM(CASE WHEN object_type = \'host\' AND state = 99 THEN 1 ELSE 0 END)', 'hosts_pending' => 'SUM(CASE WHEN object_type = \'host\' AND state = 99 THEN 1 ELSE 0 END)',
'hostgroup_name' => 'hostgroup_name', 'hostgroup_name' => 'hostgroup_name',
'hostgroup_alias' => 'hostgroup_alias' 'hostgroup_alias' => 'hostgroup_alias',
'hostgroup' => 'hostgroup'
), ),
'servicestatussummary' => array( 'servicestatussummary' => array(
'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)', 'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)',
@ -45,7 +46,8 @@ class GroupSummaryQuery extends IdoQuery
'services_critical_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)', 'services_critical_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 2 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
'services_unknown_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)', 'services_unknown_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'service\' AND state = 3 AND acknowledged + in_downtime + host_state = 0 THEN state_change ELSE 0 END)',
'servicegroup_name' => 'servicegroup_name', 'servicegroup_name' => 'servicegroup_name',
'servicegroup_alias' => 'servicegroup_alias' 'servicegroup_alias' => 'servicegroup_alias',
'servicegroup' => 'servicegroup'
) )
); );
@ -56,11 +58,13 @@ class GroupSummaryQuery extends IdoQuery
'host_state' 'host_state'
); );
if (in_array('servicegroup_name', $this->desiredColumns)) { if (in_array('servicegroup', $this->desiredColumns) || in_array('servicegroup_name', $this->desiredColumns)) {
$columns[] = 'servicegroup';
$columns[] = 'servicegroup_name'; $columns[] = 'servicegroup_name';
$columns[] = 'servicegroup_alias'; $columns[] = 'servicegroup_alias';
$groupColumns = array('servicegroup_name', 'servicegroup_alias'); $groupColumns = array('servicegroup_name', 'servicegroup_alias');
} else { } else {
$columns[] = 'hostgroup';
$columns[] = 'hostgroup_name'; $columns[] = 'hostgroup_name';
$columns[] = 'hostgroup_alias'; $columns[] = 'hostgroup_alias';
$groupColumns = array('hostgroup_name', 'hostgroup_alias'); $groupColumns = array('hostgroup_name', 'hostgroup_alias');

View File

@ -83,10 +83,12 @@ class HoststatusQuery extends IdoQuery
END' END'
), ),
'hostgroups' => array( 'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_name' => 'hgo.name1', 'hostgroup_name' => 'hgo.name1',
'hostgroup_alias' => 'hg.alias' 'hostgroup_alias' => 'hg.alias'
), ),
'servicegroups' => array( 'servicegroups' => array(
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
'servicegroup_name' => 'sgo.name1', 'servicegroup_name' => 'sgo.name1',
'servicegroup_alias' => 'sg.alias' 'servicegroup_alias' => 'sg.alias'
), ),

View File

@ -58,4 +58,9 @@ class Groupsummary extends DataView
) )
); );
} }
public function getFilterColumns()
{
return array('hostgroup', 'servicegroup');
}
} }