Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92817122
PhabricatorJenkinsJobDiffusionController.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
Sat, Nov 23, 22:40
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Nov 25, 22:40 (2 d)
Engine
blob
Format
Raw Data
Handle
22518010
Attached To
rPH Phabricator
PhabricatorJenkinsJobDiffusionController.php
View Options
<?php
final
class
DiffusionJenkinsJobController
extends
DiffusionController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$have_jenkins
=
PhabricatorApplication
::
isClassInstalledForViewer
(
'PhabricatorJenkinsJobApplication'
,
$viewer
);
if
(!
$have_jenkins
)
{
return
new
Aphront404Response
();
}
$response
=
$this
->
loadDiffusionContext
();
if
(
$response
)
{
return
$response
;
}
$viewer
=
$this
->
getViewer
();
$drequest
=
$this
->
getDiffusionRequest
();
$repository
=
$drequest
->
getRepository
();
$pager
=
id
(
new
PHUIPagerView
())
->
readFromRequest
(
$request
);
$header
=
$this
->
buildHeader
(
$drequest
);
$crumbs
=
$this
->
buildCrumbs
(
array
(
'branch'
=>
true
,
'path'
=>
true
,
'view'
=>
'jobs'
,
));
$crumbs
->
setBorder
(
true
);
$title
=
array
(
pht
(
'Jenkins Job'
),
$repository
->
getDisplayName
(),
);
$pager
=
id
(
new
PHUIBoxView
())
->
addClass
(
'mlb'
)
->
appendChild
(
$pager
);
$tabs
=
$this
->
buildTabsView
(
'jobs'
);
$list
=
PhabricatorJenkinsJobController
::
createObjectList
(
$viewer
,
null
,
$repository
->
getPHID
());
$box
=
id
(
new
PHUIObjectBoxView
())
->
setObjectList
(
$list
);
$view
=
id
(
new
PHUITwoColumnView
())
->
setHeader
(
$header
)
->
setTabs
(
$tabs
)
->
setFooter
(
$box
);
return
$this
->
newPage
()
->
setTitle
(
$title
)
->
setCrumbs
(
$crumbs
)
->
appendChild
(
$view
)
->
addClass
(
'diffusion-history-view'
);
}
private
function
buildHeader
(
DiffusionRequest
$drequest
)
{
$viewer
=
$this
->
getViewer
();
$no_path
=
!
strlen
(
$drequest
->
getPath
());
if
(
$no_path
)
{
$header_text
=
pht
(
'Jenkins Job'
);
}
else
{
$header_text
=
$this
->
renderPathLinks
(
$drequest
,
$mode
=
'jobs'
);
}
$header
=
id
(
new
PHUIHeaderView
())
->
setUser
(
$viewer
)
->
setHeader
(
$header_text
)
->
setHeaderIcon
(
'fa-cogs'
);
return
$header
;
}
}
Event Timeline
Log In to Comment