diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:45:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:45:00 +0000 |
commit | be4626482ba8761da39746a6ac60d133d3852a0f (patch) | |
tree | 45065832c85c4789237e94b3114360eac91d86f0 /application/forms/Command/Object/ProcessCheckResultForm.php | |
parent | Releasing progress-linux version 1.1.1-1~progress7.99u1. (diff) | |
download | icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.tar.xz icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.zip |
Merging upstream version 1.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/forms/Command/Object/ProcessCheckResultForm.php')
-rw-r--r-- | application/forms/Command/Object/ProcessCheckResultForm.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/application/forms/Command/Object/ProcessCheckResultForm.php b/application/forms/Command/Object/ProcessCheckResultForm.php index 5764bf8..7c612bf 100644 --- a/application/forms/Command/Object/ProcessCheckResultForm.php +++ b/application/forms/Command/Object/ProcessCheckResultForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Icingadb\Forms\Command\Object; -use Generator; +use CallbackFilterIterator; use Icinga\Module\Icingadb\Command\Object\ProcessCheckResultCommand; use Icinga\Module\Icingadb\Forms\Command\CommandForm; use Icinga\Module\Icingadb\Model\Host; @@ -15,6 +15,7 @@ use ipl\Html\Text; use ipl\Orm\Model; use ipl\Web\FormDecorator\IcingaFormDecorator; use ipl\Web\Widget\Icon; +use Iterator; use Traversable; use function ipl\Stdlib\iterable_value_first; @@ -133,16 +134,14 @@ class ProcessCheckResultForm extends CommandForm (new IcingaFormDecorator())->decorate($this->getElement('btn_submit')); } - protected function getCommands(Traversable $objects): Traversable + protected function getCommands(Iterator $objects): Traversable { - $granted = (function () use ($objects): Generator { - foreach ($this->filterGrantedOn('icingadb/command/process-check-result', $objects) as $object) { - if ($object->passive_checks_enabled) { - yield $object; - } - } - })(); + $granted = new CallbackFilterIterator($objects, function (Model $object): bool { + return $object->passive_checks_enabled + && $this->isGrantedOn('icingadb/command/process-check-result', $object); + }); + $granted->rewind(); // Forwards the pointer to the first element if ($granted->valid()) { $command = new ProcessCheckResultCommand(); $command->setObjects($granted); |