Skip to content
Browse files

Expose "withAnyProjects()" in the UI

Summary:
Add an "Any Projects" field to the custom search UI.

This is starting to get ugly but we'll do a design pass on it before toooo long.

Test Plan: {F20423}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1610

Differential Revision: https://secure.phabricator.com/D3632
  • Loading branch information...
1 parent 5cbc4fe commit 5578ccdff27b881f8874e0d182ef89628cd92a59 @epriestley epriestley committed
Showing with 28 additions and 2 deletions.
  1. +28 −2 src/applications/maniphest/controller/ManiphestTaskListController.php
View
30 src/applications/maniphest/controller/ManiphestTaskListController.php
@@ -58,6 +58,7 @@ public function processRequest() {
$uri = $request->getRequestURI()
->alter('users', $this->getArrToStrList('set_users'))
->alter('projects', $this->getArrToStrList('set_projects'))
+ ->alter('aprojects', $this->getArrToStrList('set_aprojects'))
->alter('xprojects', $this->getArrToStrList('set_xprojects'))
->alter('owners', $this->getArrToStrList('set_owners'))
->alter('authors', $this->getArrToStrList('set_authors'))
@@ -118,6 +119,9 @@ public function processRequest() {
$owner_phids = $query->getParameter('ownerPHIDs', array());
$author_phids = $query->getParameter('authorPHIDs', array());
$project_phids = $query->getParameter('projectPHIDs', array());
+ $any_project_phids = $query->getParameter(
+ 'anyProjectPHIDs',
+ array());
$exclude_project_phids = $query->getParameter(
'excludeProjectPHIDs',
array());
@@ -201,15 +205,34 @@ public function processRequest() {
$tokens[$phid] = $handles[$phid]->getFullName();
}
if ($this->view != 'projectall' && $this->view != 'projecttriage') {
+
+ $caption = null;
+ if ($this->view == 'custom') {
+ $caption = 'Find tasks in ALL of these projects ("AND" query).';
+ }
+
$form->appendChild(
id(new AphrontFormTokenizerControl())
->setDatasource('/typeahead/common/searchproject/')
->setName('set_projects')
->setLabel('Projects')
+ ->setCaption($caption)
->setValue($tokens));
}
if ($this->view == 'custom') {
+ $atokens = array();
+ foreach ($any_project_phids as $phid) {
+ $atokens[$phid] = $handles[$phid]->getFullName();
+ }
+ $form->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource('/typeahead/common/projects/')
+ ->setName('set_aprojects')
+ ->setLabel('Any Projects')
+ ->setCaption('Find tasks in ANY of these projects ("OR" query).')
+ ->setValue($atokens));
+
$tokens = array();
foreach ($exclude_project_phids as $phid) {
$tokens[$phid] = $handles[$phid]->getFullName();
@@ -219,6 +242,7 @@ public function processRequest() {
->setDatasource('/typeahead/common/projects/')
->setName('set_xprojects')
->setLabel('Exclude Projects')
+ ->setCaption('Find tasks NOT in any of these projects.')
->setValue($tokens));
$priority = ManiphestTaskPriority::getLowestPriority();
@@ -435,6 +459,10 @@ public static function loadTasks(PhabricatorSearchQuery $search_query) {
$query->withoutProjects($xproject_phids);
}
+ if ($any_project_phids) {
+ $query->withAnyProjects($any_project_phids);
+ }
+
if ($owner_phids) {
$query->withOwners($owner_phids);
}
@@ -473,10 +501,8 @@ public static function loadTasks(PhabricatorSearchQuery $search_query) {
break;
case 'projecttriage':
$query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
- $query->withAnyProjects($any_project_phids);
break;
case 'projectall':
- $query->withAnyProjects($any_project_phids);
break;
case 'custom':
$query->withPrioritiesBetween($low_priority, $high_priority);

0 comments on commit 5578ccd

Please sign in to comment.
Something went wrong with that request. Please try again.