Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F574044
HarbormasterArtifactSearchEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
HarbormasterArtifactSearchEngine.php
View Options
<?php
final
class
HarbormasterArtifactSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
getResultTypeDescription
()
{
return
pht
(
'Harbormaster Artifacts'
);
}
public
function
getApplicationClassName
()
{
return
PhabricatorHarbormasterApplication
::
class
;
}
public
function
newQuery
()
{
return
new
HarbormasterBuildArtifactQuery
();
}
protected
function
buildCustomSearchFields
()
{
return
array
(
id
(
new
PhabricatorPHIDsSearchField
())
->
setLabel
(
pht
(
'Targets'
))
->
setKey
(
'buildTargetPHIDs'
)
->
setAliases
(
array
(
'buildTargetPHID'
,
'buildTargets'
,
'buildTarget'
,
'targetPHIDs'
,
'targetPHID'
,
'targets'
,
'target'
,
))
->
setDescription
(
pht
(
'Search for artifacts attached to particular build targets.'
)),
);
}
protected
function
buildQueryFromParameters
(
array
$map
)
{
$query
=
$this
->
newQuery
();
if
(
$map
[
'buildTargetPHIDs'
])
{
$query
->
withBuildTargetPHIDs
(
$map
[
'buildTargetPHIDs'
]);
}
return
$query
;
}
protected
function
getURI
(
$path
)
{
return
'/harbormaster/artifact/'
.
$path
;
}
protected
function
getBuiltinQueryNames
()
{
return
array
(
'all'
=>
pht
(
'All Artifacts'
),
);
}
public
function
buildSavedQueryFromBuiltin
(
$query_key
)
{
$query
=
$this
->
newSavedQuery
();
$query
->
setQueryKey
(
$query_key
);
switch
(
$query_key
)
{
case
'all'
:
return
$query
;
}
return
parent
::
buildSavedQueryFromBuiltin
(
$query_key
);
}
protected
function
renderResultList
(
array
$artifacts
,
PhabricatorSavedQuery
$query
,
array
$handles
)
{
assert_instances_of
(
$artifacts
,
'HarbormasterBuildArtifact'
);
$viewer
=
$this
->
requireViewer
();
$list
=
new
PHUIObjectItemListView
();
foreach
(
$artifacts
as
$artifact
)
{
$id
=
$artifact
->
getID
();
$item
=
id
(
new
PHUIObjectItemView
())
->
setObjectName
(
pht
(
'Artifact %d'
,
$id
));
$list
->
addItem
(
$item
);
}
return
id
(
new
PhabricatorApplicationSearchResultView
())
->
setObjectList
(
$list
)
->
setNoDataString
(
pht
(
'No artifacts found.'
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 6:18 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
125369
Default Alt Text
HarbormasterArtifactSearchEngine.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment