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

Allow users to specify names of build steps

Summary: Ref T1049. This provides a user-configurable name field on build steps, which allows users to uniquely identify their steps. The intention is that this field will be used in D9806 to better identify the dependencies (rather than showing an unhelpful PHID).

Test Plan: Set the name of some build steps, saw it appear in the correct places.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T1049

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

+60 -9
+2
resources/sql/autopatches/20140704.harbormasterstep.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_harbormaster.harbormaster_buildstep 2 + ADD name VARCHAR(255) COLLATE utf8_bin;
+2
resources/sql/autopatches/20140704.harbormasterstep.2.sql
··· 1 + ALTER TABLE {$NAMESPACE}_harbormaster.harbormaster_buildtarget 2 + ADD name VARCHAR(255) COLLATE utf8_bin;
+1 -1
src/applications/harbormaster/controller/HarbormasterBuildViewController.php
··· 72 72 ->setHeader(pht( 73 73 'Build Target %d (%s)', 74 74 $build_target->getID(), 75 - $build_target->getImplementation()->getName())) 75 + $build_target->getName())) 76 76 ->setUser($viewer); 77 77 $properties = new PHUIPropertyListView(); 78 78
+1 -6
src/applications/harbormaster/controller/HarbormasterBuildableViewController.php
··· 282 282 break; 283 283 } 284 284 285 - try { 286 - $impl = $target->getImplementation(); 287 - $name = $impl->getName(); 288 - } catch (Exception $ex) { 289 - $name = $target->getClassName(); 290 - } 285 + $name = $target->getName(); 291 286 292 287 $target_list->addItem( 293 288 id(new PHUIStatusItemView())
+1 -1
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
··· 129 129 } 130 130 $item = id(new PHUIObjectItemView()) 131 131 ->setObjectName('Step '.$i++) 132 - ->setHeader($implementation->getName()); 132 + ->setHeader($step->getName()); 133 133 134 134 $item->addAttribute($implementation->getDescription()); 135 135
+18 -1
src/applications/harbormaster/controller/HarbormasterStepEditController.php
··· 64 64 ->setViewer($viewer) 65 65 ->readFieldsFromStorage($step); 66 66 67 + $e_name = true; 68 + $v_name = $step->getName(); 69 + 67 70 $errors = array(); 68 71 $validation_exception = null; 69 72 if ($request->isFormPost()) { 73 + $e_name = null; 74 + $v_name = $request->getStr('name'); 75 + 70 76 $xactions = $field_list->buildFieldTransactionsFromRequest( 71 77 new HarbormasterBuildStepTransaction(), 72 78 $request); ··· 76 82 ->setContinueOnNoEffect(true) 77 83 ->setContentSourceFromRequest($request); 78 84 85 + $name_xaction = id(new HarbormasterBuildStepTransaction()) 86 + ->setTransactionType(HarbormasterBuildStepTransaction::TYPE_NAME) 87 + ->setNewValue($v_name); 88 + array_unshift($xactions, $name_xaction); 89 + 79 90 if ($is_new) { 80 91 // This is okay, but a little iffy. We should move it inside the editor 81 92 // if we create plans elsewhere. ··· 99 110 } 100 111 101 112 $form = id(new AphrontFormView()) 102 - ->setUser($viewer); 113 + ->setUser($viewer) 114 + ->appendChild( 115 + id(new AphrontFormTextControl()) 116 + ->setName('name') 117 + ->setLabel(pht('Name')) 118 + ->setError($e_name) 119 + ->setValue($v_name)); 103 120 104 121 $field_list->appendFieldsToForm($form); 105 122
+11
src/applications/harbormaster/editor/HarbormasterBuildStepEditor.php
··· 7 7 $types = parent::getTransactionTypes(); 8 8 9 9 $types[] = HarbormasterBuildStepTransaction::TYPE_CREATE; 10 + $types[] = HarbormasterBuildStepTransaction::TYPE_NAME; 10 11 11 12 return $types; 12 13 } ··· 18 19 switch ($xaction->getTransactionType()) { 19 20 case HarbormasterBuildStepTransaction::TYPE_CREATE: 20 21 return null; 22 + case HarbormasterBuildStepTransaction::TYPE_NAME: 23 + if ($this->getIsNewObject()) { 24 + return null; 25 + } 26 + return $object->getName(); 21 27 } 22 28 23 29 return parent::getCustomTransactionOldValue($object, $xaction); ··· 30 36 switch ($xaction->getTransactionType()) { 31 37 case HarbormasterBuildStepTransaction::TYPE_CREATE: 32 38 return true; 39 + case HarbormasterBuildStepTransaction::TYPE_NAME: 40 + return $xaction->getNewValue(); 33 41 } 34 42 35 43 return parent::getCustomTransactionNewValue($object, $xaction); ··· 42 50 switch ($xaction->getTransactionType()) { 43 51 case HarbormasterBuildStepTransaction::TYPE_CREATE: 44 52 return; 53 + case HarbormasterBuildStepTransaction::TYPE_NAME: 54 + return $object->setName($xaction->getNewValue()); 45 55 } 46 56 47 57 return parent::applyCustomInternalTransaction($object, $xaction); ··· 53 63 54 64 switch ($xaction->getTransactionType()) { 55 65 case HarbormasterBuildStepTransaction::TYPE_CREATE: 66 + case HarbormasterBuildStepTransaction::TYPE_NAME: 56 67 return; 57 68 } 58 69
+14
src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
··· 3 3 final class HarbormasterBuildTarget extends HarbormasterDAO 4 4 implements PhabricatorPolicyInterface { 5 5 6 + protected $name; 6 7 protected $buildPHID; 7 8 protected $buildStepPHID; 8 9 protected $className; ··· 25 26 HarbormasterBuildStep $build_step, 26 27 array $variables) { 27 28 return id(new HarbormasterBuildTarget()) 29 + ->setName($build_step->getName()) 28 30 ->setBuildPHID($build->getPHID()) 29 31 ->setBuildStepPHID($build_step->getPHID()) 30 32 ->setClassName($build_step->getClassName()) ··· 97 99 } 98 100 99 101 return $this->implementation; 102 + } 103 + 104 + public function getName() { 105 + if (strlen($this->name)) { 106 + return $this->name; 107 + } 108 + 109 + try { 110 + return $this->getImplementation()->getName(); 111 + } catch (Exception $e) { 112 + return $this->getClassName(); 113 + } 100 114 } 101 115 102 116 private function getBuildTargetVariables() {
+9
src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php
··· 5 5 PhabricatorPolicyInterface, 6 6 PhabricatorCustomFieldInterface { 7 7 8 + protected $name; 8 9 protected $buildPlanPHID; 9 10 protected $className; 10 11 protected $details = array(); ··· 48 49 public function setDetail($key, $value) { 49 50 $this->details[$key] = $value; 50 51 return $this; 52 + } 53 + 54 + public function getName() { 55 + if (strlen($this->name)) { 56 + return $this->name; 57 + } 58 + 59 + return $this->getStepImplementation()->getName(); 51 60 } 52 61 53 62 public function getStepImplementation() {
+1
src/applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php
··· 4 4 extends PhabricatorApplicationTransaction { 5 5 6 6 const TYPE_CREATE = 'harbormaster:step:create'; 7 + const TYPE_NAME = 'harbormaster:step:name'; 7 8 8 9 public function getApplicationName() { 9 10 return 'harbormaster';