mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
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
This commit is contained in:
parent
fe3de5dd58
commit
73619c4643
5 changed files with 28 additions and 9 deletions
|
@ -78,7 +78,7 @@ return array(
|
|||
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
|
||||
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
|
||||
'rsrc/css/application/flag/flag.css' => 'bba8f811',
|
||||
'rsrc/css/application/harbormaster/harbormaster.css' => '5dd4c2de',
|
||||
'rsrc/css/application/harbormaster/harbormaster.css' => '2999ccaa',
|
||||
'rsrc/css/application/herald/herald-test.css' => 'a52e323e',
|
||||
'rsrc/css/application/herald/herald.css' => 'cd8d0134',
|
||||
'rsrc/css/application/maniphest/report.css' => '9b9580b7',
|
||||
|
@ -579,7 +579,7 @@ return array(
|
|||
'font-fontawesome' => 'e838e088',
|
||||
'font-lato' => 'c7ccd872',
|
||||
'global-drag-and-drop-css' => 'b556a948',
|
||||
'harbormaster-css' => '5dd4c2de',
|
||||
'harbormaster-css' => '2999ccaa',
|
||||
'herald-css' => 'cd8d0134',
|
||||
'herald-rule-editor' => 'dca75c0e',
|
||||
'herald-test-css' => 'a52e323e',
|
||||
|
|
|
@ -355,11 +355,11 @@ final class HarbormasterBuildLogRenderController
|
|||
$display_line = ($line['line'] + 1);
|
||||
$display_text = ($line['data']);
|
||||
|
||||
$cell_attr = array();
|
||||
$row_attr = array();
|
||||
if ($highlight_range) {
|
||||
if (($display_line >= $highlight_range[0]) &&
|
||||
($display_line <= $highlight_range[1])) {
|
||||
$cell_attr = array(
|
||||
$row_attr = array(
|
||||
'class' => 'phabricator-source-highlight',
|
||||
);
|
||||
}
|
||||
|
@ -373,11 +373,11 @@ final class HarbormasterBuildLogRenderController
|
|||
$display_line);
|
||||
|
||||
$line_cell = phutil_tag('th', array(), $display_line);
|
||||
$text_cell = phutil_tag('td', $cell_attr, $display_text);
|
||||
$text_cell = phutil_tag('td', array(), $display_text);
|
||||
|
||||
$rows[] = phutil_tag(
|
||||
'tr',
|
||||
array(),
|
||||
$row_attr,
|
||||
array(
|
||||
$line_cell,
|
||||
$text_cell,
|
||||
|
@ -401,10 +401,14 @@ final class HarbormasterBuildLogRenderController
|
|||
}
|
||||
}
|
||||
|
||||
$table = phutil_tag(
|
||||
$table = javelin_tag(
|
||||
'table',
|
||||
array(
|
||||
'class' => 'harbormaster-log-table PhabricatorMonospaced',
|
||||
'sigil' => 'phabricator-source',
|
||||
'meta' => array(
|
||||
'uri' => $log->getURI(),
|
||||
),
|
||||
),
|
||||
$rows);
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ final class HarbormasterBuildLogViewController
|
|||
$log_view = id(new HarbormasterBuildLogView())
|
||||
->setViewer($viewer)
|
||||
->setBuildLog($log)
|
||||
->setHighlightedLineRange($request->getURIData('lines'));
|
||||
->setHighlightedLineRange($request->getURIData('lines'))
|
||||
->setEnableHighlighter(true);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs()
|
||||
->addTextCrumb(pht('Build Logs'))
|
||||
|
|
|
@ -4,6 +4,7 @@ final class HarbormasterBuildLogView extends AphrontView {
|
|||
|
||||
private $log;
|
||||
private $highlightedLineRange;
|
||||
private $enableHighlighter;
|
||||
|
||||
public function setBuildLog(HarbormasterBuildLog $log) {
|
||||
$this->log = $log;
|
||||
|
@ -23,6 +24,11 @@ final class HarbormasterBuildLogView extends AphrontView {
|
|||
return $this->highlightedLineRange;
|
||||
}
|
||||
|
||||
public function setEnableHighlighter($enable) {
|
||||
$this->enableHighlighter = $enable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$viewer = $this->getViewer();
|
||||
$log = $this->getBuildLog();
|
||||
|
@ -50,6 +56,10 @@ final class HarbormasterBuildLogView extends AphrontView {
|
|||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setHeader($header);
|
||||
|
||||
if ($this->enableHighlighter) {
|
||||
Javelin::initBehavior('phabricator-line-linker');
|
||||
}
|
||||
|
||||
$has_linemap = $log->getLineMap();
|
||||
if ($has_linemap) {
|
||||
$content_id = celerity_generate_unique_node_id();
|
||||
|
|
|
@ -69,7 +69,11 @@
|
|||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.harbormaster-log-table tr.harbormaster-log-highlighted > td {
|
||||
.harbormaster-log-table tr.phabricator-source-highlight > th {
|
||||
background: {$paste.border};
|
||||
}
|
||||
|
||||
.harbormaster-log-table tr.phabricator-source-highlight > td {
|
||||
background: {$paste.highlight};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue