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
|
|
|
}
|
|
|
|
|
|
2013-12-05 11:56:14 -08:00
|
|
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
|
|
|
|
$saved = new PhabricatorSavedQuery();
|
|
|
|
|
|
2013-12-05 11:59:33 -08:00
|
|
|
$saved->setParameter(
|
|
|
|
|
'repositoryPHIDs',
|
|
|
|
|
$this->readPHIDsFromRequest(
|
|
|
|
|
$request,
|
|
|
|
|
'repositories',
|
|
|
|
|
array(
|
2014-07-24 08:05:46 +10:00
|
|
|
PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
2013-12-05 11:59:33 -08:00
|
|
|
)));
|
|
|
|
|
|
|
|
|
|
$saved->setParameter(
|
|
|
|
|
'pusherPHIDs',
|
|
|
|
|
$this->readUsersFromRequest(
|
|
|
|
|
$request,
|
|
|
|
|
'pushers'));
|
|
|
|
|
|
2013-12-05 11:56:14 -08:00
|
|
|
return $saved;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
|
|
|
|
$query = id(new PhabricatorRepositoryPushLogQuery());
|
|
|
|
|
|
2013-12-05 11:59:33 -08:00
|
|
|
$repository_phids = $saved->getParameter('repositoryPHIDs');
|
|
|
|
|
if ($repository_phids) {
|
|
|
|
|
$query->withRepositoryPHIDs($repository_phids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pusher_phids = $saved->getParameter('pusherPHIDs');
|
|
|
|
|
if ($pusher_phids) {
|
|
|
|
|
$query->withPusherPHIDs($pusher_phids);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-05 11:56:14 -08:00
|
|
|
return $query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function buildSearchForm(
|
|
|
|
|
AphrontFormView $form,
|
|
|
|
|
PhabricatorSavedQuery $saved_query) {
|
|
|
|
|
|
2013-12-05 11:59:33 -08:00
|
|
|
$repository_phids = $saved_query->getParameter('repositoryPHIDs', array());
|
|
|
|
|
$pusher_phids = $saved_query->getParameter('pusherPHIDs', array());
|
|
|
|
|
|
|
|
|
|
$form
|
2015-03-31 14:10:55 -07:00
|
|
|
->appendControl(
|
2013-12-05 11:59:33 -08:00
|
|
|
id(new AphrontFormTokenizerControl())
|
2014-07-10 16:18:04 -07:00
|
|
|
->setDatasource(new DiffusionRepositoryDatasource())
|
2013-12-05 11:59:33 -08:00
|
|
|
->setName('repositories')
|
|
|
|
|
->setLabel(pht('Repositories'))
|
2015-03-31 14:10:55 -07:00
|
|
|
->setValue($repository_phids))
|
|
|
|
|
->appendControl(
|
2013-12-05 11:59:33 -08:00
|
|
|
id(new AphrontFormTokenizerControl())
|
2014-07-17 15:44:18 -07:00
|
|
|
->setDatasource(new PhabricatorPeopleDatasource())
|
2013-12-05 11:59:33 -08:00
|
|
|
->setName('pushers')
|
|
|
|
|
->setLabel(pht('Pushers'))
|
2015-03-31 14:10:55 -07:00
|
|
|
->setValue($pusher_phids));
|
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
|
|
|
}
|