Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/harbormaster/query/HarbormasterBuildLogSearchEngine.php
12256 views
1
<?php
2
3
final 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';
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
}
80
81