mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Add "group" to Maniphest "pro" search
Summary: This is the last missing filter. Test Plan: Grouped results by a bunch of stuff. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6960
This commit is contained in:
parent
926b47ef70
commit
9b3520ea57
1 changed files with 36 additions and 1 deletions
|
@ -18,6 +18,7 @@ final class ManiphestTaskSearchEngine
|
|||
|
||||
$saved->setParameter('statuses', $request->getArr('statuses'));
|
||||
$saved->setParameter('priorities', $request->getArr('priorities'));
|
||||
$saved->setParameter('group', $request->getStr('group'));
|
||||
$saved->setParameter('order', $request->getStr('order'));
|
||||
|
||||
$ids = $request->getStrList('ids');
|
||||
|
@ -95,6 +96,14 @@ final class ManiphestTaskSearchEngine
|
|||
$query->setOrderBy(head($this->getOrderValues()));
|
||||
}
|
||||
|
||||
$group = $saved->getParameter('group');
|
||||
$group = idx($this->getGroupValues(), $group);
|
||||
if ($group) {
|
||||
$query->setGroupBy($group);
|
||||
} else {
|
||||
$query->setGroupBy(head($this->getGroupValues()));
|
||||
}
|
||||
|
||||
$ids = $saved->getParameter('ids');
|
||||
if ($ids) {
|
||||
$query->withIDs($ids);
|
||||
|
@ -271,10 +280,16 @@ final class ManiphestTaskSearchEngine
|
|||
->setValue($author_handles))
|
||||
->appendChild($status_control)
|
||||
->appendChild($priority_control)
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setName('group')
|
||||
->setLabel(pht('Group By'))
|
||||
->setValue($saved->getParameter('group'))
|
||||
->setOptions($this->getGroupOptions()))
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setName('order')
|
||||
->setLabel(pht('Order'))
|
||||
->setLabel(pht('Order By'))
|
||||
->setValue($saved->getParameter('order'))
|
||||
->setOptions($this->getOrderOptions()))
|
||||
->appendChild(
|
||||
|
@ -358,4 +373,24 @@ final class ManiphestTaskSearchEngine
|
|||
);
|
||||
}
|
||||
|
||||
private function getGroupOptions() {
|
||||
return array(
|
||||
'priority' => pht('Priority'),
|
||||
'assigned' => pht('Assigned'),
|
||||
'status' => pht('Status'),
|
||||
'project' => pht('Project'),
|
||||
'none' => pht('None'),
|
||||
);
|
||||
}
|
||||
|
||||
private function getGroupValues() {
|
||||
return array(
|
||||
'priority' => ManiphestTaskQuery::GROUP_PRIORITY,
|
||||
'assigned' => ManiphestTaskQuery::GROUP_OWNER,
|
||||
'status' => ManiphestTaskQuery::GROUP_STATUS,
|
||||
'project' => ManiphestTaskQuery::GROUP_PROJECT,
|
||||
'none' => ManiphestTaskQuery::GROUP_NONE,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue