Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 2b8bbae

Browse files
author
epriestley
committed
Set an explicit height when drawing the dependent revision graph
Summary: See PHI1900. Recent changes to how commit graphs are drawn made the height automatic in most cases, but it fails in Differential because the element isn't initially visible so the computed height is 0. Just give them an explicit height so they show up again. Test Plan: Viewed graphs in Maniphest, Differential, and Diffusion; saw them all render properly. Differential Revision: https://secure.phabricator.com/D21481
1 parent 058d248 commit 2b8bbae

File tree

5 files changed

+45
-14
lines changed

5 files changed

+45
-14
lines changed

resources/celerity/map.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
'differential.pkg.css' => '5c459f92',
1616
'differential.pkg.js' => '5080baf4',
1717
'diffusion.pkg.css' => '42c75c37',
18-
'diffusion.pkg.js' => '8ee48a4b',
18+
'diffusion.pkg.js' => '78c9885d',
1919
'maniphest.pkg.css' => '35995d6d',
2020
'maniphest.pkg.js' => 'c9308721',
2121
'rsrc/audio/basic/alert.mp3' => '17889334',
@@ -394,7 +394,7 @@
394394
'rsrc/js/application/diffusion/ExternalEditorLinkEngine.js' => '48a8641f',
395395
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'b7b73831',
396396
'rsrc/js/application/diffusion/behavior-commit-branches.js' => '4b671572',
397-
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '3be6ef4f',
397+
'rsrc/js/application/diffusion/behavior-commit-graph.js' => 'ac10c917',
398398
'rsrc/js/application/diffusion/behavior-locate-file.js' => '87428eb2',
399399
'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'c715c123',
400400
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => '6a85bc5a',
@@ -623,7 +623,7 @@
623623
'javelin-behavior-differential-diff-radios' => '925fe8cd',
624624
'javelin-behavior-differential-populate' => 'b86ef6c2',
625625
'javelin-behavior-diffusion-commit-branches' => '4b671572',
626-
'javelin-behavior-diffusion-commit-graph' => '3be6ef4f',
626+
'javelin-behavior-diffusion-commit-graph' => 'ac10c917',
627627
'javelin-behavior-diffusion-locate-file' => '87428eb2',
628628
'javelin-behavior-diffusion-pull-lastmodified' => 'c715c123',
629629
'javelin-behavior-document-engine' => '243d6c22',
@@ -1250,11 +1250,6 @@
12501250
'phuix-button-view',
12511251
'javelin-external-editor-link-engine',
12521252
),
1253-
'3be6ef4f' => array(
1254-
'javelin-behavior',
1255-
'javelin-dom',
1256-
'javelin-stratcom',
1257-
),
12581253
'3dc5ad43' => array(
12591254
'javelin-behavior',
12601255
'javelin-stratcom',
@@ -1927,6 +1922,11 @@
19271922
'javelin-dom',
19281923
'phabricator-notification',
19291924
),
1925+
'ac10c917' => array(
1926+
'javelin-behavior',
1927+
'javelin-dom',
1928+
'javelin-stratcom',
1929+
),
19301930
'ac2b1e01' => array(
19311931
'javelin-behavior',
19321932
'javelin-stratcom',

src/applications/differential/controller/DifferentialRevisionViewController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@ public function handleRequest(AphrontRequest $request) {
510510
->setLoadEntireGraph(true)
511511
->loadGraph();
512512
if (!$stack_graph->isEmpty()) {
513+
// See PHI1900. The graph UI element now tries to figure out the correct
514+
// height automatically, but currently can't in this case because the
515+
// element is not visible when the page loads. Set an explicit height.
516+
$stack_graph->setHeight(34);
517+
513518
$stack_table = $stack_graph->newGraphTable();
514519

515520
$parent_type = DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST;

src/infrastructure/diff/view/PHUIDiffGraphView.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ final class PHUIDiffGraphView extends Phobject {
44

55
private $isHead = true;
66
private $isTail = true;
7+
private $height;
78

89
public function setIsHead($is_head) {
910
$this->isHead = $is_head;
@@ -23,6 +24,15 @@ public function getIsTail() {
2324
return $this->isTail;
2425
}
2526

27+
public function setHeight($height) {
28+
$this->height = $height;
29+
return $this;
30+
}
31+
32+
public function getHeight() {
33+
return $this->height;
34+
}
35+
2636
public function renderRawGraph(array $parents) {
2737
// This keeps our accumulated information about each line of the
2838
// merge/branch graph.
@@ -205,7 +215,7 @@ public function renderGraph(array $parents) {
205215
'diffusion-commit-graph',
206216
array(
207217
'count' => $count,
208-
'autoheight' => true,
218+
'height' => $this->getHeight(),
209219
));
210220

211221
return $graph;

src/infrastructure/graph/PhabricatorObjectGraph.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ abstract class PhabricatorObjectGraph
1111
private $loadEntireGraph = false;
1212
private $limit;
1313
private $adjacent;
14+
private $height;
1415

1516
public function setViewer(PhabricatorUser $viewer) {
1617
$this->viewer = $viewer;
@@ -34,6 +35,15 @@ public function getLimit() {
3435
return $this->limit;
3536
}
3637

38+
public function setHeight($height) {
39+
$this->height = $height;
40+
return $this;
41+
}
42+
43+
public function getHeight() {
44+
return $this->height;
45+
}
46+
3747
final public function setRenderOnlyAdjacentNodes($adjacent) {
3848
$this->adjacent = $adjacent;
3949
return $this;
@@ -193,8 +203,14 @@ final public function newGraphTable() {
193203

194204
$ancestry = array_select_keys($ancestry, $order);
195205

196-
$traces = id(new PHUIDiffGraphView())
197-
->renderGraph($ancestry);
206+
$graph_view = id(new PHUIDiffGraphView());
207+
208+
$height = $this->getHeight();
209+
if ($height !== null) {
210+
$graph_view->setHeight($height);
211+
}
212+
213+
$traces = $graph_view->renderGraph($ancestry);
198214

199215
$ii = 0;
200216
$rows = array();

webroot/rsrc/js/application/diffusion/behavior-commit-graph.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ JX.behavior('diffusion-commit-graph', function(config) {
6262
};
6363

6464
var h;
65-
if (config.autoheight) {
66-
h = JX.Vector.getDim(nodes[ii].parentNode).y;
65+
if (config.height) {
66+
h = config.height;
6767
} else {
68-
h = 34;
68+
h = JX.Vector.getDim(nodes[ii].parentNode).y;
6969
}
7070

7171
var w = cell * config.count;

0 commit comments

Comments
 (0)