Skip to content

Commit

Permalink
Controller::setupPaginationControl: Avoid using dynamic properties `I…
Browse files Browse the repository at this point in the history
…cinga\Web\View` as argument
  • Loading branch information
raviks789 committed Feb 21, 2024
1 parent d6881e0 commit 7e41616
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
6 changes: 4 additions & 2 deletions application/controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Exception;
use Icinga\Application\Version;
use Icinga\Data\SimpleQuery;
use InvalidArgumentException;
use Icinga\Application\Config;
use Icinga\Application\Icinga;
Expand Down Expand Up @@ -129,13 +130,14 @@ public function modulesAction()
'url' => 'config/modules'
))
->activate('modules');
$this->view->modules = Icinga::app()->getModuleManager()->select()
$modules = Icinga::app()->getModuleManager()->select()
->from('modules')
->order('enabled', 'desc')
->order('installed', 'asc')
->order('name');
$this->setupLimitControl();
$this->setupPaginationControl($this->view->modules);
$this->setupPaginationControl($modules);
$this->view->modules = $modules;
$this->view->title = $this->translate('Modules');
}

Expand Down
5 changes: 3 additions & 2 deletions application/controllers/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ public function applicationlogAction()
. 'T[0-9]{2}(?::[0-9]{2}){2}(?:[\+\-][0-9]{2}:[0-9]{2})?)' // time
. ' - (?<loglevel>[A-Za-z]+) - (?<message>.*)(?!.)/msS' // loglevel, message
)));
$this->view->logData = $resource->select()->order('DESC');
$logData = $resource->select()->order('DESC');

$this->setupLimitControl();
$this->setupPaginationControl($this->view->logData);
$this->setupPaginationControl($logData);
$this->view->logData = $logData;
$this->view->title = $this->translate('Application Log');
}
}
9 changes: 5 additions & 4 deletions application/controllers/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function indexAction()
public function listAction()
{
$this->createListTabs()->activate('role/list');
$this->view->roles = (new RolesConfig())
$roles = (new RolesConfig())
->select();

$sortAndFilterColumns = [
Expand All @@ -69,10 +69,11 @@ public function listAction()
'permissions' => $this->translate('Permissions')
];

$this->setupFilterControl($this->view->roles, $sortAndFilterColumns, ['name']);
$this->setupFilterControl($roles, $sortAndFilterColumns, ['name']);
$this->setupLimitControl();
$this->setupPaginationControl($this->view->roles);
$this->setupSortControl($sortAndFilterColumns, $this->view->roles, ['name']);
$this->setupPaginationControl($roles);
$this->setupSortControl($sortAndFilterColumns, $roles, ['name']);
$this->view->roles = $roles;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Icinga\Data\Filter\FilterEqual;
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
use Icinga\Module\Monitoring\Controller;
use Icinga\Module\Monitoring\DataView\DataView;
use Icinga\Security\SecurityException;
use Icinga\Web\Url;

Expand Down Expand Up @@ -91,7 +92,7 @@ public function contactAction()
$this->applyRestriction('monitoring/filter/objects', $notifications);
$this->view->notifications = $notifications;
$this->setupLimitControl();
$this->setupPaginationControl($this->view->notifications);
$this->setupPaginationControl($notifications);
$this->view->title = $contact->contact_name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ public function showAction()
public function historyAction()
{
$this->getTabs()->activate('history');
$this->view->history = $this->object->fetchEventhistory()->eventhistory;
$this->applyRestriction('monitoring/filter/objects', $this->view->history);
$history = $this->object->fetchEventhistory()->eventhistory;
$this->applyRestriction('monitoring/filter/objects', $history);

$this->setupLimitControl(50);
$this->setupPaginationControl($this->view->history, 50);
$this->setupPaginationControl($history, 50);
$this->view->history = $history;
$this->view->object = $this->object;
$this->render('object/detail-history', null, true);
}
Expand Down

0 comments on commit 7e41616

Please sign in to comment.