Commit 1e00e69a authored by Adam Hegyi's avatar Adam Hegyi Committed by Stan Hu

Rename contribution analytics endpoint

- From 'groups/:id/analytics' to 'groups/:id/contribution_analytics
- Add redirect for the old path
- Fix and update I18n on the page
parent eb3f5e67
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
- if group_sidebar_link?(:contribution_analytics) - if group_sidebar_link?(:contribution_analytics)
= nav_link(path: 'analytics#show') do = nav_link(path: 'analytics#show') do
= link_to group_analytics_path(@group), title: _('Contribution Analytics'), data: { placement: 'right', qa_selector: 'contribution_analytics_link' } do = link_to group_contribution_analytics_path(@group), title: _('Contribution Analytics'), data: { placement: 'right', qa_selector: 'contribution_analytics_link' } do
%span %span
= _('Contribution Analytics') = _('Contribution Analytics')
......
# frozen_string_literal: true # frozen_string_literal: true
class Groups::AnalyticsController < Groups::ApplicationController class Groups::ContributionAnalyticsController < Groups::ApplicationController
before_action :group before_action :group
before_action :check_contribution_analytics_available! before_action :check_contribution_analytics_available!
......
- page_title "Contribution Analytics" - page_title s_("Contribution Analytics")
- if @group.feature_available?(:contribution_analytics) - if @group.feature_available?(:contribution_analytics)
.sub-header-block .sub-header-block
...@@ -9,60 +9,60 @@ ...@@ -9,60 +9,60 @@
%b.caret %b.caret
%ul.dropdown-menu.dropdown-menu-right %ul.dropdown-menu.dropdown-menu-right
%li %li
= link_to group_analytics_path(@group, start_date: Date.today - 1.week) do = link_to group_contribution_analytics_path(@group, start_date: Date.today - 1.week) do
Last week = s_('ContributionAnalytics|Last week')
%li %li
= link_to group_analytics_path(@group, start_date: Date.today - 1.month) do = link_to group_contribution_analytics_path(@group, start_date: Date.today - 1.month) do
Last month = s_('ContributionAnalytics|Last month')
%li %li
= link_to group_analytics_path(@group, start_date: Date.today - 3.months) do = link_to group_contribution_analytics_path(@group, start_date: Date.today - 3.months) do
Last 3 months = s_('ContributionAnalytics|Last 3 months')
.oneline .oneline
Contribution analytics for issues, merge requests and push events since #{@start_date} = s_('ContributionAnalytics|Contribution analytics for issues, merge requests and push events since %{start_date}') % { start_date: @start_date }
%div{ data: { qa_selector: 'push_content' } } %div{ data: { qa_selector: 'push_content' } }
%h3 Push %h3= _('Push')
- code_push_count = @data_collector.total_push_count - code_push_count = @data_collector.total_push_count
- commits_count = @data_collector.total_commit_count - commits_count = @data_collector.total_commit_count
- person_count = @data_collector.total_push_author_count - person_count = @data_collector.total_push_author_count
- person_count_string = pluralize person_count, 'person' - person_count_string = pluralize person_count, 'person'
- pushes_string = _('<strong>%{pushes}</strong> pushes, more than <strong>%{commits}</strong> commits by <strong>%{people}</strong> contributors.').html_safe % { pushes: code_push_count, commits: commits_count , people: person_count_string } - pushes_string = s_('ContributionAnalytics|<strong>%{pushes}</strong> pushes, more than <strong>%{commits}</strong> commits by <strong>%{people}</strong> contributors.').html_safe % { pushes: code_push_count, commits: commits_count , people: person_count_string }
- if code_push_count > 0 || commits_count > 0 || person_count > 0 - if code_push_count > 0 || commits_count > 0 || person_count > 0
= pushes_string = pushes_string
- else - else
= _('No pushes for the selected time period.') = s_('ContributionAnalytics|No pushes for the selected time period.')
.row .row
.col-md-12 .col-md-12
#js_pushes_chart_vue #js_pushes_chart_vue
%div{ data: { qa_selector: 'merge_request_content' } } %div{ data: { qa_selector: 'merge_request_content' } }
%h3 Merge Requests %h3= s_('ContributionAnalytics|Merge Requests')
- mr_created_count = @data_collector.total_merge_requests_created_count - mr_created_count = @data_collector.total_merge_requests_created_count
- mr_merged_count = @data_collector.total_merge_requests_merged_count - mr_merged_count = @data_collector.total_merge_requests_merged_count
- if mr_created_count > 0 || mr_merged_count > 0 - if mr_created_count > 0 || mr_merged_count > 0
= _('<strong>%{created_count}</strong> created, <strong>%{accepted_count}</strong> accepted.').html_safe % { created_count: mr_created_count, accepted_count: mr_merged_count } = s_('ContributionAnalytics|<strong>%{created_count}</strong> created, <strong>%{accepted_count}</strong> accepted.').html_safe % { created_count: mr_created_count, accepted_count: mr_merged_count }
- else - else
= _('No merge requests for the selected time period.') = s_('ContributionAnalytics|No merge requests for the selected time period.')
.row .row
.col-md-12 .col-md-12
#js_merge_requests_chart_vue #js_merge_requests_chart_vue
%div{ data: { qa_selector: 'issue_content' } } %div{ data: { qa_selector: 'issue_content' } }
%h3 Issues %h3= s_('ContributionAnalytics|Issues')
- issues_created_count = @data_collector.total_issues_created_count - issues_created_count = @data_collector.total_issues_created_count
- issues_closed_count = @data_collector.total_issues_closed_count - issues_closed_count = @data_collector.total_issues_closed_count
- if issues_created_count > 0 && issues_closed_count > 0 - if issues_created_count > 0 && issues_closed_count > 0
= _('<strong>%{created_count}</strong> created, <strong>%{closed_count}</strong> closed.').html_safe % { created_count: issues_created_count, closed_count: issues_closed_count } = s_('ContributionAnalytics|<strong>%{created_count}</strong> created, <strong>%{closed_count}</strong> closed.').html_safe % { created_count: issues_created_count, closed_count: issues_closed_count }
- else - else
= _('No issues for the selected time period.') = s_('ContributionAnalytics|No issues for the selected time period.')
.row .row
.col-md-12 .col-md-12
#js_issues_chart_vue #js_issues_chart_vue
#js-group-member-contributions{ data: { member_contributions_path: group_analytics_path(@group, { start_date: @start_date, format: :json }) } } #js-group-member-contributions{ data: { member_contributions_path: group_contribution_analytics_path(@group, { start_date: @start_date, format: :json }) } }
-# haml-lint:disable InlineJavaScript -# haml-lint:disable InlineJavaScript
%script#js-analytics-data{ type: "application/json" } %script#js-analytics-data{ type: "application/json" }
= @data_collector.group_member_contributions_table_data.to_json.html_safe = @data_collector.group_member_contributions_table_data.to_json.html_safe
......
---
title: Rename Contribution Analytics endpoint URL
merge_request: 22877
author:
type: changed
...@@ -17,7 +17,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do ...@@ -17,7 +17,8 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
patch :override, on: :member patch :override, on: :member
end end
resource :analytics, only: [:show] get '/analytics', to: redirect('groups/%{group_id}/-/contribution_analytics')
resource :contribution_analytics, only: [:show]
resource :cycle_analytics, only: [:show] resource :cycle_analytics, only: [:show]
namespace :cycle_analytics do namespace :cycle_analytics do
scope :events, controller: 'events' do scope :events, controller: 'events' do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe Groups::AnalyticsController do describe Groups::ContributionAnalyticsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
......
...@@ -402,7 +402,7 @@ describe 'Promotions', :js do ...@@ -402,7 +402,7 @@ describe 'Promotions', :js do
end end
it 'appears on the page' do it 'appears on the page' do
visit group_analytics_path(group) visit group_contribution_analytics_path(group)
expect(find('.user-callout-copy')).to have_content 'Track activity with Contribution Analytics.' expect(find('.user-callout-copy')).to have_content 'Track activity with Contribution Analytics.'
end end
......
export const contributionsPath = '/foo/analytics.json'; export const contributionsPath = '/foo/contribution_analytics.json';
export const rawMembers = [ export const rawMembers = [
{ {
......
# frozen_string_literal: true
require 'spec_helper'
describe 'contribution analytics' do
let(:user) { create(:user) }
let(:group) { create(:group)}
before do
group.add_developer(user)
login_as(user)
end
it 'redirects from -/analytics to -/contribution_analytics' do
get "/groups/#{group.full_path}/-/analytics"
expect(response).to redirect_to(group_contribution_analytics_path(group.full_path))
end
end
...@@ -691,18 +691,9 @@ msgstr "" ...@@ -691,18 +691,9 @@ msgstr ""
msgid "<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes" msgid "<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes"
msgstr "" msgstr ""
msgid "<strong>%{created_count}</strong> created, <strong>%{accepted_count}</strong> accepted."
msgstr ""
msgid "<strong>%{created_count}</strong> created, <strong>%{closed_count}</strong> closed."
msgstr ""
msgid "<strong>%{group_name}</strong> group members" msgid "<strong>%{group_name}</strong> group members"
msgstr "" msgstr ""
msgid "<strong>%{pushes}</strong> pushes, more than <strong>%{commits}</strong> commits by <strong>%{people}</strong> contributors."
msgstr ""
msgid "<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes" msgid "<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes"
msgstr "" msgstr ""
...@@ -5052,6 +5043,42 @@ msgstr "" ...@@ -5052,6 +5043,42 @@ msgstr ""
msgid "Contribution Charts" msgid "Contribution Charts"
msgstr "" msgstr ""
msgid "ContributionAnalytics|<strong>%{created_count}</strong> created, <strong>%{accepted_count}</strong> accepted."
msgstr ""
msgid "ContributionAnalytics|<strong>%{created_count}</strong> created, <strong>%{closed_count}</strong> closed."
msgstr ""
msgid "ContributionAnalytics|<strong>%{pushes}</strong> pushes, more than <strong>%{commits}</strong> commits by <strong>%{people}</strong> contributors."
msgstr ""
msgid "ContributionAnalytics|Contribution analytics for issues, merge requests and push events since %{start_date}"
msgstr ""
msgid "ContributionAnalytics|Issues"
msgstr ""
msgid "ContributionAnalytics|Last 3 months"
msgstr ""
msgid "ContributionAnalytics|Last month"
msgstr ""
msgid "ContributionAnalytics|Last week"
msgstr ""
msgid "ContributionAnalytics|Merge Requests"
msgstr ""
msgid "ContributionAnalytics|No issues for the selected time period."
msgstr ""
msgid "ContributionAnalytics|No merge requests for the selected time period."
msgstr ""
msgid "ContributionAnalytics|No pushes for the selected time period."
msgstr ""
msgid "Contributions for <strong>%{calendar_date}</strong>" msgid "Contributions for <strong>%{calendar_date}</strong>"
msgstr "" msgstr ""
...@@ -12257,9 +12284,6 @@ msgstr "" ...@@ -12257,9 +12284,6 @@ msgstr ""
msgid "No forks are available to you." msgid "No forks are available to you."
msgstr "" msgstr ""
msgid "No issues for the selected time period."
msgstr ""
msgid "No job log" msgid "No job log"
msgstr "" msgstr ""
...@@ -12278,9 +12302,6 @@ msgstr "" ...@@ -12278,9 +12302,6 @@ msgstr ""
msgid "No matching results" msgid "No matching results"
msgstr "" msgstr ""
msgid "No merge requests for the selected time period."
msgstr ""
msgid "No merge requests found" msgid "No merge requests found"
msgstr "" msgstr ""
...@@ -12308,9 +12329,6 @@ msgstr "" ...@@ -12308,9 +12329,6 @@ msgstr ""
msgid "No public groups" msgid "No public groups"
msgstr "" msgstr ""
msgid "No pushes for the selected time period."
msgstr ""
msgid "No repository" msgid "No repository"
msgstr "" msgstr ""
......
...@@ -72,4 +72,5 @@ Disallow: /*/*/protected_branches ...@@ -72,4 +72,5 @@ Disallow: /*/*/protected_branches
Disallow: /*/*/uploads/ Disallow: /*/*/uploads/
Disallow: /*/-/group_members Disallow: /*/-/group_members
Disallow: /*/project_members Disallow: /*/project_members
Disallow: /groups/*/-/contribution_analytics
Disallow: /groups/*/-/analytics Disallow: /groups/*/-/analytics
...@@ -5,7 +5,7 @@ module QA ...@@ -5,7 +5,7 @@ module QA
module Page module Page
module Group module Group
class ContributionAnalytics < QA::Page::Base class ContributionAnalytics < QA::Page::Base
view 'ee/app/views/groups/analytics/show.html.haml' do view 'ee/app/views/groups/contribution_analytics/show.html.haml' do
element :push_content element :push_content
element :merge_request_content element :merge_request_content
element :issue_content element :issue_content
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment