Skip to content

Commit

Permalink
Fix broken host and servicegroup quick search (#994)
Browse files Browse the repository at this point in the history
fixes #936
  • Loading branch information
nilmerg authored Mar 22, 2024
2 parents 8c13f5b + e04e6eb commit 1230fae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion library/Icingadb/Model/Hostgroupsummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/**
* @property string $id
* @property string $display_name
* @property string $name_ci
* @property string $name
* @property int $hosts_down_handled
* @property int $hosts_down_unhandled
Expand Down Expand Up @@ -75,6 +76,8 @@ public function getKeyName()
public function getColumns()
{
return [
'name' => 'hostgroup_name',
'name_ci' => 'hostgroup_name_ci',
'display_name' => 'hostgroup_display_name',
'hosts_down_handled' => new Expression(
'SUM(CASE WHEN host_state = 1'
Expand All @@ -94,7 +97,6 @@ public function getColumns()
'SUM(CASE WHEN host_state = 0 THEN 1 ELSE 0 END)'
),
'hosts_severity' => new Expression('MAX(host_severity)'),
'name' => 'hostgroup_name',
'services_critical_handled' => new Expression(
'SUM(CASE WHEN service_state = 2'
. ' AND (service_handled = \'y\' OR service_reachable = \'n\') THEN 1 ELSE 0 END)'
Expand Down Expand Up @@ -153,6 +155,7 @@ public function getUnions()
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => 'hostgroup.name',
'hostgroup_name_ci' => 'hostgroup.name_ci',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => 'host.id',
'host_state' => 'state.soft_state',
Expand All @@ -174,6 +177,7 @@ public function getUnions()
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => 'hostgroup.name',
'hostgroup_name_ci' => 'hostgroup.name_ci',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => new Expression('NULL'),
'host_state' => new Expression('NULL'),
Expand All @@ -192,6 +196,7 @@ public function getUnions()
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => 'hostgroup.name',
'hostgroup_name_ci' => 'hostgroup.name_ci',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => new Expression('NULL'),
'host_state' => new Expression('NULL'),
Expand Down
6 changes: 5 additions & 1 deletion library/Icingadb/Model/ServicegroupSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/**
* @property string $id
* @property string $display_name
* @property string $name_ci
* @property string $name
* @property int $services_critical_handled
* @property int $services_critical_unhandled
Expand Down Expand Up @@ -70,8 +71,9 @@ public function getKeyName()
public function getColumns()
{
return [
'display_name' => 'servicegroup_display_name',
'name' => 'servicegroup_name',
'name_ci' => 'servicegroup_name_ci',
'display_name' => 'servicegroup_display_name',
'services_critical_handled' => new Expression(
'SUM(CASE WHEN service_state = 2'
. ' AND (service_handled = \'y\' OR service_reachable = \'n\') THEN 1 ELSE 0 END)'
Expand Down Expand Up @@ -131,6 +133,7 @@ public function getUnions()
[
'servicegroup_id' => 'servicegroup.id',
'servicegroup_name' => 'servicegroup.name',
'servicegroup_name_ci' => 'servicegroup.name_ci',
'servicegroup_display_name' => 'servicegroup.display_name',
'service_id' => 'service.id',
'service_state' => 'state.soft_state',
Expand All @@ -145,6 +148,7 @@ public function getUnions()
[
'servicegroup_id' => 'servicegroup.id',
'servicegroup_name' => 'servicegroup.name',
'servicegroup_name_ci' => 'servicegroup.name_ci',
'servicegroup_display_name' => 'servicegroup.display_name',
'service_id' => new Expression('NULL'),
'service_state' => new Expression('NULL'),
Expand Down

0 comments on commit 1230fae

Please sign in to comment.