Skip to content

Commit 3a0fa1e

Browse files
Add relation labels to suggestions
1 parent a028670 commit 3a0fa1e

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

library/Notifications/Hook/V2/SourceHook.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,13 @@ public function getValueSuggestions(string $column, string $searchTerm, Chain $s
7979
* @return Traversable Columns to be suggested as `search` => `label`
8080
*/
8181
public function getColumnSuggestions(string $searchTerm): Traversable;
82+
83+
/**
84+
* Get whether a relation label should be added to the suggestion
85+
*
86+
* @param string $column
87+
*
88+
* @return bool
89+
*/
90+
public function shouldShowRelationFor(string $column): bool;
8291
}

library/Notifications/Web/Control/SearchEditor/RuleFilterSuggestions.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55

66
namespace Icinga\Module\Notifications\Web\Control\SearchEditor;
77

8-
use Generator;
98
use Icinga\Module\Notifications\Hook\V2\SourceHook;
109
use ipl\Html\HtmlElement;
1110
use ipl\Stdlib\Filter;
1211
use ipl\Web\Control\SearchBar\Suggestions;
13-
use Psr\Http\Message\ServerRequestInterface;
1412
use Traversable;
1513

1614
/**
@@ -37,6 +35,11 @@ protected function fetchValueSuggestions($column, $searchTerm, Filter\Chain $sea
3735
yield from $this->hook->getValueSuggestions($column, $searchTerm, $searchFilter);
3836
}
3937

38+
protected function shouldShowRelationFor(string $column): bool
39+
{
40+
return $this->hook->shouldShowRelationFor($column);
41+
}
42+
4043
protected function fetchColumnSuggestions($searchTerm): Traversable
4144
{
4245
$currentGroup = null;

0 commit comments

Comments
 (0)