Page MenuHomePhabricator

D21489.id51148.diff
No OneTemporary

D21489.id51148.diff

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
@@ -1430,6 +1430,8 @@
'HarbormasterBuildStep' => 'applications/harbormaster/storage/configuration/HarbormasterBuildStep.php',
'HarbormasterBuildStepCoreCustomField' => 'applications/harbormaster/customfield/HarbormasterBuildStepCoreCustomField.php',
'HarbormasterBuildStepCustomField' => 'applications/harbormaster/customfield/HarbormasterBuildStepCustomField.php',
+ 'HarbormasterBuildStepEditAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildStepEditAPIMethod.php',
+ 'HarbormasterBuildStepEditEngine' => 'applications/harbormaster/editor/HarbormasterBuildStepEditEngine.php',
'HarbormasterBuildStepEditor' => 'applications/harbormaster/editor/HarbormasterBuildStepEditor.php',
'HarbormasterBuildStepGroup' => 'applications/harbormaster/stepgroup/HarbormasterBuildStepGroup.php',
'HarbormasterBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterBuildStepImplementation.php',
@@ -7636,6 +7638,8 @@
'PhabricatorStandardCustomFieldInterface',
),
'HarbormasterBuildStepCustomField' => 'PhabricatorCustomField',
+ 'HarbormasterBuildStepEditAPIMethod' => 'PhabricatorEditEngineAPIMethod',
+ 'HarbormasterBuildStepEditEngine' => 'PhabricatorEditEngine',
'HarbormasterBuildStepEditor' => 'PhabricatorApplicationTransactionEditor',
'HarbormasterBuildStepGroup' => 'Phobject',
'HarbormasterBuildStepImplementation' => 'Phobject',
diff --git a/src/applications/harbormaster/conduit/HarbormasterBuildStepEditAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterBuildStepEditAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/conduit/HarbormasterBuildStepEditAPIMethod.php
@@ -0,0 +1,20 @@
+<?php
+
+final class HarbormasterBuildStepEditAPIMethod
+ extends PhabricatorEditEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'harbormaster.step.edit';
+ }
+
+ public function newEditEngine() {
+ return new HarbormasterBuildStepEditEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht(
+ 'Apply transactions to create a new build step or edit an existing '.
+ 'one.');
+ }
+
+}
diff --git a/src/applications/harbormaster/editor/HarbormasterBuildStepEditEngine.php b/src/applications/harbormaster/editor/HarbormasterBuildStepEditEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/editor/HarbormasterBuildStepEditEngine.php
@@ -0,0 +1,107 @@
+<?php
+
+final class HarbormasterBuildStepEditEngine
+ extends PhabricatorEditEngine {
+
+ const ENGINECONST = 'harbormaster.buildstep';
+
+ private $buildPlan;
+
+ public function setBuildPlan(HarbormasterBuildPlan $build_plan) {
+ $this->buildPlan = $build_plan;
+ return $this;
+ }
+
+ public function getBuildPlan() {
+ if ($this->buildPlan === null) {
+ throw new PhutilInvalidStateException('setBuildPlan');
+ }
+
+ return $this->buildPlan;
+ }
+
+ public function isEngineConfigurable() {
+ return false;
+ }
+
+ public function getEngineName() {
+ return pht('Harbormaster Build Steps');
+ }
+
+ public function getSummaryHeader() {
+ return pht('Edit Harbormaster Build Step Configurations');
+ }
+
+ public function getSummaryText() {
+ return pht('This engine is used to edit Harbormaster build steps.');
+ }
+
+ public function getEngineApplicationClass() {
+ return 'PhabricatorHarbormasterApplication';
+ }
+
+ protected function newEditableObject() {
+ $viewer = $this->getViewer();
+
+
+ $plan = HarbormasterBuildPlan::initializeNewBuildPlan($viewer);
+ $this->setBuildPlan($plan);
+
+ $plan = $this->getBuildPlan();
+
+ $step = HarbormasterBuildStep::initializeNewStep($viewer);
+
+ $step->setBuildPlanPHID($plan->getPHID());
+ $step->attachBuildPlan($plan);
+
+ return $step;
+ }
+
+ protected function newObjectQuery() {
+ return new HarbormasterBuildStepQuery();
+ }
+
+ protected function getObjectCreateTitleText($object) {
+ return pht('Create Build Step');
+ }
+
+ protected function getObjectCreateButtonText($object) {
+ return pht('Create Build Step');
+ }
+
+ protected function getObjectEditTitleText($object) {
+ return pht('Edit Build Step: %s', $object->getName());
+ }
+
+ protected function getObjectEditShortText($object) {
+ return pht('Edit Build Step');
+ }
+
+ protected function getObjectCreateShortText() {
+ return pht('Create Build Step');
+ }
+
+ protected function getObjectName() {
+ return pht('Build Step');
+ }
+
+ protected function getEditorURI() {
+ return '/harbormaster/step/edit/';
+ }
+
+ protected function getObjectCreateCancelURI($object) {
+ return '/harbormaster/step/';
+ }
+
+ protected function getObjectViewURI($object) {
+ $id = $object->getID();
+ return "/harbormaster/step/{$id}/";
+ }
+
+ protected function buildCustomEditFields($object) {
+ $fields = array();
+
+ return $fields;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 19, 1:49 AM (6 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7363557
Default Alt Text
D21489.id51148.diff (5 KB)

Event Timeline