@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.

Fix the legacy "25, 50, 100, unlimited" Harbormaster log links to respect generation selection

Summary:
See PHI565. Ref T13120. Although this older log is on the chopping block (see T13088), there's some migration guidance and other complexity around just replacing it.

Until it gets replaced, make clicking the "number of lines" elements respect the current "Build Generation" setting. Prior to this change, clicking the links would lose the generation information and jump you to the most recent build generation.

Also fix some collateral damage from T13105 where we ended up with white text on a white background in some cases.

Test Plan:
- Restarted a build to get multiple generations.
- On each generation, clicked the various "25", "50", etc., links.
- Saw generation and log window sizes both respected by the links.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13120

Differential Revision: https://secure.phabricator.com/D19367

+44 -35
+44 -32
src/applications/harbormaster/controller/HarbormasterBuildViewController.php
··· 77 77 pht('View Current Build'))); 78 78 } 79 79 80 - 81 80 $curtain = $this->buildCurtainView($build); 82 81 $properties = $this->buildPropertyList($build); 83 82 $history = $this->buildHistoryTable( ··· 292 291 293 292 $targets[] = $target_box; 294 293 295 - $targets[] = $this->buildLog($build, $build_target); 294 + $targets[] = $this->buildLog($build, $build_target, $generation); 296 295 } 297 296 298 297 $timeline = $this->buildTransactionTimeline( ··· 371 370 372 371 private function buildLog( 373 372 HarbormasterBuild $build, 374 - HarbormasterBuildTarget $build_target) { 373 + HarbormasterBuildTarget $build_target, 374 + $generation) { 375 375 376 376 $request = $this->getRequest(); 377 377 $viewer = $request->getUser(); ··· 410 410 $log_view->setLines($lines); 411 411 $log_view->setStart($start); 412 412 413 + $subheader = $this->createLogHeader($build, $log, $limit, $generation); 414 + 413 415 $prototype_view = id(new PHUIButtonView()) 414 416 ->setTag('a') 415 417 ->setHref($log->getURI()) ··· 423 425 $log->getLogSource(), 424 426 $log->getLogType())) 425 427 ->addActionLink($prototype_view) 426 - ->setSubheader($this->createLogHeader($build, $log)) 428 + ->setSubheader($subheader) 427 429 ->setUser($viewer); 428 430 429 431 $log_box = id(new PHUIObjectBoxView()) ··· 479 481 return $log_boxes; 480 482 } 481 483 482 - private function createLogHeader($build, $log) { 483 - $request = $this->getRequest(); 484 - $limit = $request->getInt('l', 25); 484 + private function createLogHeader($build, $log, $limit, $generation) { 485 + $options = array( 486 + array( 487 + 'n' => 25, 488 + ), 489 + array( 490 + 'n' => 50, 491 + ), 492 + array( 493 + 'n' => 100, 494 + ), 495 + array( 496 + 'n' => 0, 497 + 'label' => pht('Unlimited'), 498 + ), 499 + ); 485 500 486 - $lines_25 = $this->getApplicationURI('/build/'.$build->getID().'/?l=25'); 487 - $lines_50 = $this->getApplicationURI('/build/'.$build->getID().'/?l=50'); 488 - $lines_100 = 489 - $this->getApplicationURI('/build/'.$build->getID().'/?l=100'); 490 - $lines_0 = $this->getApplicationURI('/build/'.$build->getID().'/?l=0'); 501 + $base_uri = id(new PhutilURI($build->getURI().$generation.'/')); 491 502 492 - $link_25 = phutil_tag('a', array('href' => $lines_25), pht('25')); 493 - $link_50 = phutil_tag('a', array('href' => $lines_50), pht('50')); 494 - $link_100 = phutil_tag('a', array('href' => $lines_100), pht('100')); 495 - $link_0 = phutil_tag('a', array('href' => $lines_0), pht('Unlimited')); 503 + $links = array(); 504 + foreach ($options as $option) { 505 + $n = $option['n']; 506 + $label = idx($option, 'label', $n); 496 507 497 - if ($limit === 25) { 498 - $link_25 = phutil_tag('strong', array(), $link_25); 499 - } else if ($limit === 50) { 500 - $link_50 = phutil_tag('strong', array(), $link_50); 501 - } else if ($limit === 100) { 502 - $link_100 = phutil_tag('strong', array(), $link_100); 503 - } else if ($limit === 0) { 504 - $link_0 = phutil_tag('strong', array(), $link_0); 508 + $is_selected = ($limit == $n); 509 + if ($is_selected) { 510 + $links[] = phutil_tag( 511 + 'strong', 512 + array(), 513 + $label); 514 + } else { 515 + $links[] = phutil_tag( 516 + 'a', 517 + array( 518 + 'href' => (string)$base_uri->alter('l', $n), 519 + ), 520 + $label); 521 + } 505 522 } 506 523 507 524 return phutil_tag( 508 525 'span', 509 526 array(), 510 527 array( 511 - $link_25, 512 - ' - ', 513 - $link_50, 514 - ' - ', 515 - $link_100, 516 - ' - ', 517 - $link_0, 518 - ' Lines', 528 + phutil_implode_html(' - ', $links), 529 + ' ', 530 + pht('Lines'), 519 531 )); 520 532 } 521 533
-3
src/applications/harbormaster/view/ShellLogView.php
··· 65 65 'th', 66 66 array( 67 67 'class' => 'phabricator-source-line', 68 - 'style' => 'background-color: #fff;', 69 68 ), 70 69 $content_number); 71 70 ··· 95 94 'div', 96 95 array( 97 96 'class' => 'phabricator-source-code-container', 98 - 'style' => 'background-color: black; color: white;', 99 97 ), 100 98 phutil_tag( 101 99 'table', 102 100 array( 103 101 'class' => implode(' ', $classes), 104 - 'style' => 'background-color: black', 105 102 ), 106 103 phutil_implode_html('', $rows))); 107 104 }