Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / harbormaster / view / HarbormasterBuildLogView.php
blob5eb32a84e510e898b5a8183c98fdf5eaad392506
1 <?php
3 final class HarbormasterBuildLogView extends AphrontView {
5 private $log;
6 private $highlightedLineRange;
7 private $enableHighlighter;
9 public function setBuildLog(HarbormasterBuildLog $log) {
10 $this->log = $log;
11 return $this;
14 public function getBuildLog() {
15 return $this->log;
18 public function setHighlightedLineRange($range) {
19 $this->highlightedLineRange = $range;
20 return $this;
23 public function getHighlightedLineRange() {
24 return $this->highlightedLineRange;
27 public function setEnableHighlighter($enable) {
28 $this->enableHighlighter = $enable;
29 return $this;
32 public function render() {
33 $viewer = $this->getViewer();
34 $log = $this->getBuildLog();
35 $id = $log->getID();
37 $header = id(new PHUIHeaderView())
38 ->setViewer($viewer)
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())
46 ->setTag('a')
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)
57 ->setHeader($header);
59 if ($this->enableHighlighter) {
60 Javelin::initBehavior('phabricator-line-linker');
63 $has_linemap = $log->getLineMap();
64 if ($has_linemap) {
65 $content_id = celerity_generate_unique_node_id();
66 $content_div = javelin_tag(
67 'div',
68 array(
69 'id' => $content_id,
70 'class' => 'harbormaster-log-view-loading',
72 pht('Loading...'));
74 require_celerity_resource('harbormaster-css');
76 Javelin::initBehavior(
77 'harbormaster-log',
78 array(
79 'contentNodeID' => $content_id,
80 'initialURI' => $log->getRenderURI($this->getHighlightedLineRange()),
81 'renderURI' => $log->getRenderURI(null),
82 ));
84 $box_view->appendChild($content_div);
85 } else {
86 $box_view->setFormErrors(
87 array(
88 pht(
89 'This older log is missing required rendering data. To rebuild '.
90 'rendering data, run: %s',
91 phutil_tag(
92 'tt',
93 array(),
94 '$ bin/harbormaster rebuild-log --force --id '.$log->getID())),
95 ));
98 return $box_view;