@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.

Add a basic "harbormaster.step.search" API method

Summary: Ref T13585. This isn't particularly useful (notably, it does not include custom field values and isn't searchable by build plan PHID) but get the basics into place.

Test Plan: Used the web UI to make API calls, reviewed results.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13585

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

+123 -1
+5
src/__phutil_library_map__.php
··· 1436 1436 'HarbormasterBuildStepImplementationTestCase' => 'applications/harbormaster/step/__tests__/HarbormasterBuildStepImplementationTestCase.php', 1437 1437 'HarbormasterBuildStepPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildStepPHIDType.php', 1438 1438 'HarbormasterBuildStepQuery' => 'applications/harbormaster/query/HarbormasterBuildStepQuery.php', 1439 + 'HarbormasterBuildStepSearchAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildStepSearchAPIMethod.php', 1440 + 'HarbormasterBuildStepSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildStepSearchEngine.php', 1439 1441 'HarbormasterBuildStepTransaction' => 'applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php', 1440 1442 'HarbormasterBuildStepTransactionQuery' => 'applications/harbormaster/query/HarbormasterBuildStepTransactionQuery.php', 1441 1443 'HarbormasterBuildTarget' => 'applications/harbormaster/storage/build/HarbormasterBuildTarget.php', ··· 7627 7629 'PhabricatorApplicationTransactionInterface', 7628 7630 'PhabricatorPolicyInterface', 7629 7631 'PhabricatorCustomFieldInterface', 7632 + 'PhabricatorConduitResultInterface', 7630 7633 ), 7631 7634 'HarbormasterBuildStepCoreCustomField' => array( 7632 7635 'HarbormasterBuildStepCustomField', ··· 7639 7642 'HarbormasterBuildStepImplementationTestCase' => 'PhabricatorTestCase', 7640 7643 'HarbormasterBuildStepPHIDType' => 'PhabricatorPHIDType', 7641 7644 'HarbormasterBuildStepQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 7645 + 'HarbormasterBuildStepSearchAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 7646 + 'HarbormasterBuildStepSearchEngine' => 'PhabricatorApplicationSearchEngine', 7642 7647 'HarbormasterBuildStepTransaction' => 'PhabricatorApplicationTransaction', 7643 7648 'HarbormasterBuildStepTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 7644 7649 'HarbormasterBuildTarget' => array(
+18
src/applications/harbormaster/conduit/HarbormasterBuildStepSearchAPIMethod.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildStepSearchAPIMethod 4 + extends PhabricatorSearchEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'harbormaster.step.search'; 8 + } 9 + 10 + public function newSearchEngine() { 11 + return new HarbormasterBuildStepSearchEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht('Retrieve information about Harbormaster build steps.'); 16 + } 17 + 18 + }
+58
src/applications/harbormaster/query/HarbormasterBuildStepSearchEngine.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildStepSearchEngine 4 + extends PhabricatorApplicationSearchEngine { 5 + 6 + public function getResultTypeDescription() { 7 + return pht('Harbormaster Build Steps'); 8 + } 9 + 10 + public function getApplicationClassName() { 11 + return 'PhabricatorHarbormasterApplication'; 12 + } 13 + 14 + public function newQuery() { 15 + return new HarbormasterBuildStepQuery(); 16 + } 17 + 18 + protected function buildCustomSearchFields() { 19 + return array(); 20 + } 21 + 22 + protected function buildQueryFromParameters(array $map) { 23 + $query = $this->newQuery(); 24 + 25 + return $query; 26 + } 27 + 28 + protected function getURI($path) { 29 + return '/harbormaster/step/'.$path; 30 + } 31 + 32 + protected function getBuiltinQueryNames() { 33 + return array( 34 + 'all' => pht('All Steps'), 35 + ); 36 + } 37 + 38 + public function buildSavedQueryFromBuiltin($query_key) { 39 + $query = $this->newSavedQuery(); 40 + $query->setQueryKey($query_key); 41 + 42 + switch ($query_key) { 43 + case 'all': 44 + return $query; 45 + } 46 + 47 + return parent::buildSavedQueryFromBuiltin($query_key); 48 + } 49 + 50 + protected function renderResultList( 51 + array $plans, 52 + PhabricatorSavedQuery $query, 53 + array $handles) { 54 + assert_instances_of($plans, 'HarbormasterBuildStep'); 55 + return null; 56 + } 57 + 58 + }
+42 -1
src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php
··· 4 4 implements 5 5 PhabricatorApplicationTransactionInterface, 6 6 PhabricatorPolicyInterface, 7 - PhabricatorCustomFieldInterface { 7 + PhabricatorCustomFieldInterface, 8 + PhabricatorConduitResultInterface { 8 9 9 10 protected $name; 10 11 protected $description; ··· 167 168 public function attachCustomFields(PhabricatorCustomFieldAttachment $fields) { 168 169 $this->customFields = $fields; 169 170 return $this; 171 + } 172 + 173 + /* -( PhabricatorConduitResultInterface )---------------------------------- */ 174 + 175 + 176 + public function getFieldSpecificationsForConduit() { 177 + return array( 178 + id(new PhabricatorConduitSearchFieldSpecification()) 179 + ->setKey('name') 180 + ->setType('string') 181 + ->setDescription(pht('The name of the build step.')), 182 + id(new PhabricatorConduitSearchFieldSpecification()) 183 + ->setKey('description') 184 + ->setType('remarkup') 185 + ->setDescription(pht('The build step description.')), 186 + id(new PhabricatorConduitSearchFieldSpecification()) 187 + ->setKey('buildPlanPHID') 188 + ->setType('phid') 189 + ->setDescription( 190 + pht( 191 + 'The PHID of the build plan this build step belongs to.')), 192 + ); 193 + } 194 + 195 + public function getFieldValuesForConduit() { 196 + // T6203: This can be removed once the field becomes non-nullable. 197 + $name = $this->getName(); 198 + $name = phutil_string_cast($name); 199 + 200 + return array( 201 + 'name' => $name, 202 + 'description' => array( 203 + 'raw' => $this->getDescription(), 204 + ), 205 + 'buildPlanPHID' => $this->getBuildPlanPHID(), 206 + ); 207 + } 208 + 209 + public function getConduitSearchAttachments() { 210 + return array(); 170 211 } 171 212 172 213