3 final class DrydockAuthorizationSearchEngine
4 extends PhabricatorApplicationSearchEngine
{
8 public function setBlueprint(DrydockBlueprint
$blueprint) {
9 $this->blueprint
= $blueprint;
13 public function getBlueprint() {
14 return $this->blueprint
;
17 public function getResultTypeDescription() {
18 return pht('Drydock Authorizations');
21 public function getApplicationClassName() {
22 return 'PhabricatorDrydockApplication';
25 public function canUseInPanelContext() {
29 public function newQuery() {
30 $query = new DrydockAuthorizationQuery();
32 $blueprint = $this->getBlueprint();
34 $query->withBlueprintPHIDs(array($blueprint->getPHID()));
40 protected function buildQueryFromParameters(array $map) {
41 $query = $this->newQuery();
43 if ($map['blueprintPHIDs']) {
44 $query->withBlueprintPHIDs($map['blueprintPHIDs']);
47 if ($map['objectPHIDs']) {
48 $query->withObjectPHIDs($map['objectPHIDs']);
54 protected function buildCustomSearchFields() {
56 id(new PhabricatorSearchDatasourceField())
57 ->setLabel(pht('Blueprints'))
58 ->setKey('blueprintPHIDs')
59 ->setConduitParameterType(new ConduitPHIDListParameterType())
60 ->setDescription(pht('Search authorizations for specific blueprints.'))
61 ->setAliases(array('blueprint', 'blueprints'))
62 ->setDatasource(new DrydockBlueprintDatasource()),
63 id(new PhabricatorPHIDsSearchField())
64 ->setLabel(pht('Objects'))
65 ->setKey('objectPHIDs')
66 ->setDescription(pht('Search authorizations from specific objects.'))
67 ->setAliases(array('object', 'objects')),
71 protected function getHiddenFields() {
78 protected function getURI($path) {
79 $blueprint = $this->getBlueprint();
81 throw new PhutilInvalidStateException('setBlueprint');
83 $id = $blueprint->getID();
84 return "/drydock/blueprint/{$id}/authorizations/".$path;
87 protected function getBuiltinQueryNames() {
89 'all' => pht('All Authorizations'),
93 public function buildSavedQueryFromBuiltin($query_key) {
94 $query = $this->newSavedQuery();
95 $query->setQueryKey($query_key);
102 return parent
::buildSavedQueryFromBuiltin($query_key);
105 protected function renderResultList(
106 array $authorizations,
107 PhabricatorSavedQuery
$query,
110 $list = id(new DrydockAuthorizationListView())
111 ->setUser($this->requireViewer())
112 ->setAuthorizations($authorizations);
114 $result = new PhabricatorApplicationSearchResultView();
115 $result->setTable($list);