From 241fda1196bdc8f5a4d5a7e775776026d094037a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 2 Apr 2014 12:18:47 +0200 Subject: [PATCH] Small cleanup --- application/controllers/ListController.php | 75 ---------------------- library/Icinga/Protocol/File/Query.php | 2 + library/Icinga/Protocol/File/Reader.php | 2 + 3 files changed, 4 insertions(+), 75 deletions(-) diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index eb4026739..bec0c04fc 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -30,69 +30,12 @@ use Icinga\Module\Monitoring\Controller; use Icinga\Web\Hook; -use Icinga\Web\Widget\Tabextension\DashboardAction; -use Icinga\Web\Widget\Tabextension\OutputFormat; -use Icinga\Web\Widget\Tabs; -use Icinga\Module\Monitoring\Backend; use Icinga\Application\Config as IcingaConfig; - -use Icinga\Filter\Filterable; use Icinga\Web\Url; use Icinga\Data\ResourceFactory; class ListController extends Controller { - /** - * The backend used for this controller - * - * @var Backend - */ - protected $backend; - /** - * Retrieve backend and hooks for this controller - * - * @see ActionController::init - */ - public function init() - { - $this->backend = Backend::createBackend($this->_getParam('backend')); - $this->view->grapher = Hook::get('grapher'); - $this->createTabs(); - $this->view->activeRowHref = $this->getParam('detail'); - $this->view->compact = ($this->_request->getParam('view') === 'compact'); - } - - /** - * Overwrite the backend to use (used for testing) - * - * @param Backend $backend The Backend that should be used for querying - */ - public function setBackend($backend) - { - $this->backend = $backend; - } - - /** - * Apply current users monitoring/filter restrictions to the given query - * - * @param $query Filterable Query that should be filtered - * @return Filterable - */ - protected function applyRestrictions(Filterable $query) - { - foreach ($this->getRestrictions('monitoring/filter') as $restriction) { - parse_str($restriction, $filter); - foreach ($filter as $k => $v) { - if ($query->isValidFilterTarget($k)) { - // TODO: This is NOT enough. We need to fix filters and get - // applyAuthFilters back. - $query->where($k, $v); - } - } - } - return $query; - } - protected function addTitleTab($action) { $this->getTabs()->add($action, array( @@ -101,24 +44,6 @@ class ListController extends Controller ))->activate($action); } - /** - * Return all tabs for this controller - * - * @return Tabs - */ - private function createTabs() - { - $tabs = $this->getTabs(); - if (in_array($this->_request->getActionName(), array( - 'hosts', - 'services', - 'eventhistory', - 'notifications' - ))) { - $tabs->extend(new OutputFormat())->extend(new DashboardAction()); - } - } - public function applicationlogAction() { $this->addTitleTab('application log'); diff --git a/library/Icinga/Protocol/File/Query.php b/library/Icinga/Protocol/File/Query.php index 12150efda..98aa838e0 100644 --- a/library/Icinga/Protocol/File/Query.php +++ b/library/Icinga/Protocol/File/Query.php @@ -1,4 +1,6 @@