Path: blob/master/src/applications/harbormaster/view/HarbormasterBuildLogView.php
12256 views
<?php12final class HarbormasterBuildLogView extends AphrontView {34private $log;5private $highlightedLineRange;6private $enableHighlighter;78public function setBuildLog(HarbormasterBuildLog $log) {9$this->log = $log;10return $this;11}1213public function getBuildLog() {14return $this->log;15}1617public function setHighlightedLineRange($range) {18$this->highlightedLineRange = $range;19return $this;20}2122public function getHighlightedLineRange() {23return $this->highlightedLineRange;24}2526public function setEnableHighlighter($enable) {27$this->enableHighlighter = $enable;28return $this;29}3031public function render() {32$viewer = $this->getViewer();33$log = $this->getBuildLog();34$id = $log->getID();3536$header = id(new PHUIHeaderView())37->setViewer($viewer)38->setHeader(pht('Build Log %d', $id));3940$download_uri = "/harbormaster/log/download/{$id}/";4142$can_download = (bool)$log->getFilePHID();4344$download_button = id(new PHUIButtonView())45->setTag('a')46->setHref($download_uri)47->setIcon('fa-download')48->setDisabled(!$can_download)49->setWorkflow(!$can_download)50->setText(pht('Download Log'));5152$header->addActionLink($download_button);5354$box_view = id(new PHUIObjectBoxView())55->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)56->setHeader($header);5758if ($this->enableHighlighter) {59Javelin::initBehavior('phabricator-line-linker');60}6162$has_linemap = $log->getLineMap();63if ($has_linemap) {64$content_id = celerity_generate_unique_node_id();65$content_div = javelin_tag(66'div',67array(68'id' => $content_id,69'class' => 'harbormaster-log-view-loading',70),71pht('Loading...'));7273require_celerity_resource('harbormaster-css');7475Javelin::initBehavior(76'harbormaster-log',77array(78'contentNodeID' => $content_id,79'initialURI' => $log->getRenderURI($this->getHighlightedLineRange()),80'renderURI' => $log->getRenderURI(null),81));8283$box_view->appendChild($content_div);84} else {85$box_view->setFormErrors(86array(87pht(88'This older log is missing required rendering data. To rebuild '.89'rendering data, run: %s',90phutil_tag(91'tt',92array(),93'$ bin/harbormaster rebuild-log --force --id '.$log->getID())),94));95}9697return $box_view;98}99100}101102103