1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-13 15:28:35 +01:00
phorge-phorge/src/applications/harbormaster/view/HarbormasterBuildLogView.php
epriestley 9b4295ed60 Add a very basic standalone view for build logs with a "Download Log" button
Summary: Depends on D19132. Ref T13088. This implements an extremely skeletal dedicated log page with a more-or-less functional "Download Log" button.

Test Plan: Downloaded a recent log. Tried to download an old (un-finalized) log, couldn't. Used `bin/harbormaster write-log` to get a convenient standalone link to a log.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13088

Differential Revision: https://secure.phabricator.com/D19133
2018-02-26 17:53:10 -08:00

45 lines
1,012 B
PHP

<?php
final class HarbormasterBuildLogView extends AphrontView {
private $log;
public function setBuildLog(HarbormasterBuildLog $log) {
$this->log = $log;
return $this;
}
public function getBuildLog() {
return $this->log;
}
public function render() {
$viewer = $this->getViewer();
$log = $this->getBuildLog();
$id = $log->getID();
$header = id(new PHUIHeaderView())
->setViewer($viewer)
->setHeader(pht('Build Log %d', $id));
$download_uri = "/harbormaster/log/download/{$id}/";
$download_button = id(new PHUIButtonView())
->setTag('a')
->setHref($download_uri)
->setIcon('fa-download')
->setDisabled(!$log->getFilePHID())
->setWorkflow(true)
->setText(pht('Download Log'));
$header->addActionLink($download_button);
$box_view = id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setHeader($header)
->appendChild('...');
return $box_view;
}
}