Differential D18918 Diff 45349 src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
<?php | <?php | ||||
final class PhabricatorRepositoryPushLogSearchEngine | final class PhabricatorRepositoryPushLogSearchEngine | ||||
extends PhabricatorApplicationSearchEngine { | extends PhabricatorApplicationSearchEngine { | ||||
public function getResultTypeDescription() { | public function getResultTypeDescription() { | ||||
return pht('Push Logs'); | return pht('Push Logs'); | ||||
} | } | ||||
public function getApplicationClassName() { | public function getApplicationClassName() { | ||||
return 'PhabricatorDiffusionApplication'; | return 'PhabricatorDiffusionApplication'; | ||||
} | } | ||||
public function buildSavedQueryFromRequest(AphrontRequest $request) { | public function newQuery() { | ||||
$saved = new PhabricatorSavedQuery(); | return new PhabricatorRepositoryPushLogQuery(); | ||||
} | |||||
protected function buildQueryFromParameters(array $map) { | |||||
$query = $this->newQuery(); | |||||
if ($map['repositoryPHIDs']) { | |||||
$query->withRepositoryPHIDs($map['repositoryPHIDs']); | |||||
} | |||||
$saved->setParameter( | if ($map['pusherPHIDs']) { | ||||
'repositoryPHIDs', | $query->withPusherPHIDs($map['pusherPHIDs']); | ||||
$this->readPHIDsFromRequest( | |||||
$request, | |||||
'repositories', | |||||
array( | |||||
PhabricatorRepositoryRepositoryPHIDType::TYPECONST, | |||||
))); | |||||
$saved->setParameter( | |||||
'pusherPHIDs', | |||||
$this->readUsersFromRequest( | |||||
$request, | |||||
'pushers')); | |||||
return $saved; | |||||
} | |||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { | |||||
$query = id(new PhabricatorRepositoryPushLogQuery()); | |||||
$repository_phids = $saved->getParameter('repositoryPHIDs'); | |||||
if ($repository_phids) { | |||||
$query->withRepositoryPHIDs($repository_phids); | |||||
} | |||||
$pusher_phids = $saved->getParameter('pusherPHIDs'); | |||||
if ($pusher_phids) { | |||||
$query->withPusherPHIDs($pusher_phids); | |||||
} | } | ||||
return $query; | return $query; | ||||
} | } | ||||
public function buildSearchForm( | protected function buildCustomSearchFields() { | ||||
AphrontFormView $form, | return array( | ||||
PhabricatorSavedQuery $saved_query) { | id(new PhabricatorSearchDatasourceField()) | ||||
$repository_phids = $saved_query->getParameter('repositoryPHIDs', array()); | |||||
$pusher_phids = $saved_query->getParameter('pusherPHIDs', array()); | |||||
$form | |||||
->appendControl( | |||||
id(new AphrontFormTokenizerControl()) | |||||
->setDatasource(new DiffusionRepositoryDatasource()) | ->setDatasource(new DiffusionRepositoryDatasource()) | ||||
->setName('repositories') | ->setKey('repositoryPHIDs') | ||||
->setAliases(array('repository', 'repositories', 'repositoryPHID')) | |||||
->setLabel(pht('Repositories')) | ->setLabel(pht('Repositories')) | ||||
->setValue($repository_phids)) | ->setDescription( | ||||
->appendControl( | pht('Search for pull logs for specific repositories.')), | ||||
id(new AphrontFormTokenizerControl()) | id(new PhabricatorUsersSearchField()) | ||||
->setDatasource(new PhabricatorPeopleDatasource()) | ->setKey('pusherPHIDs') | ||||
->setName('pushers') | ->setAliases(array('pusher', 'pushers', 'pusherPHID')) | ||||
->setLabel(pht('Pushers')) | ->setLabel(pht('Pushers')) | ||||
->setValue($pusher_phids)); | ->setDescription( | ||||
pht('Search for pull logs by specific users.')), | |||||
); | |||||
} | } | ||||
protected function getURI($path) { | protected function getURI($path) { | ||||
return '/diffusion/pushlog/'.$path; | return '/diffusion/pushlog/'.$path; | ||||
} | } | ||||
protected function getBuiltinQueryNames() { | protected function getBuiltinQueryNames() { | ||||
return array( | return array( | ||||
Show All 30 Lines |