Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RedundancyGroupController: Add CSV/JSON export options #1119

Open
wants to merge 1 commit into
base: dependencies
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions application/controllers/RedundancygroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -47,7 +45,7 @@
$groupId = $this->params->shiftRequired('id');
}

$this->groupId = $groupId;

Check failure on line 48 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Property Icinga\Module\Icingadb\Controllers\RedundancygroupController::$groupId (string) does not accept mixed.

Check failure on line 48 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Property Icinga\Module\Icingadb\Controllers\RedundancygroupController::$groupId (string) does not accept mixed.
}

/**
Expand All @@ -61,7 +59,7 @@

$this->applyRestrictions($query);

$this->group = $query->first();

Check failure on line 62 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Property Icinga\Module\Icingadb\Controllers\RedundancygroupController::$group (Icinga\Module\Icingadb\Model\RedundancyGroup) does not accept ipl\Orm\Model|null.

Check failure on line 62 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Property Icinga\Module\Icingadb\Controllers\RedundancygroupController::$group (Icinga\Module\Icingadb\Model\RedundancyGroup) does not accept ipl\Orm\Model|null.

if ($this->group === null) {
$this->httpNotFound($this->translate('Redundancy Group not found'));
Expand All @@ -75,9 +73,9 @@

$this->applyRestrictions($summary);

$this->groupSummary = $summary->first();

Check failure on line 76 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Property Icinga\Module\Icingadb\Controllers\RedundancygroupController::$groupSummary (Icinga\Module\Icingadb\Model\RedundancyGroupSummary) does not accept ipl\Orm\Model|null.

Check failure on line 76 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Property Icinga\Module\Icingadb\Controllers\RedundancygroupController::$groupSummary (Icinga\Module\Icingadb\Model\RedundancyGroupSummary) does not accept ipl\Orm\Model|null.

$this->addControl(new RedundancyGroupHeader($this->group, $this->groupSummary));

Check failure on line 78 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #2 $summary of class Icinga\Module\Icingadb\Widget\Detail\RedundancyGroupHeader constructor expects Icinga\Module\Icingadb\Model\RedundancyGroupSummary, ipl\Orm\Model|null given.

Check failure on line 78 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #2 $summary of class Icinga\Module\Icingadb\Widget\Detail\RedundancyGroupHeader constructor expects Icinga\Module\Icingadb\Model\RedundancyGroupSummary, ipl\Orm\Model|null given.
}

public function indexAction(): void
Expand All @@ -96,7 +94,7 @@
$this->addContent(new RedundancyGroupDetail($this->group));
}

public function membersAction(): void
public function membersAction(): Generator
{
$this->loadGroup();
$nodesQuery = $this->fetchNodes(true);
Expand Down Expand Up @@ -138,6 +136,8 @@

$nodesQuery->filter($filter);

yield $this->export($nodesQuery);

$this->addControl($paginationControl);
$this->addControl($sortControl);
$this->addControl($limitControl);
Expand All @@ -156,7 +156,7 @@
$this->setAutorefreshInterval(10);
}

public function childrenAction(): void
public function childrenAction(): Generator
{
$this->loadGroup();
$nodesQuery = $this->fetchNodes();
Expand Down Expand Up @@ -186,7 +186,7 @@

$searchBar->getSuggestionUrl()->setParam('isChildrenTab');
$searchBar->getEditorUrl()
->setParams((clone $searchBar->getEditorUrl()->getParams())->set('isChildrenTab', true));

Check failure on line 189 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #2 $value of method Icinga\Web\UrlParams::set() expects string, true given.

Check failure on line 189 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #2 $value of method Icinga\Web\UrlParams::set() expects string, true given.

if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
if ($searchBar->hasBeenSubmitted()) {
Expand All @@ -202,6 +202,8 @@

$nodesQuery->filter($filter);

yield $this->export($nodesQuery);

$this->addControl($paginationControl);
$this->addControl($sortControl);
$this->addControl($limitControl);
Expand Down Expand Up @@ -252,7 +254,7 @@
);

if ($isChildrenTab) {
$editor->getSuggestionUrl()->setParam('isChildrenTab');

Check failure on line 257 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Cannot call method setParam() on ipl\Web\Url|null.

Check failure on line 257 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Cannot call method setParam() on ipl\Web\Url|null.
}

$this->getDocument()->add($editor);
Expand Down Expand Up @@ -319,7 +321,7 @@
return $query;
}

protected function fetchCommandTargets()

Check failure on line 324 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Method Icinga\Module\Icingadb\Controllers\RedundancygroupController::fetchCommandTargets() has no return type specified.

Check failure on line 324 in application/controllers/RedundancygroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Method Icinga\Module\Icingadb\Controllers\RedundancygroupController::fetchCommandTargets() has no return type specified.
{
$filter = Filter::all(Filter::equal('child.redundancy_group.id', $this->groupId));

Expand Down
Loading