mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23: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:
parent
143033dc1f
commit
dc6a66f7f4
4 changed files with 55 additions and 21 deletions
|
@ -105,7 +105,13 @@ final class HarbormasterBuildLogRenderController
|
|||
$reads = $this->mergeOverlappingReads($reads);
|
||||
|
||||
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'];
|
||||
$line = $read['fetchLine'];
|
||||
|
|
|
@ -16,6 +16,9 @@ final class HarbormasterBuildLogViewController
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$target = $log->getBuildTarget();
|
||||
$build = $target->getBuild();
|
||||
|
||||
$page_title = pht('Build Log %d', $log->getID());
|
||||
|
||||
$log_view = id(new HarbormasterBuildLogView())
|
||||
|
@ -25,6 +28,9 @@ final class HarbormasterBuildLogViewController
|
|||
|
||||
$crumbs = $this->buildApplicationCrumbs()
|
||||
->addTextCrumb(pht('Build Logs'))
|
||||
->addTextCrumb(
|
||||
pht('Build %d', $build->getID()),
|
||||
$build->getURI())
|
||||
->addTextCrumb($page_title)
|
||||
->setBorder(true);
|
||||
|
||||
|
|
|
@ -363,12 +363,19 @@ final class HarbormasterBuildViewController
|
|||
$log_view->setLines($lines);
|
||||
$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())
|
||||
->setHeader(pht(
|
||||
'Build Log %d (%s - %s)',
|
||||
$log->getID(),
|
||||
$log->getLogSource(),
|
||||
$log->getLogType()))
|
||||
->addActionLink($prototype_view)
|
||||
->setSubheader($this->createLogHeader($build, $log))
|
||||
->setUser($viewer);
|
||||
|
||||
|
|
|
@ -44,28 +44,43 @@ final class HarbormasterBuildLogView extends AphrontView {
|
|||
|
||||
$header->addActionLink($download_button);
|
||||
|
||||
$content_id = celerity_generate_unique_node_id();
|
||||
$content_div = javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'id' => $content_id,
|
||||
'class' => 'harbormaster-log-view-loading',
|
||||
),
|
||||
pht('Loading...'));
|
||||
|
||||
require_celerity_resource('harbormaster-css');
|
||||
|
||||
Javelin::initBehavior(
|
||||
'harbormaster-log',
|
||||
array(
|
||||
'contentNodeID' => $content_id,
|
||||
'renderURI' => $log->getRenderURI($this->getHighlightedLineRange()),
|
||||
));
|
||||
|
||||
$box_view = id(new PHUIObjectBoxView())
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setHeader($header)
|
||||
->appendChild($content_div);
|
||||
->setHeader($header);
|
||||
|
||||
$has_linemap = $log->getLineMap();
|
||||
if ($has_linemap) {
|
||||
$content_id = celerity_generate_unique_node_id();
|
||||
$content_div = javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'id' => $content_id,
|
||||
'class' => 'harbormaster-log-view-loading',
|
||||
),
|
||||
pht('Loading...'));
|
||||
|
||||
require_celerity_resource('harbormaster-css');
|
||||
|
||||
Javelin::initBehavior(
|
||||
'harbormaster-log',
|
||||
array(
|
||||
'contentNodeID' => $content_id,
|
||||
'renderURI' => $log->getRenderURI($this->getHighlightedLineRange()),
|
||||
));
|
||||
|
||||
$box_view->appendChild($content_div);
|
||||
} else {
|
||||
$box_view->setFormErrors(
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue