Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891199
PhabricatorDashboardPanelDatasource.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorDashboardPanelDatasource.php
View Options
<?php
final
class
PhabricatorDashboardPanelDatasource
extends
PhabricatorTypeaheadDatasource
{
public
function
getBrowseTitle
(
)
{
return
pht
(
'Browse Dashboard Panels'
)
;
}
public
function
getPlaceholderText
(
)
{
return
pht
(
'Type a panel name...'
)
;
}
public
function
getDatasourceApplicationClass
(
)
{
return
PhabricatorDashboardApplication
::
class
;
}
public
function
loadResults
(
)
{
$results
=
$this
->
buildResults
(
)
;
return
$this
->
filterResultsAgainstTokens
(
$results
)
;
}
protected
function
renderSpecialTokens
(
array
$values
)
{
return
$this
->
renderTokensFromResults
(
$this
->
buildResults
(
)
,
$values
)
;
}
public
function
buildResults
(
)
{
$query
=
new
PhabricatorDashboardPanelQuery
(
)
;
$raw_query
=
$this
->
getRawQuery
(
)
;
if
(
preg_match
(
'/^[wW]\d+\z/'
,
$raw_query
)
)
{
$id
=
trim
(
$raw_query
,
'wW'
)
;
$id
=
(int)
$id
;
$query
->
withIDs
(
array
(
$id
)
)
;
}
else
{
$this
->
applyFerretConstraints
(
$query
,
id
(
new
PhabricatorDashboardPanel
(
)
)
->
newFerretEngine
(
)
,
'title'
,
$this
->
getRawQuery
(
)
)
;
}
$panels
=
$this
->
executeQuery
(
$query
)
;
$results
=
array
(
)
;
foreach
(
$panels
as
$panel
)
{
$impl
=
$panel
->
getImplementation
(
)
;
if
(
$impl
)
{
$type_text
=
$impl
->
getPanelTypeName
(
)
;
$icon
=
$impl
->
getIcon
(
)
;
}
else
{
$type_text
=
nonempty
(
$panel
->
getPanelType
(
)
,
pht
(
'Unknown Type'
)
)
;
$icon
=
'fa-question'
;
}
$phid
=
$panel
->
getPHID
(
)
;
$monogram
=
$panel
->
getMonogram
(
)
;
$properties
=
$panel
->
getProperties
(
)
;
$result
=
id
(
new
PhabricatorTypeaheadResult
(
)
)
->
setName
(
$monogram
.
' '
.
$panel
->
getName
(
)
)
->
setPHID
(
$phid
)
->
setIcon
(
$icon
)
->
addAttribute
(
$type_text
)
;
if
(
!
empty
(
$properties
[
'class'
]
)
)
{
$result
->
addAttribute
(
$properties
[
'class'
]
)
;
}
if
(
$panel
->
getIsArchived
(
)
)
{
$result
->
setClosed
(
pht
(
'Archived'
)
)
;
}
$results
[
$phid
]
=
$result
;
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 14:48 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125658
Default Alt Text
PhabricatorDashboardPanelDatasource.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment