Commit 3a4c1c5c63f625e6e6075d384a85c67c3992ffb7
1 parent
c0e3b397
Exists in
master
and in
4 other branches
Enable to filter graph by ref
Showing
2 changed files
with
6 additions
and
3 deletions
Show diff stats
app/controllers/graph_controller.rb
| @@ -16,7 +16,7 @@ class GraphController < ProjectResourceController | @@ -16,7 +16,7 @@ class GraphController < ProjectResourceController | ||
| 16 | format.html | 16 | format.html |
| 17 | 17 | ||
| 18 | format.json do | 18 | format.json do |
| 19 | - @graph = Network::Graph.new(project, @ref, @commit) | 19 | + @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) |
| 20 | end | 20 | end |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
app/models/network/graph.rb
| @@ -8,10 +8,11 @@ module Network | @@ -8,10 +8,11 @@ module Network | ||
| 8 | @max_count ||= 650 | 8 | @max_count ||= 650 |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | - def initialize project, ref, commit | 11 | + def initialize project, ref, commit, filter_ref |
| 12 | @project = project | 12 | @project = project |
| 13 | @ref = ref | 13 | @ref = ref |
| 14 | @commit = commit | 14 | @commit = commit |
| 15 | + @filter_ref = filter_ref | ||
| 15 | @repo = project.repo | 16 | @repo = project.repo |
| 16 | 17 | ||
| 17 | @commits = collect_commits | 18 | @commits = collect_commits |
| @@ -107,7 +108,9 @@ module Network | @@ -107,7 +108,9 @@ module Network | ||
| 107 | skip: skip | 108 | skip: skip |
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | - Grit::Commit.find_all(@repo, nil, opts) | 111 | + ref = @ref if @filter_ref |
| 112 | + | ||
| 113 | + Grit::Commit.find_all(@repo, ref, opts) | ||
| 111 | end | 114 | end |
| 112 | 115 | ||
| 113 | def commits_sort_by_ref | 116 | def commits_sort_by_ref |