Skip to content

Commit

Permalink
Avoid using dynamic properties of Icinga\Web\View as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 authored and nilmerg committed Nov 4, 2024
1 parent 1125148 commit 22c3a55
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions application/controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,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 @@ -91,7 +91,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 22c3a55

Please sign in to comment.