[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorRepositoryPushLogSearchEngine 4 extends PhabricatorApplicationSearchEngine { 5 6 public function getResultTypeDescription() { 7 return pht('Push Logs'); 8 } 9 10 public function getApplicationClassName() { 11 return 'PhabricatorDiffusionApplication'; 12 } 13 14 public function buildSavedQueryFromRequest(AphrontRequest $request) { 15 $saved = new PhabricatorSavedQuery(); 16 17 $saved->setParameter( 18 'repositoryPHIDs', 19 $this->readPHIDsFromRequest( 20 $request, 21 'repositories', 22 array( 23 PhabricatorRepositoryRepositoryPHIDType::TYPECONST, 24 ))); 25 26 $saved->setParameter( 27 'pusherPHIDs', 28 $this->readUsersFromRequest( 29 $request, 30 'pushers')); 31 32 return $saved; 33 } 34 35 public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 36 $query = id(new PhabricatorRepositoryPushLogQuery()); 37 38 $repository_phids = $saved->getParameter('repositoryPHIDs'); 39 if ($repository_phids) { 40 $query->withRepositoryPHIDs($repository_phids); 41 } 42 43 $pusher_phids = $saved->getParameter('pusherPHIDs'); 44 if ($pusher_phids) { 45 $query->withPusherPHIDs($pusher_phids); 46 } 47 48 return $query; 49 } 50 51 public function buildSearchForm( 52 AphrontFormView $form, 53 PhabricatorSavedQuery $saved_query) { 54 55 $repository_phids = $saved_query->getParameter('repositoryPHIDs', array()); 56 $pusher_phids = $saved_query->getParameter('pusherPHIDs', array()); 57 58 $all_phids = array_merge( 59 $repository_phids, 60 $pusher_phids); 61 62 if ($all_phids) { 63 $handles = id(new PhabricatorHandleQuery()) 64 ->setViewer($this->requireViewer()) 65 ->withPHIDs($all_phids) 66 ->execute(); 67 } else { 68 $handles = array(); 69 } 70 71 $repository_handles = array_select_keys($handles, $repository_phids); 72 $pusher_handles = array_select_keys($handles, $pusher_phids); 73 74 $form 75 ->appendChild( 76 id(new AphrontFormTokenizerControl()) 77 ->setDatasource(new DiffusionRepositoryDatasource()) 78 ->setName('repositories') 79 ->setLabel(pht('Repositories')) 80 ->setValue($repository_handles)) 81 ->appendChild( 82 id(new AphrontFormTokenizerControl()) 83 ->setDatasource(new PhabricatorPeopleDatasource()) 84 ->setName('pushers') 85 ->setLabel(pht('Pushers')) 86 ->setValue($pusher_handles)); 87 } 88 89 protected function getURI($path) { 90 return '/diffusion/pushlog/'.$path; 91 } 92 93 public function getBuiltinQueryNames() { 94 return array( 95 'all' => pht('All Push Logs'), 96 ); 97 } 98 99 public function buildSavedQueryFromBuiltin($query_key) { 100 $query = $this->newSavedQuery(); 101 $query->setQueryKey($query_key); 102 103 switch ($query_key) { 104 case 'all': 105 return $query; 106 } 107 108 return parent::buildSavedQueryFromBuiltin($query_key); 109 } 110 111 protected function getRequiredHandlePHIDsForResultList( 112 array $logs, 113 PhabricatorSavedQuery $query) { 114 return mpull($logs, 'getPusherPHID'); 115 } 116 117 protected function renderResultList( 118 array $logs, 119 PhabricatorSavedQuery $query, 120 array $handles) { 121 122 $table = id(new DiffusionPushLogListView()) 123 ->setUser($this->requireViewer()) 124 ->setHandles($handles) 125 ->setLogs($logs); 126 127 $box = id(new PHUIBoxView()) 128 ->addMargin(PHUI::MARGIN_LARGE) 129 ->appendChild($table); 130 131 return $box; 132 } 133 134 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |