Commit aa99660fe1d672793040a23a9b5aaedfd6907177
Exists in
master
and in
4 other branches
Merge pull request #2709 from hiroponz/improve-network-graph-2
Improve network graph
Showing
2 changed files
with
8 additions
and
6 deletions
Show diff stats
lib/gitlab/graph/json_builder.rb
| ... | ... | @@ -16,6 +16,7 @@ module Gitlab |
| 16 | 16 | |
| 17 | 17 | @commits = collect_commits |
| 18 | 18 | @days = index_commits |
| 19 | + @space = 0 | |
| 19 | 20 | end |
| 20 | 21 | |
| 21 | 22 | def to_json(*args) |
| ... | ... | @@ -97,8 +98,8 @@ module Gitlab |
| 97 | 98 | if leaves.empty? |
| 98 | 99 | return |
| 99 | 100 | end |
| 100 | - space = find_free_space(leaves, map) | |
| 101 | - leaves.each{|l| l.space = space} | |
| 101 | + @space = find_free_space(leaves, map) | |
| 102 | + leaves.each{|l| l.space = @space} | |
| 102 | 103 | # and mark it as reserved |
| 103 | 104 | min_time = leaves.last.time |
| 104 | 105 | parents = leaves.last.parents.collect |
| ... | ... | @@ -115,7 +116,7 @@ module Gitlab |
| 115 | 116 | else |
| 116 | 117 | max_time = parent_time - 1 |
| 117 | 118 | end |
| 118 | - mark_reserved(min_time..max_time, space) | |
| 119 | + mark_reserved(min_time..max_time, @space) | |
| 119 | 120 | |
| 120 | 121 | # Visit branching chains |
| 121 | 122 | leaves.each do |l| |
| ... | ... | @@ -139,9 +140,10 @@ module Gitlab |
| 139 | 140 | reserved += @_reserved[day] |
| 140 | 141 | end |
| 141 | 142 | space = base_space(leaves, map) |
| 142 | - while reserved.include? space do | |
| 143 | + while (reserved.include? space) || (space == @space) do | |
| 143 | 144 | space += 1 |
| 144 | 145 | end |
| 146 | + | |
| 145 | 147 | space |
| 146 | 148 | end |
| 147 | 149 | ... | ... |
vendor/assets/javascripts/branch-graph.js
| ... | ... | @@ -121,7 +121,7 @@ |
| 121 | 121 | if (c.space == this.commits[i].space) { |
| 122 | 122 | r.path([ |
| 123 | 123 | "M", x, y, |
| 124 | - "L", x - 20 * (c.time + 1), y | |
| 124 | + "L", cx, cy | |
| 125 | 125 | ]).attr({ |
| 126 | 126 | stroke: this.colors[c.space], |
| 127 | 127 | "stroke-width": 2 |
| ... | ... | @@ -351,4 +351,4 @@ function textWrap(t, width) { |
| 351 | 351 | t.attr({ |
| 352 | 352 | "y": b.y + h |
| 353 | 353 | }); |
| 354 | -} | |
| 355 | 354 | \ No newline at end of file |
| 355 | +} | ... | ... |