Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13975068
D9878.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D9878.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -729,6 +729,7 @@
'HarbormasterBuildMessage' => 'applications/harbormaster/storage/HarbormasterBuildMessage.php',
'HarbormasterBuildMessageQuery' => 'applications/harbormaster/query/HarbormasterBuildMessageQuery.php',
'HarbormasterBuildPlan' => 'applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php',
+ 'HarbormasterBuildPlanDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildPlanDatasource.php',
'HarbormasterBuildPlanEditor' => 'applications/harbormaster/editor/HarbormasterBuildPlanEditor.php',
'HarbormasterBuildPlanQuery' => 'applications/harbormaster/query/HarbormasterBuildPlanQuery.php',
'HarbormasterBuildPlanSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php',
@@ -3470,6 +3471,7 @@
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorSubscribableInterface',
),
+ 'HarbormasterBuildPlanDatasource' => 'PhabricatorTypeaheadDatasource',
'HarbormasterBuildPlanEditor' => 'PhabricatorApplicationTransactionEditor',
'HarbormasterBuildPlanQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'HarbormasterBuildPlanSearchEngine' => 'PhabricatorApplicationSearchEngine',
diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php
--- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php
+++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php
@@ -12,6 +12,10 @@
return pht('Build Plan');
}
+ public function getTypeIcon() {
+ return 'fa-cubes';
+ }
+
public function newObject() {
return new HarbormasterBuildPlan();
}
@@ -31,8 +35,9 @@
foreach ($handles as $phid => $handle) {
$build_plan = $objects[$phid];
- $handles[$phid]->setName($build_plan->getName());
- $handles[$phid]->setURI('/harbormaster/plan/'.$build_plan->getID());
+ $id = $build_plan->getID();
+ $handles[$phid]->setName(pht('Plan %d %s', $id, $build_plan->getName()));
+ $handles[$phid]->setURI('/harbormaster/plan/'.$id.'/');
}
}
diff --git a/src/applications/harbormaster/typeahead/HarbormasterBuildPlanDatasource.php b/src/applications/harbormaster/typeahead/HarbormasterBuildPlanDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/typeahead/HarbormasterBuildPlanDatasource.php
@@ -0,0 +1,32 @@
+<?php
+
+final class HarbormasterBuildPlanDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getPlaceholderText() {
+ return pht('Type a build plan name...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorApplicationHarbormaster';
+ }
+
+ public function loadResults() {
+ $viewer = $this->getViewer();
+ $raw_query = $this->getRawQuery();
+
+ $results = array();
+
+ $plans = id(new HarbormasterBuildPlanQuery())
+ ->setViewer($viewer)
+ ->execute();
+ foreach ($plans as $plan) {
+ $results[] = id(new PhabricatorTypeaheadResult())
+ ->setName($plan->getName())
+ ->setPHID($plan->getPHID());
+ }
+
+ return $results;
+ }
+
+}
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -592,6 +592,7 @@
'repository' => new DiffusionRepositoryDatasource(),
'legaldocuments' => new LegalpadDocumentDatasource(),
'taskpriority' => new ManiphestTaskPriorityDatasource(),
+ 'buildplan' => new HarbormasterBuildPlanDatasource(),
);
$sources = mpull($sources, 'getDatasourceURI');
@@ -601,7 +602,6 @@
'package' => '/typeahead/common/packages/',
'project' => '/typeahead/common/projects/',
'userorproject' => '/typeahead/common/accountsorprojects/',
- 'buildplan' => '/typeahead/common/buildplans/',
'arcanistprojects' => '/typeahead/common/arcanistprojects/',
);
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
@@ -32,7 +32,6 @@
$need_noproject = false;
$need_symbols = false;
$need_jump_objects = false;
- $need_build_plans = false;
switch ($this->type) {
case 'mainsearch':
$need_users = true;
@@ -80,9 +79,6 @@
case 'arcanistprojects':
$need_arcanist_projects = true;
break;
- case 'buildplans':
- $need_build_plans = true;
- break;
}
$results = array();
@@ -210,17 +206,6 @@
}
}
- if ($need_build_plans) {
- $plans = id(new HarbormasterBuildPlanQuery())
- ->setViewer($viewer)
- ->execute();
- foreach ($plans as $plan) {
- $results[] = id(new PhabricatorTypeaheadResult())
- ->setName($plan->getName())
- ->setPHID($plan->getPHID());
- }
- }
-
if ($need_projs) {
$projs = id(new PhabricatorProjectQuery())
->setViewer($viewer)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 19 2024, 8:34 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727030
Default Alt Text
D9878.diff (5 KB)
Attached To
Mode
D9878: Modernize "build plans" typeahead datasource
Attached
Detach File
Event Timeline
Log In to Comment