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

Share the Paste line highlighting behavior for Harbormaster build logs

Summary: Depends on D19164. Ref T13088. Now that the JS behaviors are generic, use them on the Harbormaster standalone page.

Test Plan: Clicked lines and dragged across line ranges. Reloaded pages. Saw expected highlighting behavior in the client and on the server across reloads.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13088

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

+28 -9
+2 -2
resources/celerity/map.php
··· 78 78 'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 79 79 'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948', 80 80 'rsrc/css/application/flag/flag.css' => 'bba8f811', 81 - 'rsrc/css/application/harbormaster/harbormaster.css' => '5dd4c2de', 81 + 'rsrc/css/application/harbormaster/harbormaster.css' => '2999ccaa', 82 82 'rsrc/css/application/herald/herald-test.css' => 'a52e323e', 83 83 'rsrc/css/application/herald/herald.css' => 'cd8d0134', 84 84 'rsrc/css/application/maniphest/report.css' => '9b9580b7', ··· 579 579 'font-fontawesome' => 'e838e088', 580 580 'font-lato' => 'c7ccd872', 581 581 'global-drag-and-drop-css' => 'b556a948', 582 - 'harbormaster-css' => '5dd4c2de', 582 + 'harbormaster-css' => '2999ccaa', 583 583 'herald-css' => 'cd8d0134', 584 584 'herald-rule-editor' => 'dca75c0e', 585 585 'herald-test-css' => 'a52e323e',
+9 -5
src/applications/harbormaster/controller/HarbormasterBuildLogRenderController.php
··· 355 355 $display_line = ($line['line'] + 1); 356 356 $display_text = ($line['data']); 357 357 358 - $cell_attr = array(); 358 + $row_attr = array(); 359 359 if ($highlight_range) { 360 360 if (($display_line >= $highlight_range[0]) && 361 361 ($display_line <= $highlight_range[1])) { 362 - $cell_attr = array( 362 + $row_attr = array( 363 363 'class' => 'phabricator-source-highlight', 364 364 ); 365 365 } ··· 373 373 $display_line); 374 374 375 375 $line_cell = phutil_tag('th', array(), $display_line); 376 - $text_cell = phutil_tag('td', $cell_attr, $display_text); 376 + $text_cell = phutil_tag('td', array(), $display_text); 377 377 378 378 $rows[] = phutil_tag( 379 379 'tr', 380 - array(), 380 + $row_attr, 381 381 array( 382 382 $line_cell, 383 383 $text_cell, ··· 401 401 } 402 402 } 403 403 404 - $table = phutil_tag( 404 + $table = javelin_tag( 405 405 'table', 406 406 array( 407 407 'class' => 'harbormaster-log-table PhabricatorMonospaced', 408 + 'sigil' => 'phabricator-source', 409 + 'meta' => array( 410 + 'uri' => $log->getURI(), 411 + ), 408 412 ), 409 413 $rows); 410 414
+2 -1
src/applications/harbormaster/controller/HarbormasterBuildLogViewController.php
··· 24 24 $log_view = id(new HarbormasterBuildLogView()) 25 25 ->setViewer($viewer) 26 26 ->setBuildLog($log) 27 - ->setHighlightedLineRange($request->getURIData('lines')); 27 + ->setHighlightedLineRange($request->getURIData('lines')) 28 + ->setEnableHighlighter(true); 28 29 29 30 $crumbs = $this->buildApplicationCrumbs() 30 31 ->addTextCrumb(pht('Build Logs'))
+10
src/applications/harbormaster/view/HarbormasterBuildLogView.php
··· 4 4 5 5 private $log; 6 6 private $highlightedLineRange; 7 + private $enableHighlighter; 7 8 8 9 public function setBuildLog(HarbormasterBuildLog $log) { 9 10 $this->log = $log; ··· 21 22 22 23 public function getHighlightedLineRange() { 23 24 return $this->highlightedLineRange; 25 + } 26 + 27 + public function setEnableHighlighter($enable) { 28 + $this->enableHighlighter = $enable; 29 + return $this; 24 30 } 25 31 26 32 public function render() { ··· 49 55 $box_view = id(new PHUIObjectBoxView()) 50 56 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 51 57 ->setHeader($header); 58 + 59 + if ($this->enableHighlighter) { 60 + Javelin::initBehavior('phabricator-line-linker'); 61 + } 52 62 53 63 $has_linemap = $log->getLineMap(); 54 64 if ($has_linemap) {
+5 -1
webroot/rsrc/css/application/harbormaster/harbormaster.css
··· 69 69 padding: 4px 0; 70 70 } 71 71 72 - .harbormaster-log-table tr.harbormaster-log-highlighted > td { 72 + .harbormaster-log-table tr.phabricator-source-highlight > th { 73 + background: {$paste.border}; 74 + } 75 + 76 + .harbormaster-log-table tr.phabricator-source-highlight > td { 73 77 background: {$paste.highlight}; 74 78 } 75 79