From d6bbb4d57a086dfaf5f0a1ebf8913577568ae887 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 21 Apr 2020 18:16:36 +0200 Subject: [statistics] Refactor filter creation (Part 1) Filter classes are now instances of their respective classes, to move more logic into those classes. A bind method is used for assigning actual operator and argument values. renderFilterBox() is still a little too messy, maybe a clever class for mapping a (bound) filter to data for mustache will come in handy here. --- modules-available/statistics/pages/list.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules-available/statistics/pages/list.inc.php') diff --git a/modules-available/statistics/pages/list.inc.php b/modules-available/statistics/pages/list.inc.php index a709ab3d..7b8e8f5f 100644 --- a/modules-available/statistics/pages/list.inc.php +++ b/modules-available/statistics/pages/list.inc.php @@ -15,7 +15,6 @@ class SubPage $filters = StatisticsFilter::parseQuery(); $filterSet = new StatisticsFilterSet($filters); - $filterSet->setSort($sortColumn, $sortDirection); if (!$filterSet->setAllowedLocationsFromPermission('view.list')) { Message::addError('main.no-permission'); @@ -32,7 +31,7 @@ class SubPage private static function showMachineList($filterSet) { Module::isAvailable('js_stupidtable'); - $filterSet->makeFragments($where, $join, $sort, $args); + $filterSet->makeFragments($where, $join, $args); $xtra = ''; if ($filterSet->isNoId44Filter()) { $xtra .= ', data'; @@ -47,7 +46,7 @@ class SubPage m.logintime, m.state, m.currentuser, m.realcores, m.mbram, m.kvmstate, m.cpumodel, m.id44mb, m.hostname, m.notes IS NOT NULL AS hasnotes, m.badsectors, Count(s.machineuuid) AS confvars $xtra FROM machine m LEFT JOIN setting_machine s USING (machineuuid) - $join WHERE $where GROUP BY m.machineuuid $sort", $args); + $join WHERE $where GROUP BY m.machineuuid", $args); $rows = array(); $singleMachine = 'none'; // TODO: Cannot disable checkbox for those where user has no permission, since we got multiple actions now -- cgit v1.2.3-55-g7522