diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-26 18:04:41 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-26 18:04:41 +0300 |
commit | 20e0c9b132f1a7d12b156936114155c89d55b8cf (patch) | |
tree | 77d818d47d27089862b57fb1938bef58aa672126 /app/views | |
parent | 633d42a3359c8d43dd68716852faca0ec6de22f4 (diff) | |
download | gitlab-ce-20e0c9b132f1a7d12b156936114155c89d55b8cf.tar.gz |
Rewrite graphs feature
* remove commits stats page (will be replaced by graphs)
* remove additions/deletions from graph because of bad performance
* keep graph logic in gitlab
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/commits/_head.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/graphs/show.html.haml | 29 | ||||
-rw-r--r-- | app/views/projects/graphs/show.js.haml | 19 | ||||
-rw-r--r-- | app/views/projects/repositories/stats.html.haml | 33 |
4 files changed, 15 insertions, 70 deletions
diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml index 2dcd84af010..0c9d906481b 100644 --- a/app/views/projects/commits/_head.html.haml +++ b/app/views/projects/commits/_head.html.haml @@ -13,7 +13,3 @@ = link_to project_tags_path(@project) do Tags %span.badge.js-totaltags-count= @repository.tags.length - - = nav_link(controller: :repositories, action: :stats) do - = link_to stats_project_repository_path(@project) do - Stats diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml index 8e4548f26d0..c2878e13e7c 100644 --- a/app/views/projects/graphs/show.html.haml +++ b/app/views/projects/graphs/show.html.haml @@ -3,15 +3,10 @@ %h3.page-title %i.icon-spinner.icon-spin Building repository graph. - %p Please wait a moment, this page will automatically refresh when ready. + %p.slead Please wait a moment, this page will automatically refresh when ready. -.stat-graph +.stat-graph.hide .header.clearfix - .pull-right - %select - %option{:value => "commits"} Commits - %option{:value => "additions"} Additions - %option{:value => "deletions"} Deletions %h3#date_header.page-title %p.light Commits to #{@project.default_branch}, excluding merge commits. Limited by 6,000 commits @@ -21,15 +16,21 @@ #contributors.clearfix %ol.contributors-list.clearfix -:javascript - $(".stat-graph").hide(); - $.ajax({ + +:coffeescript + $.ajax type: "GET", url: location.href, - complete: function() { + success: (data) -> + graph = new ContributorsStatGraph() + graph.init(data) + + $("#brush_change").change -> + graph.change_date_header() + graph.redraw_authors() + $(".stat-graph").fadeIn(); $(".loading-graph").hide(); - }, - dataType: "script" - }); + dataType: "json" + diff --git a/app/views/projects/graphs/show.js.haml b/app/views/projects/graphs/show.js.haml deleted file mode 100644 index dcf6cacdceb..00000000000 --- a/app/views/projects/graphs/show.js.haml +++ /dev/null @@ -1,19 +0,0 @@ -- if @success - :plain - controller = new ContributorsStatGraph - controller.init(#{@log}) - - $("select").change( function () { - var field = $(this).val() - controller.set_current_field(field) - controller.redraw_master() - controller.redraw_authors() - }) - - $("#brush_change").change( function () { - controller.change_date_header() - controller.redraw_authors() - }) -- else - :plain - $('.stat-graph').replaceWith('<div class="alert alert-danger">Failed to load graph</div>') diff --git a/app/views/projects/repositories/stats.html.haml b/app/views/projects/repositories/stats.html.haml deleted file mode 100644 index 70db27d6444..00000000000 --- a/app/views/projects/repositories/stats.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -= render "projects/commits/head" -.row - .col-md-6 - %div#activity-chart.chart - %hr - %p - %b Total commits: - %span= @repository.commit_count - %p - %b Total files in #{@repository.root_ref}: - %span= @stats.files_count - %p - %b Authors: - %span= @stats.authors_count - - - .col-md-6 - %h4 Top 50 Committers: - %ol.styled - - @stats.authors[0...50].each do |author| - %li - = image_tag avatar_icon(author.email, 16), class: 'avatar s16', alt: '' - = author.name - %small.light= author.email - .pull-right - = author.commits - - -:javascript - var labels = [#{@graph.labels.to_json}]; - var commits = [#{@graph.commits.join(', ')}]; - var title = "Commit activity for last #{@graph.weeks} weeks"; - Chart.init(labels, commits, title); |