Modernize "PhabricatorRepositoryPushLogSearchEngine"
Summary: Depends on D18917. Ref T13046. While I'm in here, update this to use more modern construction. Test Plan: Browed and queried for push logs. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13046 Differential Revision: https://secure.phabricator.com/D18918
This commit is contained in:
parent
778dfff277
commit
167e7932ef
|
@ -11,63 +11,40 @@ final class PhabricatorRepositoryPushLogSearchEngine
|
||||||
return 'PhabricatorDiffusionApplication';
|
return 'PhabricatorDiffusionApplication';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function newQuery() {
|
||||||
$saved = new PhabricatorSavedQuery();
|
return new PhabricatorRepositoryPushLogQuery();
|
||||||
|
|
||||||
$saved->setParameter(
|
|
||||||
'repositoryPHIDs',
|
|
||||||
$this->readPHIDsFromRequest(
|
|
||||||
$request,
|
|
||||||
'repositories',
|
|
||||||
array(
|
|
||||||
PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
|
||||||
)));
|
|
||||||
|
|
||||||
$saved->setParameter(
|
|
||||||
'pusherPHIDs',
|
|
||||||
$this->readUsersFromRequest(
|
|
||||||
$request,
|
|
||||||
'pushers'));
|
|
||||||
|
|
||||||
return $saved;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = id(new PhabricatorRepositoryPushLogQuery());
|
$query = $this->newQuery();
|
||||||
|
|
||||||
$repository_phids = $saved->getParameter('repositoryPHIDs');
|
if ($map['repositoryPHIDs']) {
|
||||||
if ($repository_phids) {
|
$query->withRepositoryPHIDs($map['repositoryPHIDs']);
|
||||||
$query->withRepositoryPHIDs($repository_phids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pusher_phids = $saved->getParameter('pusherPHIDs');
|
if ($map['pusherPHIDs']) {
|
||||||
if ($pusher_phids) {
|
$query->withPusherPHIDs($map['pusherPHIDs']);
|
||||||
$query->withPusherPHIDs($pusher_phids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSearchForm(
|
protected function buildCustomSearchFields() {
|
||||||
AphrontFormView $form,
|
return array(
|
||||||
PhabricatorSavedQuery $saved_query) {
|
id(new PhabricatorSearchDatasourceField())
|
||||||
|
->setDatasource(new DiffusionRepositoryDatasource())
|
||||||
$repository_phids = $saved_query->getParameter('repositoryPHIDs', array());
|
->setKey('repositoryPHIDs')
|
||||||
$pusher_phids = $saved_query->getParameter('pusherPHIDs', array());
|
->setAliases(array('repository', 'repositories', 'repositoryPHID'))
|
||||||
|
->setLabel(pht('Repositories'))
|
||||||
$form
|
->setDescription(
|
||||||
->appendControl(
|
pht('Search for pull logs for specific repositories.')),
|
||||||
id(new AphrontFormTokenizerControl())
|
id(new PhabricatorUsersSearchField())
|
||||||
->setDatasource(new DiffusionRepositoryDatasource())
|
->setKey('pusherPHIDs')
|
||||||
->setName('repositories')
|
->setAliases(array('pusher', 'pushers', 'pusherPHID'))
|
||||||
->setLabel(pht('Repositories'))
|
->setLabel(pht('Pushers'))
|
||||||
->setValue($repository_phids))
|
->setDescription(
|
||||||
->appendControl(
|
pht('Search for pull logs by specific users.')),
|
||||||
id(new AphrontFormTokenizerControl())
|
);
|
||||||
->setDatasource(new PhabricatorPeopleDatasource())
|
|
||||||
->setName('pushers')
|
|
||||||
->setLabel(pht('Pushers'))
|
|
||||||
->setValue($pusher_phids));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
|
|
Loading…
Reference in a new issue