From a82c3a89144eba7c41ade2b1db01260cd92273f0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 13 Sep 2013 08:44:00 -0700 Subject: [PATCH] Allow Maniphest queries to have configurable page sizes Summary: Current page size is `1000`. This is nice to have in some cases, but makes pages slower than necessary in others. Task lists are generally dominated by rendering costs. For example, my default is "recent tasks", which just lists all tasks ordered by date created. Showing 100 tasks here instead of 1000 makes this several times faster without compromising utility. I don't want to force the default to 100, though, since sometimes listing everything is quite useful and I think an advantage of Maniphest is that it generally deals reasonably well with large task sets. (This `limit` property is actually read by the default implementation of `getPageSize()` in the parent class.) Test Plan: Made queries with page sizes 1, 100, 12, 9, 3000, etc. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6976 --- .../maniphest/query/ManiphestTaskSearchEngine.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index ed07eaaa35..e2a5ed795f 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -57,6 +57,11 @@ final class ManiphestTaskSearchEngine $saved->setParameter('createdStart', $request->getStr('createdStart')); $saved->setParameter('createdEnd', $request->getStr('createdEnd')); + $limit = $request->getInt('limit'); + if ($limit > 0) { + $saved->setParameter('limit', $limit); + } + return $saved; } @@ -310,6 +315,13 @@ final class ManiphestTaskSearchEngine pht('Created After'), 'createdEnd', pht('Created Before')); + + $form + ->appendChild( + id(new AphrontFormTextControl()) + ->setName('limit') + ->setLabel(pht('Page Size')) + ->setValue($saved->getParameter('limit', 100))); } protected function getURI($path) {