@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+54 -20
+7 -1
src/applications/harbormaster/controller/HarbormasterBuildLogRenderController.php
··· 105 105 $reads = $this->mergeOverlappingReads($reads); 106 106 107 107 foreach ($reads as $key => $read) { 108 - $data = $log->loadData($read['fetchOffset'], $read['fetchLength']); 108 + $fetch_offset = $read['fetchOffset']; 109 + $fetch_length = $read['fetchLength']; 110 + if ($fetch_offset + $fetch_length > $log_size) { 111 + $fetch_length = $log_size - $fetch_offset; 112 + } 113 + 114 + $data = $log->loadData($fetch_offset, $fetch_length); 109 115 110 116 $offset = $read['fetchOffset']; 111 117 $line = $read['fetchLine'];
+6
src/applications/harbormaster/controller/HarbormasterBuildLogViewController.php
··· 16 16 return new Aphront404Response(); 17 17 } 18 18 19 + $target = $log->getBuildTarget(); 20 + $build = $target->getBuild(); 21 + 19 22 $page_title = pht('Build Log %d', $log->getID()); 20 23 21 24 $log_view = id(new HarbormasterBuildLogView()) ··· 25 28 26 29 $crumbs = $this->buildApplicationCrumbs() 27 30 ->addTextCrumb(pht('Build Logs')) 31 + ->addTextCrumb( 32 + pht('Build %d', $build->getID()), 33 + $build->getURI()) 28 34 ->addTextCrumb($page_title) 29 35 ->setBorder(true); 30 36
+7
src/applications/harbormaster/controller/HarbormasterBuildViewController.php
··· 363 363 $log_view->setLines($lines); 364 364 $log_view->setStart($start); 365 365 366 + $prototype_view = id(new PHUIButtonView()) 367 + ->setTag('a') 368 + ->setHref($log->getURI()) 369 + ->setIcon('fa-file-text-o') 370 + ->setText(pht('New View (Prototype)')); 371 + 366 372 $header = id(new PHUIHeaderView()) 367 373 ->setHeader(pht( 368 374 'Build Log %d (%s - %s)', 369 375 $log->getID(), 370 376 $log->getLogSource(), 371 377 $log->getLogType())) 378 + ->addActionLink($prototype_view) 372 379 ->setSubheader($this->createLogHeader($build, $log)) 373 380 ->setUser($viewer); 374 381
+34 -19
src/applications/harbormaster/view/HarbormasterBuildLogView.php
··· 44 44 45 45 $header->addActionLink($download_button); 46 46 47 - $content_id = celerity_generate_unique_node_id(); 48 - $content_div = javelin_tag( 49 - 'div', 50 - array( 51 - 'id' => $content_id, 52 - 'class' => 'harbormaster-log-view-loading', 53 - ), 54 - pht('Loading...')); 47 + $box_view = id(new PHUIObjectBoxView()) 48 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 49 + ->setHeader($header); 50 + 51 + $has_linemap = $log->getLineMap(); 52 + if ($has_linemap) { 53 + $content_id = celerity_generate_unique_node_id(); 54 + $content_div = javelin_tag( 55 + 'div', 56 + array( 57 + 'id' => $content_id, 58 + 'class' => 'harbormaster-log-view-loading', 59 + ), 60 + pht('Loading...')); 55 61 56 - require_celerity_resource('harbormaster-css'); 62 + require_celerity_resource('harbormaster-css'); 57 63 58 - Javelin::initBehavior( 59 - 'harbormaster-log', 60 - array( 61 - 'contentNodeID' => $content_id, 62 - 'renderURI' => $log->getRenderURI($this->getHighlightedLineRange()), 63 - )); 64 + Javelin::initBehavior( 65 + 'harbormaster-log', 66 + array( 67 + 'contentNodeID' => $content_id, 68 + 'renderURI' => $log->getRenderURI($this->getHighlightedLineRange()), 69 + )); 64 70 65 - $box_view = id(new PHUIObjectBoxView()) 66 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 67 - ->setHeader($header) 68 - ->appendChild($content_div); 71 + $box_view->appendChild($content_div); 72 + } else { 73 + $box_view->setFormErrors( 74 + array( 75 + pht( 76 + 'This older log is missing required rendering data. To rebuild '. 77 + 'rendering data, run: %s', 78 + phutil_tag( 79 + 'tt', 80 + array(), 81 + '$ bin/harbormaster rebuild-log --force --id '.$log->getID())), 82 + )); 83 + } 69 84 70 85 return $box_view; 71 86 }