@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
1<?php
2
3final class HarbormasterBuildLogSearchEngine
4 extends PhabricatorApplicationSearchEngine {
5
6 public function getResultTypeDescription() {
7 return pht('Harbormaster Build Logs');
8 }
9
10 public function getApplicationClassName() {
11 return PhabricatorHarbormasterApplication::class;
12 }
13
14 public function newQuery() {
15 return new HarbormasterBuildLogQuery();
16 }
17
18 protected function buildCustomSearchFields() {
19 return array(
20 id(new PhabricatorPHIDsSearchField())
21 ->setLabel(pht('Build Targets'))
22 ->setKey('buildTargetPHIDs')
23 ->setAliases(
24 array(
25 'buildTargetPHID',
26 'buildTargets',
27 'buildTarget',
28 'targetPHIDs',
29 'targetPHID',
30 'targets',
31 'target',
32 ))
33 ->setDescription(
34 pht('Search for logs that belong to a particular build target.')),
35 );
36 }
37
38 protected function buildQueryFromParameters(array $map) {
39 $query = $this->newQuery();
40
41 if ($map['buildTargetPHIDs']) {
42 $query->withBuildTargetPHIDs($map['buildTargetPHIDs']);
43 }
44
45 return $query;
46 }
47
48 protected function getURI($path) {
49 return '/harbormaster/log/'.$path;
50 }
51
52 protected function getBuiltinQueryNames() {
53 return array(
54 'all' => pht('All Builds'),
55 );
56 }
57
58 public function buildSavedQueryFromBuiltin($query_key) {
59 $query = $this->newSavedQuery();
60 $query->setQueryKey($query_key);
61
62 switch ($query_key) {
63 case 'all':
64 return $query;
65 }
66
67 return parent::buildSavedQueryFromBuiltin($query_key);
68 }
69
70 protected function renderResultList(
71 array $builds,
72 PhabricatorSavedQuery $query,
73 array $handles) {
74
75 // For now, this SearchEngine is only for driving the API.
76 throw new PhutilMethodNotImplementedException();
77 }
78
79}