mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-06-11 01:29:59 -04:00
UnreachableParent: Eliminate duplicate nodes
Nodes might be referenced by multiple independent paths, which might lead to the same root problem multiple times.
This commit is contained in:
parent
02ff5d8ea8
commit
e5b499bbdb
3 changed files with 26 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
namespace Icinga\Module\Icingadb\Model;
|
||||
|
||||
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
|
||||
use Icinga\Module\Icingadb\Model\UnreachableParent\ResultSet;
|
||||
use InvalidArgumentException;
|
||||
use ipl\Orm\Behavior\Binary;
|
||||
use ipl\Orm\Behaviors;
|
||||
|
|
@ -112,6 +113,8 @@ class UnreachableParent extends DependencyNode
|
|||
)
|
||||
));
|
||||
|
||||
$query->setResultSetClass(ResultSet::class);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
|
|
|||
23
library/Icingadb/Model/UnreachableParent/ResultSet.php
Normal file
23
library/Icingadb/Model/UnreachableParent/ResultSet.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Icingadb\Model\UnreachableParent;
|
||||
|
||||
use Icinga\Module\Icingadb\Redis\VolatileStateResults;
|
||||
use Traversable;
|
||||
|
||||
class ResultSet extends VolatileStateResults
|
||||
{
|
||||
protected function yieldTraversable(Traversable $traversable)
|
||||
{
|
||||
$knownIds = [];
|
||||
foreach ($traversable as $value) {
|
||||
if (isset($knownIds[$value->id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$knownIds[$value->id] = true;
|
||||
|
||||
yield $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -655,7 +655,6 @@ class ObjectDetail extends BaseHtmlElement
|
|||
'service.host',
|
||||
'service.host.state'
|
||||
])
|
||||
->setResultSetClass(VolatileStateResults::class)
|
||||
->orderBy([
|
||||
'host.state.severity',
|
||||
'host.state.last_state_change',
|
||||
|
|
|
|||
Loading…
Reference in a new issue