Page MenuHomePhabricator

D21488.diff
No OneTemporary

D21488.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
@@ -1436,6 +1436,8 @@
'HarbormasterBuildStepImplementationTestCase' => 'applications/harbormaster/step/__tests__/HarbormasterBuildStepImplementationTestCase.php',
'HarbormasterBuildStepPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildStepPHIDType.php',
'HarbormasterBuildStepQuery' => 'applications/harbormaster/query/HarbormasterBuildStepQuery.php',
+ 'HarbormasterBuildStepSearchAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildStepSearchAPIMethod.php',
+ 'HarbormasterBuildStepSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildStepSearchEngine.php',
'HarbormasterBuildStepTransaction' => 'applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php',
'HarbormasterBuildStepTransactionQuery' => 'applications/harbormaster/query/HarbormasterBuildStepTransactionQuery.php',
'HarbormasterBuildTarget' => 'applications/harbormaster/storage/build/HarbormasterBuildTarget.php',
@@ -7627,6 +7629,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorCustomFieldInterface',
+ 'PhabricatorConduitResultInterface',
),
'HarbormasterBuildStepCoreCustomField' => array(
'HarbormasterBuildStepCustomField',
@@ -7639,6 +7642,8 @@
'HarbormasterBuildStepImplementationTestCase' => 'PhabricatorTestCase',
'HarbormasterBuildStepPHIDType' => 'PhabricatorPHIDType',
'HarbormasterBuildStepQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'HarbormasterBuildStepSearchAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
+ 'HarbormasterBuildStepSearchEngine' => 'PhabricatorApplicationSearchEngine',
'HarbormasterBuildStepTransaction' => 'PhabricatorApplicationTransaction',
'HarbormasterBuildStepTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'HarbormasterBuildTarget' => array(
diff --git a/src/applications/harbormaster/conduit/HarbormasterBuildStepSearchAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterBuildStepSearchAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/conduit/HarbormasterBuildStepSearchAPIMethod.php
@@ -0,0 +1,18 @@
+<?php
+
+final class HarbormasterBuildStepSearchAPIMethod
+ extends PhabricatorSearchEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'harbormaster.step.search';
+ }
+
+ public function newSearchEngine() {
+ return new HarbormasterBuildStepSearchEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht('Retrieve information about Harbormaster build steps.');
+ }
+
+}
diff --git a/src/applications/harbormaster/query/HarbormasterBuildStepSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildStepSearchEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/query/HarbormasterBuildStepSearchEngine.php
@@ -0,0 +1,58 @@
+<?php
+
+final class HarbormasterBuildStepSearchEngine
+ extends PhabricatorApplicationSearchEngine {
+
+ public function getResultTypeDescription() {
+ return pht('Harbormaster Build Steps');
+ }
+
+ public function getApplicationClassName() {
+ return 'PhabricatorHarbormasterApplication';
+ }
+
+ public function newQuery() {
+ return new HarbormasterBuildStepQuery();
+ }
+
+ protected function buildCustomSearchFields() {
+ return array();
+ }
+
+ protected function buildQueryFromParameters(array $map) {
+ $query = $this->newQuery();
+
+ return $query;
+ }
+
+ protected function getURI($path) {
+ return '/harbormaster/step/'.$path;
+ }
+
+ protected function getBuiltinQueryNames() {
+ return array(
+ 'all' => pht('All Steps'),
+ );
+ }
+
+ public function buildSavedQueryFromBuiltin($query_key) {
+ $query = $this->newSavedQuery();
+ $query->setQueryKey($query_key);
+
+ switch ($query_key) {
+ case 'all':
+ return $query;
+ }
+
+ return parent::buildSavedQueryFromBuiltin($query_key);
+ }
+
+ protected function renderResultList(
+ array $plans,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($plans, 'HarbormasterBuildStep');
+ return null;
+ }
+
+}
diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php
--- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php
+++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php
@@ -4,7 +4,8 @@
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
- PhabricatorCustomFieldInterface {
+ PhabricatorCustomFieldInterface,
+ PhabricatorConduitResultInterface {
protected $name;
protected $description;
@@ -169,5 +170,45 @@
return $this;
}
+/* -( PhabricatorConduitResultInterface )---------------------------------- */
+
+
+ public function getFieldSpecificationsForConduit() {
+ return array(
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('name')
+ ->setType('string')
+ ->setDescription(pht('The name of the build step.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('description')
+ ->setType('remarkup')
+ ->setDescription(pht('The build step description.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('buildPlanPHID')
+ ->setType('phid')
+ ->setDescription(
+ pht(
+ 'The PHID of the build plan this build step belongs to.')),
+ );
+ }
+
+ public function getFieldValuesForConduit() {
+ // T6203: This can be removed once the field becomes non-nullable.
+ $name = $this->getName();
+ $name = phutil_string_cast($name);
+
+ return array(
+ 'name' => $name,
+ 'description' => array(
+ 'raw' => $this->getDescription(),
+ ),
+ 'buildPlanPHID' => $this->getBuildPlanPHID(),
+ );
+ }
+
+ public function getConduitSearchAttachments() {
+ return array();
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 23, 6:22 PM (2 h, 45 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7352796
Default Alt Text
D21488.diff (6 KB)

Event Timeline