Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72598077
AlmanacServiceDatasource.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 16, 02:04
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jul 18, 02:04 (2 d)
Engine
blob
Format
Raw Data
Handle
19075458
Attached To
rPH Phabricator
AlmanacServiceDatasource.php
View Options
<?php
final
class
AlmanacServiceDatasource
extends
PhabricatorTypeaheadDatasource
{
public
function
getBrowseTitle
()
{
return
pht
(
'Browse Services'
);
}
public
function
getPlaceholderText
()
{
return
pht
(
'Type a service name...'
);
}
public
function
getDatasourceApplicationClass
()
{
return
'PhabricatorAlmanacApplication'
;
}
public
function
loadResults
()
{
$viewer
=
$this
->
getViewer
();
$raw_query
=
$this
->
getRawQuery
();
$services
=
id
(
new
AlmanacServiceQuery
())
->
withNamePrefix
(
$raw_query
)
->
setOrder
(
'name'
);
// TODO: When service classes are restricted, it might be nice to customize
// the title and placeholder text to show which service types can be
// selected, or show all services but mark the invalid ones disabled and
// prevent their selection.
$service_types
=
$this
->
getParameter
(
'serviceTypes'
);
if
(
$service_types
)
{
$services
->
withServiceTypes
(
$service_types
);
}
$services
=
$this
->
executeQuery
(
$services
);
if
(
$services
)
{
$handles
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
mpull
(
$services
,
'getPHID'
))
->
execute
();
}
else
{
$handles
=
array
();
}
$results
=
array
();
foreach
(
$handles
as
$handle
)
{
$results
[]
=
id
(
new
PhabricatorTypeaheadResult
())
->
setName
(
$handle
->
getName
())
->
setPHID
(
$handle
->
getPHID
());
}
return
$results
;
}
}
Event Timeline
Log In to Comment