diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php index 5b2a7547a..ef99f8c98 100644 --- a/application/controllers/HostController.php +++ b/application/controllers/HostController.php @@ -38,6 +38,7 @@ use ipl\Web\Control\SortControl; use ipl\Web\Url; use ipl\Web\Widget\Tabs; +use Generator; class HostController extends Controller { @@ -114,7 +115,7 @@ public function sourceAction(): void )); } - public function historyAction(): \Generator + public function historyAction(): Generator { $compact = $this->view->compact; // TODO: Find a less-legacy way.. @@ -185,7 +186,7 @@ public function historyAction(): \Generator } } - public function servicesAction(): \Generator + public function servicesAction(): Generator { if ($this->host->state->is_overdue) { $this->controls->addAttributes(['class' => 'overdue']); @@ -234,7 +235,7 @@ public function servicesAction(): \Generator $this->setAutorefreshInterval(10); } - public function parentsAction(): void + public function parentsAction(): Generator { $nodesQuery = $this->fetchNodes(true); @@ -276,6 +277,8 @@ public function parentsAction(): void $nodesQuery->filter($filter); + yield $this->export($nodesQuery); + $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); @@ -294,7 +297,7 @@ public function parentsAction(): void $this->setAutorefreshInterval(10); } - public function childrenAction(): void + public function childrenAction(): Generator { $nodesQuery = $this->fetchNodes(); @@ -339,6 +342,8 @@ public function childrenAction(): void $nodesQuery->filter($filter); + yield $this->export($nodesQuery); + $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index b43ebdb8a..64aae9694 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -33,6 +33,7 @@ use ipl\Web\Control\SortControl; use ipl\Web\Url; use ipl\Web\Widget\Tabs; +use Generator; class ServiceController extends Controller { @@ -104,7 +105,7 @@ public function indexAction(): void $this->setAutorefreshInterval(10); } - public function parentsAction(): void + public function parentsAction(): Generator { $nodesQuery = $this->fetchNodes(true); @@ -147,6 +148,8 @@ public function parentsAction(): void $nodesQuery->filter($filter); + yield $this->export($nodesQuery); + $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); @@ -165,7 +168,7 @@ public function parentsAction(): void $this->setAutorefreshInterval(10); } - public function childrenAction(): void + public function childrenAction(): Generator { $nodesQuery = $this->fetchNodes(); @@ -211,6 +214,8 @@ public function childrenAction(): void $nodesQuery->filter($filter); + yield $this->export($nodesQuery); + $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); @@ -248,7 +253,7 @@ public function sourceAction(): void )); } - public function historyAction(): \Generator + public function historyAction(): Generator { $compact = $this->view->compact; // TODO: Find a less-legacy way.. diff --git a/library/Icingadb/Data/CsvResultSetUtils.php b/library/Icingadb/Data/CsvResultSetUtils.php index 61995d3a2..862260cc8 100644 --- a/library/Icingadb/Data/CsvResultSetUtils.php +++ b/library/Icingadb/Data/CsvResultSetUtils.php @@ -6,6 +6,7 @@ use DateTime; use DateTimeZone; +use Icinga\Module\Icingadb\Model\DependencyNode; use Icinga\Module\Icingadb\Model\Host; use Icinga\Module\Icingadb\Model\Service; use ipl\Orm\Model; @@ -67,7 +68,8 @@ protected function extractKeysAndValues(Model $model, string $path = ''): array public static function stream(Query $query): void { - if ($query->getModel() instanceof Host || $query->getModel() instanceof Service) { + $model = $query->getModel(); + if ($model instanceof Host || $model instanceof Service || $model instanceof DependencyNode) { $query->setResultSetClass(VolatileCsvResults::class); } else { $query->setResultSetClass(__CLASS__); diff --git a/library/Icingadb/Data/JsonResultSetUtils.php b/library/Icingadb/Data/JsonResultSetUtils.php index 8b8857122..dc78fe094 100644 --- a/library/Icingadb/Data/JsonResultSetUtils.php +++ b/library/Icingadb/Data/JsonResultSetUtils.php @@ -6,6 +6,7 @@ use DateTime; use DateTimeZone; +use Icinga\Module\Icingadb\Model\DependencyNode; use Icinga\Module\Icingadb\Model\Host; use Icinga\Module\Icingadb\Model\Service; use Icinga\Util\Json; @@ -61,7 +62,8 @@ protected function createObject(Model $model): array public static function stream(Query $query): void { - if ($query->getModel() instanceof Host || $query->getModel() instanceof Service) { + $model = $query->getModel(); + if ($model instanceof Host || $model instanceof Service || $model instanceof DependencyNode) { $query->setResultSetClass(VolatileJsonResults::class); } else { $query->setResultSetClass(__CLASS__);