Commit 3a4c1c5c63f625e6e6075d384a85c67c3992ffb7

Authored by Sato Hiroyuki
1 parent c0e3b397

Enable to filter graph by ref

app/controllers/graph_controller.rb
... ... @@ -16,7 +16,7 @@ class GraphController < ProjectResourceController
16 16 format.html
17 17  
18 18 format.json do
19   - @graph = Network::Graph.new(project, @ref, @commit)
  19 + @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref])
20 20 end
21 21 end
22 22 end
... ...
app/models/network/graph.rb
... ... @@ -8,10 +8,11 @@ module Network
8 8 @max_count ||= 650
9 9 end
10 10  
11   - def initialize project, ref, commit
  11 + def initialize project, ref, commit, filter_ref
12 12 @project = project
13 13 @ref = ref
14 14 @commit = commit
  15 + @filter_ref = filter_ref
15 16 @repo = project.repo
16 17  
17 18 @commits = collect_commits
... ... @@ -107,7 +108,9 @@ module Network
107 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 114 end
112 115  
113 116 def commits_sort_by_ref
... ...