From dea28f850e508c7b35c69cfda799bf0c9f8e2a6d Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Thu, 9 Jan 2025 12:40:23 +0100 Subject: [PATCH] RedundancygroupController: Add CSV/JSON export option for `members & children` tab --- .../controllers/RedundancygroupController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/application/controllers/RedundancygroupController.php b/application/controllers/RedundancygroupController.php index 9e0c65fb0..5c409d8d4 100644 --- a/application/controllers/RedundancygroupController.php +++ b/application/controllers/RedundancygroupController.php @@ -4,7 +4,6 @@ namespace Icinga\Module\Icingadb\Controllers; -use Icinga\Exception\NotFoundError; use Icinga\Module\Icingadb\Common\CommandActions; use Icinga\Module\Icingadb\Data\DependencyNodes; use Icinga\Module\Icingadb\Model\DependencyNode; @@ -17,8 +16,7 @@ use Icinga\Module\Icingadb\Widget\Detail\RedundancyGroupDetail; use Icinga\Module\Icingadb\Widget\Detail\RedundancyGroupHeader; use Icinga\Module\Icingadb\Widget\ItemList\DependencyNodeList; -use ipl\Html\HtmlElement; -use ipl\Html\Text; +use Generator; use ipl\Orm\Query; use ipl\Stdlib\Filter; use ipl\Web\Control\LimitControl; @@ -96,7 +94,7 @@ public function indexAction(): void $this->addContent(new RedundancyGroupDetail($this->group)); } - public function membersAction(): void + public function membersAction(): Generator { $this->loadGroup(); $nodesQuery = $this->fetchNodes(true); @@ -138,6 +136,8 @@ public function membersAction(): void $nodesQuery->filter($filter); + yield $this->export($nodesQuery); + $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); @@ -156,7 +156,7 @@ public function membersAction(): void $this->setAutorefreshInterval(10); } - public function childrenAction(): void + public function childrenAction(): Generator { $this->loadGroup(); $nodesQuery = $this->fetchNodes(); @@ -202,6 +202,8 @@ public function childrenAction(): void $nodesQuery->filter($filter); + yield $this->export($nodesQuery); + $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl);