Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106486681
HarbormasterStepViewController.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
Wed, Mar 26, 06:00
Size
3 KB
Mime Type
text/x-php
Expires
Fri, Mar 28, 06:00 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25185756
Attached To
rPH Phabricator
HarbormasterStepViewController.php
View Options
<?php
final
class
HarbormasterStepViewController
extends
HarbormasterPlanController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$step
=
id
(
new
HarbormasterBuildStepQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
executeOne
();
if
(!
$step
)
{
return
new
Aphront404Response
();
}
$plan
=
$step
->
getBuildPlan
();
$plan_id
=
$plan
->
getID
();
$plan_uri
=
$this
->
getApplicationURI
(
"plan/{$plan_id}/"
);
$field_list
=
PhabricatorCustomField
::
getObjectFields
(
$step
,
PhabricatorCustomField
::
ROLE_VIEW
);
$field_list
->
setViewer
(
$viewer
)
->
readFieldsFromStorage
(
$step
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'Plan %d'
,
$plan_id
),
$plan_uri
);
$crumbs
->
addTextCrumb
(
pht
(
'Step %d'
,
$id
));
$crumbs
->
setBorder
(
true
);
$header
=
id
(
new
PHUIHeaderView
())
->
setHeader
(
pht
(
'Build Step %d: %s'
,
$id
,
$step
->
getName
()))
->
setHeaderIcon
(
'fa-chevron-circle-right'
);
$properties
=
$this
->
buildPropertyList
(
$step
,
$field_list
);
$curtain
=
$this
->
buildCurtainView
(
$step
);
$timeline
=
$this
->
buildTransactionTimeline
(
$step
,
new
HarbormasterBuildStepTransactionQuery
());
$timeline
->
setShouldTerminate
(
true
);
$view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setCurtain
(
$curtain
)
->
setMainColumn
(
array
(
$properties
,
$timeline
,
));
return
$this
->
newPage
()
->
setTitle
(
pht
(
'Step %d'
,
$id
))
->
setCrumbs
(
$crumbs
)
->
appendChild
(
$view
);
}
private
function
buildPropertyList
(
HarbormasterBuildStep
$step
,
PhabricatorCustomFieldList
$field_list
)
{
$viewer
=
$this
->
getViewer
();
$view
=
id
(
new
PHUIPropertyListView
())
->
setUser
(
$viewer
);
try
{
$implementation
=
$step
->
getStepImplementation
();
}
catch
(
Exception
$ex
)
{
$implementation
=
null
;
}
if
(
$implementation
)
{
$type
=
$implementation
->
getName
();
}
else
{
$type
=
phutil_tag
(
'em'
,
array
(),
pht
(
'Invalid Implementation ("%s")!'
,
$step
->
getClassName
()));
}
$view
->
addProperty
(
pht
(
'Step Type'
),
$type
);
$view
->
addProperty
(
pht
(
'Created'
),
phabricator_datetime
(
$step
->
getDateCreated
(),
$viewer
));
$field_list
->
appendFieldsToPropertyList
(
$step
,
$viewer
,
$view
);
$description
=
$step
->
getDescription
();
if
(
strlen
(
$description
))
{
$view
->
addSectionHeader
(
pht
(
'Description'
),
PHUIPropertyListView
::
ICON_SUMMARY
);
$view
->
addTextContent
(
new
PHUIRemarkupView
(
$viewer
,
$description
));
}
return
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Properties'
))
->
setBackground
(
PHUIObjectBoxView
::
BLUE_PROPERTY
)
->
appendChild
(
$view
);
}
private
function
buildCurtainView
(
HarbormasterBuildStep
$step
)
{
$viewer
=
$this
->
getViewer
();
$id
=
$step
->
getID
();
$curtain
=
$this
->
newCurtainView
(
$step
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$step
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Edit Step'
))
->
setHref
(
$this
->
getApplicationURI
(
"step/edit/{$id}/"
))
->
setWorkflow
(!
$can_edit
)
->
setDisabled
(!
$can_edit
)
->
setIcon
(
'fa-pencil'
));
$curtain
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Delete Step'
))
->
setHref
(
$this
->
getApplicationURI
(
"step/delete/{$id}/"
))
->
setWorkflow
(
true
)
->
setDisabled
(!
$can_edit
)
->
setIcon
(
'fa-times'
));
return
$curtain
;
}
}
Event Timeline
Log In to Comment