Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F108573454
DiffusionRepositoryBranchesManagementPanel.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
Thu, Apr 17, 12:01
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Apr 19, 12:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25575455
Attached To
rPH Phabricator
DiffusionRepositoryBranchesManagementPanel.php
View Options
<?php
final
class
DiffusionRepositoryBranchesManagementPanel
extends
DiffusionRepositoryManagementPanel
{
const
PANELKEY
=
'branches'
;
public
function
getManagementPanelLabel
()
{
return
pht
(
'Branches'
);
}
public
function
getManagementPanelOrder
()
{
return
1000
;
}
// c4science customization
public
function
allowAccess
()
{
return
true
;
}
public
function
shouldEnableForRepository
(
PhabricatorRepository
$repository
)
{
return
(
$repository
->
isGit
()
||
$repository
->
isHg
());
}
public
function
getManagementPanelIcon
()
{
$repository
=
$this
->
getRepository
();
$has_any
=
$repository
->
getDetail
(
'default-branch'
)
||
$repository
->
getDetail
(
'branch-filter'
)
||
$repository
->
getDetail
(
'close-commits-filter'
);
if
(
$has_any
)
{
return
'fa-code-fork'
;
}
else
{
return
'fa-code-fork grey'
;
}
}
protected
function
getEditEngineFieldKeys
()
{
return
array
(
'defaultBranch'
,
'trackOnly'
,
'autocloseOnly'
,
);
}
public
function
buildManagementPanelCurtain
()
{
$repository
=
$this
->
getRepository
();
$viewer
=
$this
->
getViewer
();
$action_list
=
$this
->
getNewActionList
();
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$repository
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$branches_uri
=
$this
->
getEditPageURI
();
$action_list
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setIcon
(
'fa-pencil'
)
->
setName
(
pht
(
'Edit Branches'
))
->
setHref
(
$branches_uri
)
->
setDisabled
(!
$can_edit
)
->
setWorkflow
(!
$can_edit
));
return
$this
->
getNewCurtainView
(
$action_list
);
}
public
function
buildManagementPanelContent
()
{
$repository
=
$this
->
getRepository
();
$viewer
=
$this
->
getViewer
();
$view
=
id
(
new
PHUIPropertyListView
())
->
setViewer
(
$viewer
);
$default_branch
=
nonempty
(
$repository
->
getHumanReadableDetail
(
'default-branch'
),
phutil_tag
(
'em'
,
array
(),
$repository
->
getDefaultBranch
()));
$view
->
addProperty
(
pht
(
'Default Branch'
),
$default_branch
);
$track_only
=
nonempty
(
$repository
->
getHumanReadableDetail
(
'branch-filter'
,
array
()),
phutil_tag
(
'em'
,
array
(),
pht
(
'Track All Branches'
)));
$view
->
addProperty
(
pht
(
'Track Only'
),
$track_only
);
$autoclose_only
=
nonempty
(
$repository
->
getHumanReadableDetail
(
'close-commits-filter'
,
array
()),
phutil_tag
(
'em'
,
array
(),
pht
(
'Autoclose On All Branches'
)));
if
(
$repository
->
getDetail
(
'disable-autoclose'
))
{
$autoclose_only
=
phutil_tag
(
'em'
,
array
(),
pht
(
'Disabled'
));
}
$view
->
addProperty
(
pht
(
'Autoclose Only'
),
$autoclose_only
);
return
$this
->
newBox
(
pht
(
'Branches'
),
$view
);
}
}
Event Timeline
Log In to Comment