1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Add a "(prototype)" link to the standalone build log on build pages

Summary: Depends on D19149. Ref T13088. Since the new log requires a bunch of log reprocessing, the cutover is going to require at least some time for installs to run migrations. Add a link in the UI to ease the transition, smooth over some behaviors a little, and fix a fetch issue where we'd request past the end of the log (since this is now enforced).

Test Plan: Viewed a traditional Harbormaster build, saw links to the new standalone log pages.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13088

Differential Revision: https://secure.phabricator.com/D19150
This commit is contained in:
epriestley 2018-02-28 06:39:30 -08:00
parent 143033dc1f
commit dc6a66f7f4
4 changed files with 55 additions and 21 deletions

View file

@ -105,7 +105,13 @@ final class HarbormasterBuildLogRenderController
$reads = $this->mergeOverlappingReads($reads); $reads = $this->mergeOverlappingReads($reads);
foreach ($reads as $key => $read) { foreach ($reads as $key => $read) {
$data = $log->loadData($read['fetchOffset'], $read['fetchLength']); $fetch_offset = $read['fetchOffset'];
$fetch_length = $read['fetchLength'];
if ($fetch_offset + $fetch_length > $log_size) {
$fetch_length = $log_size - $fetch_offset;
}
$data = $log->loadData($fetch_offset, $fetch_length);
$offset = $read['fetchOffset']; $offset = $read['fetchOffset'];
$line = $read['fetchLine']; $line = $read['fetchLine'];

View file

@ -16,6 +16,9 @@ final class HarbormasterBuildLogViewController
return new Aphront404Response(); return new Aphront404Response();
} }
$target = $log->getBuildTarget();
$build = $target->getBuild();
$page_title = pht('Build Log %d', $log->getID()); $page_title = pht('Build Log %d', $log->getID());
$log_view = id(new HarbormasterBuildLogView()) $log_view = id(new HarbormasterBuildLogView())
@ -25,6 +28,9 @@ final class HarbormasterBuildLogViewController
$crumbs = $this->buildApplicationCrumbs() $crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Build Logs')) ->addTextCrumb(pht('Build Logs'))
->addTextCrumb(
pht('Build %d', $build->getID()),
$build->getURI())
->addTextCrumb($page_title) ->addTextCrumb($page_title)
->setBorder(true); ->setBorder(true);

View file

@ -363,12 +363,19 @@ final class HarbormasterBuildViewController
$log_view->setLines($lines); $log_view->setLines($lines);
$log_view->setStart($start); $log_view->setStart($start);
$prototype_view = id(new PHUIButtonView())
->setTag('a')
->setHref($log->getURI())
->setIcon('fa-file-text-o')
->setText(pht('New View (Prototype)'));
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader(pht( ->setHeader(pht(
'Build Log %d (%s - %s)', 'Build Log %d (%s - %s)',
$log->getID(), $log->getID(),
$log->getLogSource(), $log->getLogSource(),
$log->getLogType())) $log->getLogType()))
->addActionLink($prototype_view)
->setSubheader($this->createLogHeader($build, $log)) ->setSubheader($this->createLogHeader($build, $log))
->setUser($viewer); ->setUser($viewer);

View file

@ -44,6 +44,12 @@ final class HarbormasterBuildLogView extends AphrontView {
$header->addActionLink($download_button); $header->addActionLink($download_button);
$box_view = id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setHeader($header);
$has_linemap = $log->getLineMap();
if ($has_linemap) {
$content_id = celerity_generate_unique_node_id(); $content_id = celerity_generate_unique_node_id();
$content_div = javelin_tag( $content_div = javelin_tag(
'div', 'div',
@ -62,10 +68,19 @@ final class HarbormasterBuildLogView extends AphrontView {
'renderURI' => $log->getRenderURI($this->getHighlightedLineRange()), 'renderURI' => $log->getRenderURI($this->getHighlightedLineRange()),
)); ));
$box_view = id(new PHUIObjectBoxView()) $box_view->appendChild($content_div);
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) } else {
->setHeader($header) $box_view->setFormErrors(
->appendChild($content_div); array(
pht(
'This older log is missing required rendering data. To rebuild '.
'rendering data, run: %s',
phutil_tag(
'tt',
array(),
'$ bin/harbormaster rebuild-log --force --id '.$log->getID())),
));
}
return $box_view; return $box_view;
} }