Commit ce06f5a2 authored by Stan Hu's avatar Stan Hu

Merge branch '7187-rename-contribution-analytics-json-endpoint' into 'master'

Rename contribution analytics endpoint

Closes #7187

See merge request gitlab-org/gitlab!22877
parents eb3f5e67 1e00e69a
......@@ -44,7 +44,7 @@
- if group_sidebar_link?(:contribution_analytics)
= 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
= _('Contribution Analytics')
......
# frozen_string_literal: true
class Groups::AnalyticsController < Groups::ApplicationController
class Groups::ContributionAnalyticsController < Groups::ApplicationController
before_action :group
before_action :check_contribution_analytics_available!
......
- page_title "Contribution Analytics"
- page_title s_("Contribution Analytics")
- if @group.feature_available?(:contribution_analytics)
.sub-header-block
......@@ -9,60 +9,60 @@
%b.caret
%ul.dropdown-menu.dropdown-menu-right
%li
= link_to group_analytics_path(@group, start_date: Date.today - 1.week) do
Last week
= link_to group_contribution_analytics_path(@group, start_date: Date.today - 1.week) do
= s_('ContributionAnalytics|Last week')
%li
= link_to group_analytics_path(@group, start_date: Date.today - 1.month) do
Last month
= link_to group_contribution_analytics_path(@group, start_date: Date.today - 1.month) do
= s_('ContributionAnalytics|Last month')
%li
= link_to group_analytics_path(@group, start_date: Date.today - 3.months) do
Last 3 months
= link_to group_contribution_analytics_path(@group, start_date: Date.today - 3.months) do
= s_('ContributionAnalytics|Last 3 months')
.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' } }
%h3 Push
%h3= _('Push')
- code_push_count = @data_collector.total_push_count
- commits_count = @data_collector.total_commit_count
- person_count = @data_collector.total_push_author_count
- 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
= pushes_string
- else
= _('No pushes for the selected time period.')
= s_('ContributionAnalytics|No pushes for the selected time period.')
.row
.col-md-12
#js_pushes_chart_vue
%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_merged_count = @data_collector.total_merge_requests_merged_count
- 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
= _('No merge requests for the selected time period.')
= s_('ContributionAnalytics|No merge requests for the selected time period.')
.row
.col-md-12
#js_merge_requests_chart_vue
%div{ data: { qa_selector: 'issue_content' } }
%h3 Issues
%h3= s_('ContributionAnalytics|Issues')
- issues_created_count = @data_collector.total_issues_created_count
- issues_closed_count = @data_collector.total_issues_closed_count
- 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
= _('No issues for the selected time period.')
= s_('ContributionAnalytics|No issues for the selected time period.')
.row
.col-md-12
#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
%script#js-analytics-data{ type: "application/json" }
= @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
patch :override, on: :member
end
resource :analytics, only: [:show]
get '/analytics', to: redirect('groups/%{group_id}/-/contribution_analytics')
resource :contribution_analytics, only: [:show]
resource :cycle_analytics, only: [:show]
namespace :cycle_analytics do
scope :events, controller: 'events' do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe Groups::AnalyticsController do
describe Groups::ContributionAnalyticsController do
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
......
......@@ -402,7 +402,7 @@ describe 'Promotions', :js do
end
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.'
end
......
export const contributionsPath = '/foo/analytics.json';
export const contributionsPath = '/foo/contribution_analytics.json';
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 ""
msgid "<strong>%{changedFilesLength} unstaged</strong> and <strong>%{stagedFilesLength} staged</strong> changes"
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"
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"
msgstr ""
......@@ -5052,6 +5043,42 @@ msgstr ""
msgid "Contribution Charts"
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>"
msgstr ""
......@@ -12257,9 +12284,6 @@ msgstr ""
msgid "No forks are available to you."
msgstr ""
msgid "No issues for the selected time period."
msgstr ""
msgid "No job log"
msgstr ""
......@@ -12278,9 +12302,6 @@ msgstr ""
msgid "No matching results"
msgstr ""
msgid "No merge requests for the selected time period."
msgstr ""
msgid "No merge requests found"
msgstr ""
......@@ -12308,9 +12329,6 @@ msgstr ""
msgid "No public groups"
msgstr ""
msgid "No pushes for the selected time period."
msgstr ""
msgid "No repository"
msgstr ""
......
......@@ -72,4 +72,5 @@ Disallow: /*/*/protected_branches
Disallow: /*/*/uploads/
Disallow: /*/-/group_members
Disallow: /*/project_members
Disallow: /groups/*/-/contribution_analytics
Disallow: /groups/*/-/analytics
......@@ -5,7 +5,7 @@ module QA
module Page
module Group
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 :merge_request_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