Skip to content

Commit b770237

Browse files
sukhwinder33445nilmerg
authored andcommitted
Icinga2Source: Extend allowed columns
1 parent 4eaa16f commit b770237

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

library/Icingadb/ProvidedHook/Notifications/V2/Icinga2Source.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Icinga\Module\Icingadb\ProvidedHook\Notifications\V2;
77

8+
use ArrayIterator;
89
use Icinga\Module\Icingadb\Common\Auth;
910
use Icinga\Module\Icingadb\Common\Database;
1011
use Icinga\Module\Icingadb\Data\QueryColumnsProvider;
@@ -37,10 +38,15 @@ class Icinga2Source implements SourceHook
3738
public function __construct()
3839
{
3940
$this->allowedColumns = [
41+
'object.type' => $this->translate('Object Type'),
4042
'host.name' => $this->translate('Host Name'),
43+
'host.display_name' => $this->translate('Host Display Name'),
4144
'hostgroup.name' => $this->translate('Hostgroup Name'),
45+
'hostgroup.display_name' => $this->translate('Hostgroup Display Name'),
4246
'service.name' => $this->translate('Service Name'),
43-
'servicegroup.name' => $this->translate('Servicegroup Name')
47+
'service.display_name' => $this->translate('Service Display Name'),
48+
'servicegroup.name' => $this->translate('Servicegroup Name'),
49+
'servicegroup.display_name' => $this->translate('Servicegroup Display Name')
4450
];
4551
}
4652

@@ -107,6 +113,13 @@ public function enrichCondition(Condition $condition): void
107113

108114
public function getValueSuggestions(string $column, string $searchTerm, Chain $searchFilter): Traversable
109115
{
116+
if ($column === 'object.type') {
117+
return new ArrayIterator([
118+
['search' => 'host'],
119+
['search' => 'service']
120+
]);
121+
}
122+
110123
return new QueryValuesProvider(
111124
Host::on($this->getDb())->limit(50),
112125
$column,

0 commit comments

Comments
 (0)