2013-12-05 11:56:14 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
final class PhabricatorRepositoryPushLogSearchEngine
|
|
|
|
|
extends PhabricatorApplicationSearchEngine {
|
|
|
|
|
|
2014-06-12 13:22:20 -07:00
|
|
|
public function getResultTypeDescription() {
|
|
|
|
|
return pht('Push Logs');
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-04 15:47:48 -08:00
|
|
|
public function getApplicationClassName() {
|
2014-07-23 10:03:09 +10:00
|
|
|
return 'PhabricatorDiffusionApplication';
|
2014-05-09 12:28:02 -07:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 08:42:52 -08:00
|
|
|
public function newQuery() {
|
|
|
|
|
return new PhabricatorRepositoryPushLogQuery();
|
2013-12-05 11:56:14 -08:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 08:42:52 -08:00
|
|
|
protected function buildQueryFromParameters(array $map) {
|
|
|
|
|
$query = $this->newQuery();
|
2013-12-05 11:56:14 -08:00
|
|
|
|
2018-01-23 08:42:52 -08:00
|
|
|
if ($map['repositoryPHIDs']) {
|
|
|
|
|
$query->withRepositoryPHIDs($map['repositoryPHIDs']);
|
2013-12-05 11:59:33 -08:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 08:42:52 -08:00
|
|
|
if ($map['pusherPHIDs']) {
|
|
|
|
|
$query->withPusherPHIDs($map['pusherPHIDs']);
|
2013-12-05 11:59:33 -08:00
|
|
|
}
|
|
|
|
|
|
2013-12-05 11:56:14 -08:00
|
|
|
return $query;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-23 08:42:52 -08:00
|
|
|
protected function buildCustomSearchFields() {
|
|
|
|
|
return array(
|
|
|
|
|
id(new PhabricatorSearchDatasourceField())
|
|
|
|
|
->setDatasource(new DiffusionRepositoryDatasource())
|
|
|
|
|
->setKey('repositoryPHIDs')
|
|
|
|
|
->setAliases(array('repository', 'repositories', 'repositoryPHID'))
|
|
|
|
|
->setLabel(pht('Repositories'))
|
|
|
|
|
->setDescription(
|
|
|
|
|
pht('Search for pull logs for specific repositories.')),
|
|
|
|
|
id(new PhabricatorUsersSearchField())
|
|
|
|
|
->setKey('pusherPHIDs')
|
|
|
|
|
->setAliases(array('pusher', 'pushers', 'pusherPHID'))
|
|
|
|
|
->setLabel(pht('Pushers'))
|
|
|
|
|
->setDescription(
|
|
|
|
|
pht('Search for pull logs by specific users.')),
|
|
|
|
|
);
|
2013-12-05 11:56:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function getURI($path) {
|
|
|
|
|
return '/diffusion/pushlog/'.$path;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-07 07:34:51 +11:00
|
|
|
protected function getBuiltinQueryNames() {
|
2014-07-23 10:03:09 +10:00
|
|
|
return array(
|
2013-12-05 11:56:14 -08:00
|
|
|
'all' => pht('All Push Logs'),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function buildSavedQueryFromBuiltin($query_key) {
|
|
|
|
|
$query = $this->newSavedQuery();
|
|
|
|
|
$query->setQueryKey($query_key);
|
|
|
|
|
|
|
|
|
|
switch ($query_key) {
|
|
|
|
|
case 'all':
|
|
|
|
|
return $query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-13 14:00:24 -07:00
|
|
|
protected function renderResultList(
|
|
|
|
|
array $logs,
|
|
|
|
|
PhabricatorSavedQuery $query,
|
|
|
|
|
array $handles) {
|
|
|
|
|
|
2015-06-29 12:28:55 -07:00
|
|
|
$table = id(new DiffusionPushLogListView())
|
2016-04-19 20:25:21 -07:00
|
|
|
->setViewer($this->requireViewer())
|
2014-05-13 14:00:24 -07:00
|
|
|
->setLogs($logs);
|
|
|
|
|
|
2015-06-29 06:50:35 -07:00
|
|
|
return id(new PhabricatorApplicationSearchResultView())
|
2015-06-29 12:28:55 -07:00
|
|
|
->setTable($table);
|
2014-05-13 14:00:24 -07:00
|
|
|
}
|
|
|
|
|
|
2013-12-05 11:56:14 -08:00
|
|
|
}
|