Commit 31e9f82ebc24ff04cb4eeaf933f6f3b158a38a62
1 parent
7825830c
Exists in
master
and in
4 other branches
Improve repository graph
Showing
5 changed files
with
29 additions
and
17 deletions
Show diff stats
app/assets/javascripts/stat_graph_contributors.js.coffee
| ... | ... | @@ -16,7 +16,7 @@ class window.ContributorsStatGraph |
| 16 | 16 | _.each(limited_author_data, (d) => |
| 17 | 17 | author_header = @create_author_header(d) |
| 18 | 18 | $(".contributors-list").append(author_header) |
| 19 | - @authors[d.author] = author_graph = new ContributorsAuthorGraph(d.dates) | |
| 19 | + @authors[d.author_name] = author_graph = new ContributorsAuthorGraph(d.dates) | |
| 20 | 20 | author_graph.draw() |
| 21 | 21 | ) |
| 22 | 22 | format_author_commit_info: (author) -> |
| ... | ... | @@ -46,13 +46,15 @@ class window.ContributorsStatGraph |
| 46 | 46 | class: 'person' |
| 47 | 47 | style: 'display: block;' |
| 48 | 48 | }) |
| 49 | - author_name = $('<h4>' + author.author + '</h4>') | |
| 49 | + author_name = $('<h4>' + author.author_name + '</h4>') | |
| 50 | + author_email = $('<p class="graph-author-email">' + author.author_email + '</p>') | |
| 50 | 51 | author_commit_info_span = $('<span/>', { |
| 51 | 52 | class: 'commits' |
| 52 | 53 | }) |
| 53 | 54 | author_commit_info = @format_author_commit_info(author) |
| 54 | 55 | author_commit_info_span.html(author_commit_info) |
| 55 | 56 | list_item.append(author_name) |
| 57 | + list_item.append(author_email) | |
| 56 | 58 | list_item.append(author_commit_info_span) |
| 57 | 59 | list_item |
| 58 | 60 | redraw_master: -> |
| ... | ... | @@ -65,9 +67,9 @@ class window.ContributorsStatGraph |
| 65 | 67 | author_commits = ContributorsStatGraphUtil.get_author_data(@parsed_log, @field, x_domain) |
| 66 | 68 | _.each(author_commits, (d) => |
| 67 | 69 | @redraw_author_commit_info(d) |
| 68 | - $(@authors[d.author].list_item).appendTo("ol") | |
| 69 | - @authors[d.author].set_data(d.dates) | |
| 70 | - @authors[d.author].redraw() | |
| 70 | + $(@authors[d.author_name].list_item).appendTo("ol") | |
| 71 | + @authors[d.author_name].set_data(d.dates) | |
| 72 | + @authors[d.author_name].redraw() | |
| 71 | 73 | ) |
| 72 | 74 | set_current_field: (field) -> |
| 73 | 75 | @field = field |
| ... | ... | @@ -77,6 +79,6 @@ class window.ContributorsStatGraph |
| 77 | 79 | print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1]) |
| 78 | 80 | $("#date_header").text(print) |
| 79 | 81 | redraw_author_commit_info: (author) -> |
| 80 | - author_list_item = $(@authors[author.author].list_item) | |
| 82 | + author_list_item = $(@authors[author.author_name].list_item) | |
| 81 | 83 | author_commit_info = @format_author_commit_info(author) |
| 82 | 84 | author_list_item.find("span").html(author_commit_info) | ... | ... |
app/assets/javascripts/stat_graph_contributors_graph.js.coffee
| ... | ... | @@ -90,9 +90,9 @@ class window.ContributorsMasterGraph extends ContributorsGraph |
| 90 | 90 | y(d.commits = d.commits ? d.additions ? d.deletions) |
| 91 | 91 | ).interpolate("basis") |
| 92 | 92 | create_brush: -> |
| 93 | - @brush = d3.svg.brush().x(@x).on("brushend", @update_content); | |
| 93 | + @brush = d3.svg.brush().x(@x).on("brushend", @update_content) | |
| 94 | 94 | draw_path: (data) -> |
| 95 | - @svg.append("path").datum(data).attr("class", "area").attr("d", @area); | |
| 95 | + @svg.append("path").datum(data).attr("class", "area").attr("d", @area) | |
| 96 | 96 | add_brush: -> |
| 97 | 97 | @svg.append("g").attr("class", "selection").call(@brush).selectAll("rect").attr("height", @height); |
| 98 | 98 | update_content: => | ... | ... |
app/assets/javascripts/stat_graph_contributors_util.js.coffee
| ... | ... | @@ -4,9 +4,9 @@ window.ContributorsStatGraphUtil = |
| 4 | 4 | by_author = {} |
| 5 | 5 | for entry in log |
| 6 | 6 | @add_date(entry.date, total) unless total[entry.date]? |
| 7 | - @add_author(entry.author, by_author) unless by_author[entry.author]? | |
| 8 | - @add_date(entry.date, by_author[entry.author]) unless by_author[entry.author][entry.date] | |
| 9 | - @store_data(entry, total[entry.date], by_author[entry.author][entry.date]) | |
| 7 | + @add_author(entry, by_author) unless by_author[entry.author_name]? | |
| 8 | + @add_date(entry.date, by_author[entry.author_name]) unless by_author[entry.author_name][entry.date] | |
| 9 | + @store_data(entry, total[entry.date], by_author[entry.author_name][entry.date]) | |
| 10 | 10 | total = _.toArray(total) |
| 11 | 11 | by_author = _.toArray(by_author) |
| 12 | 12 | total: total, by_author: by_author |
| ... | ... | @@ -16,8 +16,9 @@ window.ContributorsStatGraphUtil = |
| 16 | 16 | collection[date].date = date |
| 17 | 17 | |
| 18 | 18 | add_author: (author, by_author) -> |
| 19 | - by_author[author] = {} | |
| 20 | - by_author[author].author = author | |
| 19 | + by_author[author.author_name] = {} | |
| 20 | + by_author[author.author_name].author_name = author.author_name | |
| 21 | + by_author[author.author_name].author_email = author.author_email | |
| 21 | 22 | |
| 22 | 23 | store_data: (entry, total, by_author) -> |
| 23 | 24 | @store_commits(total, by_author) |
| ... | ... | @@ -71,10 +72,11 @@ window.ContributorsStatGraphUtil = |
| 71 | 72 | |
| 72 | 73 | parse_log_entry: (log_entry, field, date_range) -> |
| 73 | 74 | parsed_entry = {} |
| 74 | - parsed_entry.author = log_entry.author | |
| 75 | + parsed_entry.author_name = log_entry.author_name | |
| 76 | + parsed_entry.author_email = log_entry.author_email | |
| 75 | 77 | parsed_entry.dates = {} |
| 76 | 78 | parsed_entry.commits = parsed_entry.additions = parsed_entry.deletions = 0 |
| 77 | - _.each(_.omit(log_entry, 'author'), (value, key) => | |
| 79 | + _.each(_.omit(log_entry, 'author_name', 'author_email'), (value, key) => | |
| 78 | 80 | if @in_range(value.date, date_range) |
| 79 | 81 | parsed_entry.dates[value.date] = value[field] |
| 80 | 82 | parsed_entry.commits += value.commits |
| ... | ... | @@ -88,4 +90,4 @@ window.ContributorsStatGraphUtil = |
| 88 | 90 | true |
| 89 | 91 | else |
| 90 | 92 | false |
| 91 | - | |
| 92 | 93 | \ No newline at end of file |
| 94 | + | ... | ... |
app/assets/stylesheets/sections/graph.scss
app/views/projects/graphs/show.html.haml
| 1 | 1 | .loading-graph |
| 2 | 2 | %center |
| 3 | 3 | .loading |
| 4 | - %h3.page-title Building repository graph. Please wait a moment. | |
| 4 | + %h3.page-title Building repository graph. | |
| 5 | + %p Please wait a moment, this page will automatically refresh when ready. | |
| 5 | 6 | |
| 6 | 7 | .stat-graph |
| 7 | 8 | .header.clearfix |
| ... | ... | @@ -11,6 +12,8 @@ |
| 11 | 12 | %option{:value => "additions"} Additions |
| 12 | 13 | %option{:value => "deletions"} Deletions |
| 13 | 14 | %h3#date_header.page-title |
| 15 | + %p.light | |
| 16 | + Commits to #{@project.default_branch}, excluding merge commits. Limited by 8,000 commits | |
| 14 | 17 | %input#brush_change{:type => "hidden"} |
| 15 | 18 | .graphs |
| 16 | 19 | #contributors-master | ... | ... |