mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Add csv/json export support for parents and children tab
This commit is contained in:
parent
18ba5a3dfb
commit
cda2f4bb05
4 changed files with 23 additions and 9 deletions
|
|
@ -38,6 +38,7 @@ use ipl\Web\Control\LimitControl;
|
|||
use ipl\Web\Control\SortControl;
|
||||
use ipl\Web\Url;
|
||||
use ipl\Web\Widget\Tabs;
|
||||
use Generator;
|
||||
|
||||
class HostController extends Controller
|
||||
{
|
||||
|
|
@ -114,7 +115,7 @@ class HostController extends Controller
|
|||
));
|
||||
}
|
||||
|
||||
public function historyAction(): \Generator
|
||||
public function historyAction(): Generator
|
||||
{
|
||||
$compact = $this->view->compact; // TODO: Find a less-legacy way..
|
||||
|
||||
|
|
@ -185,7 +186,7 @@ class HostController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function servicesAction(): \Generator
|
||||
public function servicesAction(): Generator
|
||||
{
|
||||
if ($this->host->state->is_overdue) {
|
||||
$this->controls->addAttributes(['class' => 'overdue']);
|
||||
|
|
@ -234,7 +235,7 @@ class HostController extends Controller
|
|||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
||||
public function parentsAction(): void
|
||||
public function parentsAction(): Generator
|
||||
{
|
||||
$nodesQuery = $this->fetchNodes(true);
|
||||
|
||||
|
|
@ -276,6 +277,8 @@ class HostController extends Controller
|
|||
|
||||
$nodesQuery->filter($filter);
|
||||
|
||||
yield $this->export($nodesQuery);
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
$this->addControl($sortControl);
|
||||
$this->addControl($limitControl);
|
||||
|
|
@ -294,7 +297,7 @@ class HostController extends Controller
|
|||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
||||
public function childrenAction(): void
|
||||
public function childrenAction(): Generator
|
||||
{
|
||||
$nodesQuery = $this->fetchNodes();
|
||||
|
||||
|
|
@ -339,6 +342,8 @@ class HostController extends Controller
|
|||
|
||||
$nodesQuery->filter($filter);
|
||||
|
||||
yield $this->export($nodesQuery);
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
$this->addControl($sortControl);
|
||||
$this->addControl($limitControl);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use ipl\Web\Control\LimitControl;
|
|||
use ipl\Web\Control\SortControl;
|
||||
use ipl\Web\Url;
|
||||
use ipl\Web\Widget\Tabs;
|
||||
use Generator;
|
||||
|
||||
class ServiceController extends Controller
|
||||
{
|
||||
|
|
@ -105,7 +106,7 @@ class ServiceController extends Controller
|
|||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
||||
public function parentsAction(): void
|
||||
public function parentsAction(): Generator
|
||||
{
|
||||
$nodesQuery = $this->fetchNodes(true);
|
||||
|
||||
|
|
@ -148,6 +149,8 @@ class ServiceController extends Controller
|
|||
|
||||
$nodesQuery->filter($filter);
|
||||
|
||||
yield $this->export($nodesQuery);
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
$this->addControl($sortControl);
|
||||
$this->addControl($limitControl);
|
||||
|
|
@ -166,7 +169,7 @@ class ServiceController extends Controller
|
|||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
||||
public function childrenAction(): void
|
||||
public function childrenAction(): Generator
|
||||
{
|
||||
$nodesQuery = $this->fetchNodes();
|
||||
|
||||
|
|
@ -212,6 +215,8 @@ class ServiceController extends Controller
|
|||
|
||||
$nodesQuery->filter($filter);
|
||||
|
||||
yield $this->export($nodesQuery);
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
$this->addControl($sortControl);
|
||||
$this->addControl($limitControl);
|
||||
|
|
@ -249,7 +254,7 @@ class ServiceController extends Controller
|
|||
));
|
||||
}
|
||||
|
||||
public function historyAction(): \Generator
|
||||
public function historyAction(): Generator
|
||||
{
|
||||
$compact = $this->view->compact; // TODO: Find a less-legacy way..
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Icinga\Module\Icingadb\Data;
|
|||
|
||||
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 @@ trait CsvResultSetUtils
|
|||
|
||||
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__);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Icinga\Module\Icingadb\Data;
|
|||
|
||||
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 @@ trait JsonResultSetUtils
|
|||
|
||||
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__);
|
||||
|
|
|
|||
Loading…
Reference in a new issue