Revert "monitoring: Add DataView::$requiresFilter"

This reverts commit e9c7a5894a.
This commit is contained in:
Eric Lippmann 2015-09-07 13:19:28 +02:00
parent 0f8c28d749
commit 0abd2afb0e
1 changed files with 1 additions and 37 deletions

View File

@ -11,7 +11,6 @@ use Icinga\Data\FilterColumns;
use Icinga\Data\PivotTable; use Icinga\Data\PivotTable;
use Icinga\Data\QueryInterface; use Icinga\Data\QueryInterface;
use Icinga\Data\SortRules; use Icinga\Data\SortRules;
use Icinga\Exception\Http\HttpBadRequestException;
use Icinga\Exception\QueryException; use Icinga\Exception\QueryException;
use Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery; use Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery;
use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Backend\MonitoringBackend;
@ -41,13 +40,6 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
*/ */
protected $filterColumns; protected $filterColumns;
/**
* Whether the data view requires a filter
*
* @var bool
*/
protected $requiresFilter = false;
/** /**
* Create a new view * Create a new view
* *
@ -196,29 +188,6 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
return in_array($column, $this->getFilterColumns()); return in_array($column, $this->getFilterColumns());
} }
/**
* Get whether the data view requires a filter
*
* @return bool
*/
public function getRequiresFilter()
{
return $this->requiresFilter;
}
/**
* Set whether the data view requires a filter
*
* @param bool $requiresFilter
*
* @return $this
*/
public function setRequiresFilter($requiresFilter = true)
{
$this->requiresFilter = (bool) $requiresFilter;
return $this;
}
/** /**
* Return all filter columns with their optional label as key * Return all filter columns with their optional label as key
* *
@ -669,12 +638,7 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
public function handleRequest(Request $request) public function handleRequest(Request $request)
{ {
$params = $request->getUrl()->getParams(); $params = $request->getUrl()->getParams();
$filter = Filter::fromQuerystring((string) $params); $this->applyFilter(Filter::fromQuerystring((string) $params));
/** @var Filter $filter */
if ($this->getRequiresFilter() && $filter->isEmpty()) {
throw new HttpBadRequestException('Filter must not be empty');
}
$this->applyFilter($filter);
return $this; return $this;
} }
} }