mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Improve rendering of commit branching graph
Summary: Fixes T9323. Two minor fixes: - On the first commit, don't render a downward line. - Clean up a 1px spacing issue that had cropped up a while ago when we added icons or something, I think. Test Plan: Before: {F1057248} After: {F1057249} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9323 Differential Revision: https://secure.phabricator.com/D14974
This commit is contained in:
parent
d1fb2f7fb9
commit
c7520cd9f2
5 changed files with 40 additions and 17 deletions
|
@ -13,7 +13,7 @@ return array(
|
|||
'differential.pkg.css' => '2de124c9',
|
||||
'differential.pkg.js' => '64e69521',
|
||||
'diffusion.pkg.css' => 'f45955ed',
|
||||
'diffusion.pkg.js' => 'ca1c8b5a',
|
||||
'diffusion.pkg.js' => '3a9a8bfa',
|
||||
'maniphest.pkg.css' => '4845691a',
|
||||
'maniphest.pkg.js' => '949a7498',
|
||||
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
|
||||
|
@ -391,7 +391,7 @@ return array(
|
|||
'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => 'b42eddc7',
|
||||
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'd835b03a',
|
||||
'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04',
|
||||
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '9007c197',
|
||||
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '5a0b1a64',
|
||||
'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef',
|
||||
'rsrc/js/application/diffusion/behavior-load-blame.js' => '42126667',
|
||||
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
|
||||
|
@ -598,7 +598,7 @@ return array(
|
|||
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
|
||||
'javelin-behavior-differential-user-select' => 'a8d8459d',
|
||||
'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04',
|
||||
'javelin-behavior-diffusion-commit-graph' => '9007c197',
|
||||
'javelin-behavior-diffusion-commit-graph' => '5a0b1a64',
|
||||
'javelin-behavior-diffusion-jump-to' => '73d09eef',
|
||||
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
|
||||
'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc',
|
||||
|
@ -1218,6 +1218,11 @@ return array(
|
|||
'javelin-vector',
|
||||
'javelin-dom',
|
||||
),
|
||||
'5a0b1a64' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
),
|
||||
'5b2e3e2b' => array(
|
||||
'javelin-stratcom',
|
||||
'javelin-request',
|
||||
|
@ -1523,11 +1528,6 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-workflow',
|
||||
),
|
||||
'9007c197' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
),
|
||||
'901935ef' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
|
|
@ -52,6 +52,7 @@ final class DiffusionHistoryController extends DiffusionController {
|
|||
if ($show_graph) {
|
||||
$history_table->setParents($history_results['parents']);
|
||||
$history_table->setIsHead(!$pager->getOffset());
|
||||
$history_table->setIsTail(!$pager->getHasMorePages());
|
||||
}
|
||||
|
||||
$history_panel = new PHUIObjectBoxView();
|
||||
|
|
|
@ -6,6 +6,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
|||
private $revisions = array();
|
||||
private $handles = array();
|
||||
private $isHead;
|
||||
private $isTail;
|
||||
private $parents;
|
||||
|
||||
public function setHistory(array $history) {
|
||||
|
@ -60,6 +61,11 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setIsTail($is_tail) {
|
||||
$this->isTail = $is_tail;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
|
||||
|
@ -344,6 +350,16 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
|||
);
|
||||
}
|
||||
|
||||
// If this is the last page in history, replace the "o" with an "x" so we
|
||||
// do not draw a connecting line downward, and replace "^" with an "X" for
|
||||
// repositories with exactly one commit.
|
||||
if ($this->isTail && $graph) {
|
||||
$last = array_pop($graph);
|
||||
$last['line'] = str_replace('o', 'x', $last['line']);
|
||||
$last['line'] = str_replace('^', 'X', $last['line']);
|
||||
$graph[] = $last;
|
||||
}
|
||||
|
||||
// Render into tags for the behavior.
|
||||
|
||||
foreach ($graph as $k => $meta) {
|
||||
|
|
|
@ -58,6 +58,10 @@ final class PHUIPagerView extends AphrontView {
|
|||
return $this->hasMorePages;
|
||||
}
|
||||
|
||||
public function getHasMorePages() {
|
||||
return $this->hasMorePages;
|
||||
}
|
||||
|
||||
public function setSurroundingPages($pages) {
|
||||
$this->surroundingPages = max(0, $pages);
|
||||
return $this;
|
||||
|
|
|
@ -37,6 +37,7 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
|
||||
// Stroke with fill (for commit circles).
|
||||
function fstroke(c) {
|
||||
cxt.lineWidth = 1;
|
||||
cxt.fillStyle = color(c);
|
||||
cxt.strokeStyle = '#ffffff';
|
||||
cxt.fill();
|
||||
|
@ -52,7 +53,7 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
return (col * cell) + (cell / 2);
|
||||
};
|
||||
|
||||
var h = 30;
|
||||
var h = 32;
|
||||
var w = cell * config.count;
|
||||
|
||||
var canvas = JX.$N('canvas', {width: w, height: h});
|
||||
|
@ -117,16 +118,17 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
case 'o':
|
||||
case '^':
|
||||
case '|':
|
||||
if (c == 'o' || c == '^') {
|
||||
origin = xpos(jj);
|
||||
}
|
||||
case 'x':
|
||||
case 'X':
|
||||
|
||||
if (c !== 'X') {
|
||||
cxt.beginPath();
|
||||
cxt.moveTo(xpos(jj), (c == '^' ? h/2 : 0));
|
||||
cxt.lineTo(xpos(jj), h);
|
||||
cxt.lineTo(xpos(jj), (c == 'x' ? h/2 : h));
|
||||
lstroke(jj);
|
||||
}
|
||||
|
||||
if (c == 'o' || c == '^') {
|
||||
if (c == 'o' || c == '^' || c == 'x' || c == 'X') {
|
||||
cxt.beginPath();
|
||||
cxt.arc(xpos(jj), h/2, 3, 0, 2 * Math.PI, true);
|
||||
fstroke(jj);
|
||||
|
|
Loading…
Reference in a new issue