From 2ff1d4b3b007af0471fe8691a7dcedc5580865a7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Jul 2021 09:28:47 -0700 Subject: [PATCH] Add stub "harbormaster.build.edit" and "harbormaster.buildable.edit" API methods Summary: Ref T13072. These don't do anything useful yet, but get the skeletons in. Test Plan: Loaded documentation pages without fataling. Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13072 Differential Revision: https://secure.phabricator.com/D21695 --- src/__phutil_library_map__.php | 8 ++ .../HarbormasterBuildEditAPIMethod.php | 20 +++++ .../HarbormasterBuildableEditAPIMethod.php | 20 +++++ .../editor/HarbormasterBuildEditEngine.php | 87 +++++++++++++++++++ .../HarbormasterBuildableEditEngine.php | 84 ++++++++++++++++++ 5 files changed, 219 insertions(+) create mode 100644 src/applications/harbormaster/conduit/HarbormasterBuildEditAPIMethod.php create mode 100644 src/applications/harbormaster/conduit/HarbormasterBuildableEditAPIMethod.php create mode 100644 src/applications/harbormaster/editor/HarbormasterBuildEditEngine.php create mode 100644 src/applications/harbormaster/editor/HarbormasterBuildableEditEngine.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 4cddbeeb2a..73f6ea5351 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1388,6 +1388,8 @@ phutil_register_library_map(array( 'HarbormasterBuildArtifactQuery' => 'applications/harbormaster/query/HarbormasterBuildArtifactQuery.php', 'HarbormasterBuildAutoplan' => 'applications/harbormaster/autoplan/HarbormasterBuildAutoplan.php', 'HarbormasterBuildDependencyDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildDependencyDatasource.php', + 'HarbormasterBuildEditAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildEditAPIMethod.php', + 'HarbormasterBuildEditEngine' => 'applications/harbormaster/editor/HarbormasterBuildEditEngine.php', 'HarbormasterBuildEngine' => 'applications/harbormaster/engine/HarbormasterBuildEngine.php', 'HarbormasterBuildFailureException' => 'applications/harbormaster/exception/HarbormasterBuildFailureException.php', 'HarbormasterBuildGraph' => 'applications/harbormaster/engine/HarbormasterBuildGraph.php', @@ -1472,6 +1474,8 @@ phutil_register_library_map(array( 'HarbormasterBuildable' => 'applications/harbormaster/storage/HarbormasterBuildable.php', 'HarbormasterBuildableActionController' => 'applications/harbormaster/controller/HarbormasterBuildableActionController.php', 'HarbormasterBuildableAdapterInterface' => 'applications/harbormaster/herald/HarbormasterBuildableAdapterInterface.php', + 'HarbormasterBuildableEditAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildableEditAPIMethod.php', + 'HarbormasterBuildableEditEngine' => 'applications/harbormaster/editor/HarbormasterBuildableEditEngine.php', 'HarbormasterBuildableEngine' => 'applications/harbormaster/engine/HarbormasterBuildableEngine.php', 'HarbormasterBuildableInterface' => 'applications/harbormaster/interface/HarbormasterBuildableInterface.php', 'HarbormasterBuildableListController' => 'applications/harbormaster/controller/HarbormasterBuildableListController.php', @@ -7605,6 +7609,8 @@ phutil_register_library_map(array( 'HarbormasterBuildArtifactQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HarbormasterBuildAutoplan' => 'Phobject', 'HarbormasterBuildDependencyDatasource' => 'PhabricatorTypeaheadDatasource', + 'HarbormasterBuildEditAPIMethod' => 'PhabricatorEditEngineAPIMethod', + 'HarbormasterBuildEditEngine' => 'PhabricatorEditEngine', 'HarbormasterBuildEngine' => 'Phobject', 'HarbormasterBuildFailureException' => 'Exception', 'HarbormasterBuildGraph' => 'AbstractDirectedGraph', @@ -7730,6 +7736,8 @@ phutil_register_library_map(array( 'PhabricatorDestructibleInterface', ), 'HarbormasterBuildableActionController' => 'HarbormasterController', + 'HarbormasterBuildableEditAPIMethod' => 'PhabricatorEditEngineAPIMethod', + 'HarbormasterBuildableEditEngine' => 'PhabricatorEditEngine', 'HarbormasterBuildableEngine' => 'Phobject', 'HarbormasterBuildableListController' => 'HarbormasterController', 'HarbormasterBuildableMessageTransaction' => 'HarbormasterBuildableTransactionType', diff --git a/src/applications/harbormaster/conduit/HarbormasterBuildEditAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterBuildEditAPIMethod.php new file mode 100644 index 0000000000..c13f4039ca --- /dev/null +++ b/src/applications/harbormaster/conduit/HarbormasterBuildEditAPIMethod.php @@ -0,0 +1,20 @@ +getViewer(); + return HarbormasterBuild::initializeNewBuild($viewer); + } + + protected function newObjectQuery() { + return new HarbormasterBuildQuery(); + } + + protected function newEditableObjectForDocumentation() { + $object = new DifferentialRevision(); + + $buildable = id(new HarbormasterBuildable()) + ->attachBuildableObject($object); + + return $this->newEditableObject() + ->attachBuildable($buildable); + } + + protected function getObjectCreateTitleText($object) { + return pht('Create Build'); + } + + protected function getObjectCreateButtonText($object) { + return pht('Create Build'); + } + + protected function getObjectEditTitleText($object) { + return pht('Edit Build: %s', $object->getName()); + } + + protected function getObjectEditShortText($object) { + return pht('Edit Build'); + } + + protected function getObjectCreateShortText() { + return pht('Create Build'); + } + + protected function getObjectName() { + return pht('Build'); + } + + protected function getEditorURI() { + return '/harbormaster/build/edit/'; + } + + protected function getObjectCreateCancelURI($object) { + return '/harbormaster/'; + } + + protected function getObjectViewURI($object) { + return $object->getURI(); + } + + protected function buildCustomEditFields($object) { + return array(); + } + +} diff --git a/src/applications/harbormaster/editor/HarbormasterBuildableEditEngine.php b/src/applications/harbormaster/editor/HarbormasterBuildableEditEngine.php new file mode 100644 index 0000000000..bd60eeb53b --- /dev/null +++ b/src/applications/harbormaster/editor/HarbormasterBuildableEditEngine.php @@ -0,0 +1,84 @@ +getViewer(); + return HarbormasterBuildable::initializeNewBuildable($viewer); + } + + protected function newObjectQuery() { + return new HarbormasterBuildableQuery(); + } + + protected function newEditableObjectForDocumentation() { + $object = new DifferentialRevision(); + + return $this->newEditableObject() + ->attachBuildableObject($object); + } + + protected function getObjectCreateTitleText($object) { + return pht('Create Buildable'); + } + + protected function getObjectCreateButtonText($object) { + return pht('Create Buildable'); + } + + protected function getObjectEditTitleText($object) { + return pht('Edit Buildable: %s', $object->getName()); + } + + protected function getObjectEditShortText($object) { + return pht('Edit Buildable'); + } + + protected function getObjectCreateShortText() { + return pht('Create Buildable'); + } + + protected function getObjectName() { + return pht('Buildable'); + } + + protected function getEditorURI() { + return '/harbormaster/buildable/edit/'; + } + + protected function getObjectCreateCancelURI($object) { + return '/harbormaster/'; + } + + protected function getObjectViewURI($object) { + return $object->getURI(); + } + + protected function buildCustomEditFields($object) { + return array(); + } + +}