@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Modernize "build plans" typeahead datasource

Summary: Ref T4420. Modernize build plans.

Test Plan:
- Used build plan typeahead in Harbormaster.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4420

Differential Revision: https://secure.phabricator.com/D9878

+42 -18
+2
src/__phutil_library_map__.php
··· 729 729 'HarbormasterBuildMessage' => 'applications/harbormaster/storage/HarbormasterBuildMessage.php', 730 730 'HarbormasterBuildMessageQuery' => 'applications/harbormaster/query/HarbormasterBuildMessageQuery.php', 731 731 'HarbormasterBuildPlan' => 'applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php', 732 + 'HarbormasterBuildPlanDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildPlanDatasource.php', 732 733 'HarbormasterBuildPlanEditor' => 'applications/harbormaster/editor/HarbormasterBuildPlanEditor.php', 733 734 'HarbormasterBuildPlanQuery' => 'applications/harbormaster/query/HarbormasterBuildPlanQuery.php', 734 735 'HarbormasterBuildPlanSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php', ··· 3470 3471 1 => 'PhabricatorPolicyInterface', 3471 3472 2 => 'PhabricatorSubscribableInterface', 3472 3473 ), 3474 + 'HarbormasterBuildPlanDatasource' => 'PhabricatorTypeaheadDatasource', 3473 3475 'HarbormasterBuildPlanEditor' => 'PhabricatorApplicationTransactionEditor', 3474 3476 'HarbormasterBuildPlanQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 3475 3477 'HarbormasterBuildPlanSearchEngine' => 'PhabricatorApplicationSearchEngine',
+7 -2
src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php
··· 12 12 return pht('Build Plan'); 13 13 } 14 14 15 + public function getTypeIcon() { 16 + return 'fa-cubes'; 17 + } 18 + 15 19 public function newObject() { 16 20 return new HarbormasterBuildPlan(); 17 21 } ··· 31 35 32 36 foreach ($handles as $phid => $handle) { 33 37 $build_plan = $objects[$phid]; 34 - $handles[$phid]->setName($build_plan->getName()); 35 - $handles[$phid]->setURI('/harbormaster/plan/'.$build_plan->getID()); 38 + $id = $build_plan->getID(); 39 + $handles[$phid]->setName(pht('Plan %d %s', $id, $build_plan->getName())); 40 + $handles[$phid]->setURI('/harbormaster/plan/'.$id.'/'); 36 41 } 37 42 } 38 43
+32
src/applications/harbormaster/typeahead/HarbormasterBuildPlanDatasource.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildPlanDatasource 4 + extends PhabricatorTypeaheadDatasource { 5 + 6 + public function getPlaceholderText() { 7 + return pht('Type a build plan name...'); 8 + } 9 + 10 + public function getDatasourceApplicationClass() { 11 + return 'PhabricatorApplicationHarbormaster'; 12 + } 13 + 14 + public function loadResults() { 15 + $viewer = $this->getViewer(); 16 + $raw_query = $this->getRawQuery(); 17 + 18 + $results = array(); 19 + 20 + $plans = id(new HarbormasterBuildPlanQuery()) 21 + ->setViewer($viewer) 22 + ->execute(); 23 + foreach ($plans as $plan) { 24 + $results[] = id(new PhabricatorTypeaheadResult()) 25 + ->setName($plan->getName()) 26 + ->setPHID($plan->getPHID()); 27 + } 28 + 29 + return $results; 30 + } 31 + 32 + }
+1 -1
src/applications/herald/controller/HeraldRuleController.php
··· 592 592 'repository' => new DiffusionRepositoryDatasource(), 593 593 'legaldocuments' => new LegalpadDocumentDatasource(), 594 594 'taskpriority' => new ManiphestTaskPriorityDatasource(), 595 + 'buildplan' => new HarbormasterBuildPlanDatasource(), 595 596 ); 596 597 597 598 $sources = mpull($sources, 'getDatasourceURI'); ··· 601 602 'package' => '/typeahead/common/packages/', 602 603 'project' => '/typeahead/common/projects/', 603 604 'userorproject' => '/typeahead/common/accountsorprojects/', 604 - 'buildplan' => '/typeahead/common/buildplans/', 605 605 'arcanistprojects' => '/typeahead/common/arcanistprojects/', 606 606 ); 607 607
-15
src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
··· 32 32 $need_noproject = false; 33 33 $need_symbols = false; 34 34 $need_jump_objects = false; 35 - $need_build_plans = false; 36 35 switch ($this->type) { 37 36 case 'mainsearch': 38 37 $need_users = true; ··· 79 78 break; 80 79 case 'arcanistprojects': 81 80 $need_arcanist_projects = true; 82 - break; 83 - case 'buildplans': 84 - $need_build_plans = true; 85 81 break; 86 82 } 87 83 ··· 207 203 ->setName($list->getName()) 208 204 ->setURI($list->getURI()) 209 205 ->setPHID($list->getPHID()); 210 - } 211 - } 212 - 213 - if ($need_build_plans) { 214 - $plans = id(new HarbormasterBuildPlanQuery()) 215 - ->setViewer($viewer) 216 - ->execute(); 217 - foreach ($plans as $plan) { 218 - $results[] = id(new PhabricatorTypeaheadResult()) 219 - ->setName($plan->getName()) 220 - ->setPHID($plan->getPHID()); 221 206 } 222 207 } 223 208