@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.edit" API method

Summary: Ref T13585. Provide a minimal but technically functional "harbormaster.step.edit" API method.

Test Plan: Used the web console to modify the URI for a "Make HTTP Request" build step.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13585

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

+131
+4
src/__phutil_library_map__.php
··· 1430 1430 'HarbormasterBuildStep' => 'applications/harbormaster/storage/configuration/HarbormasterBuildStep.php', 1431 1431 'HarbormasterBuildStepCoreCustomField' => 'applications/harbormaster/customfield/HarbormasterBuildStepCoreCustomField.php', 1432 1432 'HarbormasterBuildStepCustomField' => 'applications/harbormaster/customfield/HarbormasterBuildStepCustomField.php', 1433 + 'HarbormasterBuildStepEditAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildStepEditAPIMethod.php', 1434 + 'HarbormasterBuildStepEditEngine' => 'applications/harbormaster/editor/HarbormasterBuildStepEditEngine.php', 1433 1435 'HarbormasterBuildStepEditor' => 'applications/harbormaster/editor/HarbormasterBuildStepEditor.php', 1434 1436 'HarbormasterBuildStepGroup' => 'applications/harbormaster/stepgroup/HarbormasterBuildStepGroup.php', 1435 1437 'HarbormasterBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterBuildStepImplementation.php', ··· 7636 7638 'PhabricatorStandardCustomFieldInterface', 7637 7639 ), 7638 7640 'HarbormasterBuildStepCustomField' => 'PhabricatorCustomField', 7641 + 'HarbormasterBuildStepEditAPIMethod' => 'PhabricatorEditEngineAPIMethod', 7642 + 'HarbormasterBuildStepEditEngine' => 'PhabricatorEditEngine', 7639 7643 'HarbormasterBuildStepEditor' => 'PhabricatorApplicationTransactionEditor', 7640 7644 'HarbormasterBuildStepGroup' => 'Phobject', 7641 7645 'HarbormasterBuildStepImplementation' => 'Phobject',
+20
src/applications/harbormaster/conduit/HarbormasterBuildStepEditAPIMethod.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildStepEditAPIMethod 4 + extends PhabricatorEditEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'harbormaster.step.edit'; 8 + } 9 + 10 + public function newEditEngine() { 11 + return new HarbormasterBuildStepEditEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht( 16 + 'Apply transactions to create a new build step or edit an existing '. 17 + 'one.'); 18 + } 19 + 20 + }
+107
src/applications/harbormaster/editor/HarbormasterBuildStepEditEngine.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildStepEditEngine 4 + extends PhabricatorEditEngine { 5 + 6 + const ENGINECONST = 'harbormaster.buildstep'; 7 + 8 + private $buildPlan; 9 + 10 + public function setBuildPlan(HarbormasterBuildPlan $build_plan) { 11 + $this->buildPlan = $build_plan; 12 + return $this; 13 + } 14 + 15 + public function getBuildPlan() { 16 + if ($this->buildPlan === null) { 17 + throw new PhutilInvalidStateException('setBuildPlan'); 18 + } 19 + 20 + return $this->buildPlan; 21 + } 22 + 23 + public function isEngineConfigurable() { 24 + return false; 25 + } 26 + 27 + public function getEngineName() { 28 + return pht('Harbormaster Build Steps'); 29 + } 30 + 31 + public function getSummaryHeader() { 32 + return pht('Edit Harbormaster Build Step Configurations'); 33 + } 34 + 35 + public function getSummaryText() { 36 + return pht('This engine is used to edit Harbormaster build steps.'); 37 + } 38 + 39 + public function getEngineApplicationClass() { 40 + return 'PhabricatorHarbormasterApplication'; 41 + } 42 + 43 + protected function newEditableObject() { 44 + $viewer = $this->getViewer(); 45 + 46 + 47 + $plan = HarbormasterBuildPlan::initializeNewBuildPlan($viewer); 48 + $this->setBuildPlan($plan); 49 + 50 + $plan = $this->getBuildPlan(); 51 + 52 + $step = HarbormasterBuildStep::initializeNewStep($viewer); 53 + 54 + $step->setBuildPlanPHID($plan->getPHID()); 55 + $step->attachBuildPlan($plan); 56 + 57 + return $step; 58 + } 59 + 60 + protected function newObjectQuery() { 61 + return new HarbormasterBuildStepQuery(); 62 + } 63 + 64 + protected function getObjectCreateTitleText($object) { 65 + return pht('Create Build Step'); 66 + } 67 + 68 + protected function getObjectCreateButtonText($object) { 69 + return pht('Create Build Step'); 70 + } 71 + 72 + protected function getObjectEditTitleText($object) { 73 + return pht('Edit Build Step: %s', $object->getName()); 74 + } 75 + 76 + protected function getObjectEditShortText($object) { 77 + return pht('Edit Build Step'); 78 + } 79 + 80 + protected function getObjectCreateShortText() { 81 + return pht('Create Build Step'); 82 + } 83 + 84 + protected function getObjectName() { 85 + return pht('Build Step'); 86 + } 87 + 88 + protected function getEditorURI() { 89 + return '/harbormaster/step/edit/'; 90 + } 91 + 92 + protected function getObjectCreateCancelURI($object) { 93 + return '/harbormaster/step/'; 94 + } 95 + 96 + protected function getObjectViewURI($object) { 97 + $id = $object->getID(); 98 + return "/harbormaster/step/{$id}/"; 99 + } 100 + 101 + protected function buildCustomEditFields($object) { 102 + $fields = array(); 103 + 104 + return $fields; 105 + } 106 + 107 + }