diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index bcb7c6374a..996d873ca9 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -793,6 +793,7 @@ phutil_register_library_map(array( 'DiffusionRepositoryURIViewController' => 'applications/diffusion/controller/DiffusionRepositoryURIViewController.php', 'DiffusionRepositoryURIsIndexEngineExtension' => 'applications/diffusion/engineextension/DiffusionRepositoryURIsIndexEngineExtension.php', 'DiffusionRepositoryURIsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php', + 'DiffusionRepositoryURIsSearchEngineAttachment' => 'applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php', 'DiffusionRequest' => 'applications/diffusion/request/DiffusionRequest.php', 'DiffusionResolveRefsConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionResolveRefsConduitAPIMethod.php', 'DiffusionResolveUserQuery' => 'applications/diffusion/query/DiffusionResolveUserQuery.php', @@ -5022,6 +5023,7 @@ phutil_register_library_map(array( 'DiffusionRepositoryURIViewController' => 'DiffusionController', 'DiffusionRepositoryURIsIndexEngineExtension' => 'PhabricatorIndexEngineExtension', 'DiffusionRepositoryURIsManagementPanel' => 'DiffusionRepositoryManagementPanel', + 'DiffusionRepositoryURIsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 'DiffusionRequest' => 'Phobject', 'DiffusionResolveRefsConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 'DiffusionResolveUserQuery' => 'Phobject', @@ -7932,6 +7934,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationTransactionInterface', 'PhabricatorPolicyInterface', 'PhabricatorExtendedPolicyInterface', + 'PhabricatorConduitResultInterface', ), 'PhabricatorRepositoryURIIndex' => 'PhabricatorRepositoryDAO', 'PhabricatorRepositoryURINormalizer' => 'Phobject', diff --git a/src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php b/src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php new file mode 100644 index 0000000000..1eab49d77a --- /dev/null +++ b/src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php @@ -0,0 +1,34 @@ +needURIs(true); + } + + public function getAttachmentForObject($object, $data, $spec) { + $uris = array(); + foreach ($object->getURIs() as $uri) { + $uris[] = array( + 'id' => $uri->getID(), + 'type' => phid_get_type($uri->getPHID()), + 'phid' => $uri->getPHID(), + 'fields' => $uri->getFieldValuesForConduit(), + ); + } + + return array( + 'uris' => $uris, + ); + } + +} diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index 94584fd382..11614b3649 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -2454,6 +2454,10 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO ->setKey('shortName') ->setType('string') ->setDescription(pht('Unique short name, if the repository has one.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('status') + ->setType('string') + ->setDescription(pht('Active or inactive status.')), ); } @@ -2463,11 +2467,15 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO 'vcs' => $this->getVersionControlSystem(), 'callsign' => $this->getCallsign(), 'shortName' => $this->getRepositorySlug(), + 'status' => $this->getStatus(), ); } public function getConduitSearchAttachments() { - return array(); + return array( + id(new DiffusionRepositoryURIsSearchEngineAttachment()) + ->setAttachmentKey('uris'), + ); } } diff --git a/src/applications/repository/storage/PhabricatorRepositoryURI.php b/src/applications/repository/storage/PhabricatorRepositoryURI.php index 5d1ed6d358..7e7741e372 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryURI.php +++ b/src/applications/repository/storage/PhabricatorRepositoryURI.php @@ -5,7 +5,8 @@ final class PhabricatorRepositoryURI implements PhabricatorApplicationTransactionInterface, PhabricatorPolicyInterface, - PhabricatorExtendedPolicyInterface { + PhabricatorExtendedPolicyInterface, + PhabricatorConduitResultInterface { protected $repositoryPHID; protected $uri; @@ -512,4 +513,87 @@ final class PhabricatorRepositoryURI return $extended; } + +/* -( PhabricatorConduitResultInterface )---------------------------------- */ + + + public function getFieldSpecificationsForConduit() { + return array( + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('repositoryPHID') + ->setType('phid') + ->setDescription(pht('The associated repository PHID.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('uri') + ->setType('map') + ->setDescription(pht('The raw and effective URI.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('io') + ->setType('map') + ->setDescription( + pht('The raw, default, and effective I/O Type settings.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('display') + ->setType('map') + ->setDescription( + pht('The raw, default, and effective Display Type settings.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('credentialPHID') + ->setType('phid?') + ->setDescription( + pht('The associated credential PHID, if one exists.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('disabled') + ->setType('bool') + ->setDescription(pht('True if the URI is disabled.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('builtin') + ->setType('map') + ->setDescription( + pht('Information about builtin URIs.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('dateCreated') + ->setType('int') + ->setDescription( + pht('Epoch timestamp when the object was created.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('dateModified') + ->setType('int') + ->setDescription( + pht('Epoch timestamp when the object was last updated.')), + ); + } + + public function getFieldValuesForConduit() { + return array( + 'repositoryPHID' => $this->getRepositoryPHID(), + 'uri' => array( + 'raw' => $this->getURI(), + 'effective' => (string)$this->getDisplayURI(), + ), + 'io' => array( + 'raw' => $this->getIOType(), + 'default' => $this->getDefaultIOType(), + 'effective' => $this->getEffectiveIOType(), + ), + 'display' => array( + 'raw' => $this->getDisplayType(), + 'default' => $this->getDefaultDisplayType(), + 'effective' => $this->getEffectiveDisplayType(), + ), + 'credentialPHID' => $this->getCredentialPHID(), + 'disabled' => (bool)$this->getIsDisabled(), + 'builtin' => array( + 'protocol' => $this->getBuiltinProtocol(), + 'identifier' => $this->getBuiltinIdentifier(), + ), + 'dateCreated' => $this->getDateCreated(), + 'dateModified' => $this->getDateModified(), + ); + } + + public function getConduitSearchAttachments() { + return array(); + } + }