@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 71 lines 1.6 kB view raw
1<?php 2 3final class AlmanacInterfaceSearchEngine 4 extends PhabricatorApplicationSearchEngine { 5 6 public function getResultTypeDescription() { 7 return pht('Almanac Interfaces'); 8 } 9 10 public function getApplicationClassName() { 11 return PhabricatorAlmanacApplication::class; 12 } 13 14 public function newQuery() { 15 return new AlmanacInterfaceQuery(); 16 } 17 18 protected function buildCustomSearchFields() { 19 return array( 20 id(new PhabricatorPHIDsSearchField()) 21 ->setLabel(pht('Devices')) 22 ->setKey('devicePHIDs') 23 ->setAliases(array('device', 'devicePHID', 'devices')) 24 ->setDescription(pht('Search for interfaces on particular devices.')), 25 ); 26 } 27 28 protected function buildQueryFromParameters(array $map) { 29 $query = $this->newQuery(); 30 31 if ($map['devicePHIDs']) { 32 $query->withDevicePHIDs($map['devicePHIDs']); 33 } 34 35 return $query; 36 } 37 38 protected function getURI($path) { 39 return '/almanac/interface/'.$path; 40 } 41 42 protected function getBuiltinQueryNames() { 43 $names = array( 44 'all' => pht('All Interfaces'), 45 ); 46 47 return $names; 48 } 49 50 public function buildSavedQueryFromBuiltin($query_key) { 51 $query = $this->newSavedQuery(); 52 $query->setQueryKey($query_key); 53 54 switch ($query_key) { 55 case 'all': 56 return $query; 57 } 58 59 return parent::buildSavedQueryFromBuiltin($query_key); 60 } 61 62 protected function renderResultList( 63 array $devices, 64 PhabricatorSavedQuery $query, 65 array $handles) { 66 67 // For now, this SearchEngine just supports API access via Conduit. 68 throw new PhutilMethodNotImplementedException(); 69 } 70 71}