3 final class HarbormasterBuildLogView
extends AphrontView
{
6 private $highlightedLineRange;
7 private $enableHighlighter;
9 public function setBuildLog(HarbormasterBuildLog
$log) {
14 public function getBuildLog() {
18 public function setHighlightedLineRange($range) {
19 $this->highlightedLineRange
= $range;
23 public function getHighlightedLineRange() {
24 return $this->highlightedLineRange
;
27 public function setEnableHighlighter($enable) {
28 $this->enableHighlighter
= $enable;
32 public function render() {
33 $viewer = $this->getViewer();
34 $log = $this->getBuildLog();
37 $header = id(new PHUIHeaderView())
39 ->setHeader(pht('Build Log %d', $id));
41 $download_uri = "/harbormaster/log/download/{$id}/";
43 $can_download = (bool)$log->getFilePHID();
45 $download_button = id(new PHUIButtonView())
47 ->setHref($download_uri)
48 ->setIcon('fa-download')
49 ->setDisabled(!$can_download)
50 ->setWorkflow(!$can_download)
51 ->setText(pht('Download Log'));
53 $header->addActionLink($download_button);
55 $box_view = id(new PHUIObjectBoxView())
56 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
59 if ($this->enableHighlighter
) {
60 Javelin
::initBehavior('phabricator-line-linker');
63 $has_linemap = $log->getLineMap();
65 $content_id = celerity_generate_unique_node_id();
66 $content_div = javelin_tag(
70 'class' => 'harbormaster-log-view-loading',
74 require_celerity_resource('harbormaster-css');
76 Javelin
::initBehavior(
79 'contentNodeID' => $content_id,
80 'initialURI' => $log->getRenderURI($this->getHighlightedLineRange()),
81 'renderURI' => $log->getRenderURI(null),
84 $box_view->appendChild($content_div);
86 $box_view->setFormErrors(
89 'This older log is missing required rendering data. To rebuild '.
90 'rendering data, run: %s',
94 '$ bin/harbormaster rebuild-log --force --id '.$log->getID())),