1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Expose Drydock blueprints via Conduit

Summary:
This search engine ports cleanly to Conduit out of the box.

Ref T11694

Test Plan: called the API method from the console, browsed blueprints in the ui

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T11694

Differential Revision: https://secure.phabricator.com/D16593
This commit is contained in:
Mike Riley 2016-10-13 20:48:24 +00:00 committed by yelirekim
parent 508a2a1498
commit 8759f7e6ec
3 changed files with 52 additions and 1 deletions

View file

@ -940,6 +940,7 @@ phutil_register_library_map(array(
'DrydockBlueprintNameNgrams' => 'applications/drydock/storage/DrydockBlueprintNameNgrams.php', 'DrydockBlueprintNameNgrams' => 'applications/drydock/storage/DrydockBlueprintNameNgrams.php',
'DrydockBlueprintPHIDType' => 'applications/drydock/phid/DrydockBlueprintPHIDType.php', 'DrydockBlueprintPHIDType' => 'applications/drydock/phid/DrydockBlueprintPHIDType.php',
'DrydockBlueprintQuery' => 'applications/drydock/query/DrydockBlueprintQuery.php', 'DrydockBlueprintQuery' => 'applications/drydock/query/DrydockBlueprintQuery.php',
'DrydockBlueprintSearchConduitAPIMethod' => 'applications/drydock/conduit/DrydockBlueprintSearchConduitAPIMethod.php',
'DrydockBlueprintSearchEngine' => 'applications/drydock/query/DrydockBlueprintSearchEngine.php', 'DrydockBlueprintSearchEngine' => 'applications/drydock/query/DrydockBlueprintSearchEngine.php',
'DrydockBlueprintTransaction' => 'applications/drydock/storage/DrydockBlueprintTransaction.php', 'DrydockBlueprintTransaction' => 'applications/drydock/storage/DrydockBlueprintTransaction.php',
'DrydockBlueprintTransactionQuery' => 'applications/drydock/query/DrydockBlueprintTransactionQuery.php', 'DrydockBlueprintTransactionQuery' => 'applications/drydock/query/DrydockBlueprintTransactionQuery.php',
@ -5512,6 +5513,7 @@ phutil_register_library_map(array(
'PhabricatorCustomFieldInterface', 'PhabricatorCustomFieldInterface',
'PhabricatorNgramsInterface', 'PhabricatorNgramsInterface',
'PhabricatorProjectInterface', 'PhabricatorProjectInterface',
'PhabricatorConduitResultInterface',
), ),
'DrydockBlueprintController' => 'DrydockController', 'DrydockBlueprintController' => 'DrydockController',
'DrydockBlueprintCoreCustomField' => array( 'DrydockBlueprintCoreCustomField' => array(
@ -5530,6 +5532,7 @@ phutil_register_library_map(array(
'DrydockBlueprintNameNgrams' => 'PhabricatorSearchNgrams', 'DrydockBlueprintNameNgrams' => 'PhabricatorSearchNgrams',
'DrydockBlueprintPHIDType' => 'PhabricatorPHIDType', 'DrydockBlueprintPHIDType' => 'PhabricatorPHIDType',
'DrydockBlueprintQuery' => 'DrydockQuery', 'DrydockBlueprintQuery' => 'DrydockQuery',
'DrydockBlueprintSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockBlueprintTransaction' => 'PhabricatorApplicationTransaction', 'DrydockBlueprintTransaction' => 'PhabricatorApplicationTransaction',
'DrydockBlueprintTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'DrydockBlueprintTransactionQuery' => 'PhabricatorApplicationTransactionQuery',

View file

@ -0,0 +1,18 @@
<?php
final class DrydockBlueprintSearchConduitAPIMethod
extends PhabricatorSearchEngineAPIMethod {
public function getAPIMethodName() {
return 'drydock.blueprint.search';
}
public function newSearchEngine() {
return new DrydockBlueprintSearchEngine();
}
public function getMethodSummary() {
return pht('Retrieve information about Drydock blueprints.');
}
}

View file

@ -10,7 +10,8 @@ final class DrydockBlueprint extends DrydockDAO
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorCustomFieldInterface, PhabricatorCustomFieldInterface,
PhabricatorNgramsInterface, PhabricatorNgramsInterface,
PhabricatorProjectInterface { PhabricatorProjectInterface,
PhabricatorConduitResultInterface {
protected $className; protected $className;
protected $blueprintName; protected $blueprintName;
@ -360,4 +361,33 @@ final class DrydockBlueprint extends DrydockDAO
); );
} }
/* -( PhabricatorConduitResultInterface )---------------------------------- */
public function getFieldSpecificationsForConduit() {
return array(
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('name')
->setType('string')
->setDescription(pht('The name of this blueprint.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('type')
->setType('string')
->setDescription(pht('The type of resource this blueprint provides.')),
);
}
public function getFieldValuesForConduit() {
return array(
'name' => $this->getBlueprintName(),
'type' => $this->getImplementation()->getType(),
);
}
public function getConduitSearchAttachments() {
return array(
);
}
} }