Page MenuHomec4science

PhabricatorJenkinsJobDiffusionController.php
No OneTemporary

File Metadata

Created
Mon, Nov 11, 07:42

PhabricatorJenkinsJobDiffusionController.php

<?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