Commit aba37022 authored by Martin Wortschack's avatar Martin Wortschack Committed by Pavel Shutsin

Code review analytics skeleton

Introduces neww page for
code review analytics app
parent fd7afa53
...@@ -290,6 +290,8 @@ ...@@ -290,6 +290,8 @@
= render_if_exists 'layouts/nav/sidebar/project_packages_link' = render_if_exists 'layouts/nav/sidebar/project_packages_link'
= render_if_exists 'layouts/nav/sidebar/project_analytics_link' # EE-specific
- if project_nav_tab? :wiki - if project_nav_tab? :wiki
- wiki_url = project_wiki_path(@project, :home) - wiki_url = project_wiki_path(@project, :home)
= nav_link(controller: :wikis) do = nav_link(controller: :wikis) do
......
# frozen_string_literal: true
module Projects
module Analytics
class CodeReviewsController < Projects::ApplicationController
before_action :check_code_review_analytics_available!
def index
end
end
end
end
...@@ -59,6 +59,10 @@ module EE ...@@ -59,6 +59,10 @@ module EE
nav_tabs << :packages nav_tabs << :packages
end end
if ::Feature.enabled?(:code_review_analytics, project)
nav_tabs << :code_review
end
if can?(current_user, :read_feature_flag, project) && !nav_tabs.include?(:operations) if can?(current_user, :read_feature_flag, project) && !nav_tabs.include?(:operations)
nav_tabs << :operations nav_tabs << :operations
end end
......
...@@ -12,6 +12,7 @@ class License < ApplicationRecord ...@@ -12,6 +12,7 @@ class License < ApplicationRecord
audit_events audit_events
burndown_charts burndown_charts
code_owners code_owners
code_review_analytics
contribution_analytics contribution_analytics
description_diffs description_diffs
elastic_search elastic_search
......
- if Feature.enabled?(:code_review_analytics) && @project.feature_available?(:code_review_analytics, current_user)
- project_analytics_link = namespace_project_analytics_code_reviews_path(@project.namespace, @project)
= nav_link controller: :code_review do
= link_to project_analytics_link, data: { qa_selector: 'project_analytics_link' } do
.nav-icon-container
= sprite_icon('chart')
%span.nav-item-name
= _('Project Analytics')
%ul.sidebar-sub-level-items
= nav_link(controller: :code_review, html_options: { class: "fly-out-top-item" } ) do
= link_to project_analytics_link do
%strong.fly-out-top-item-name
= _('Project Analytics')
%li.divider.fly-out-top-item
- if project_nav_tab?(:code_review)
= nav_link controller: :code_review do
= link_to project_analytics_link, title: _('Code Review') do
%span= _('Code Review')
- breadcrumb_title _("Code Review")
- page_title _("Code Review")
.d-flex.align-items-center
%h1.page-title
= _('Code Review')
.text-secondary= _('Review time is defined as the time it takes from first comment until merged.')
#js-code-review-analytics{ data: { project: @project } }
...@@ -77,6 +77,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -77,6 +77,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
resources :audit_events, only: [:index] resources :audit_events, only: [:index]
namespace :analytics do
constraints(::Constraints::FeatureConstrainer.new(:code_review_analytics)) do
resources :code_reviews, only: [:index]
end
end
end end
# End of the /-/ scope. # End of the /-/ scope.
......
# frozen_string_literal: true
require 'spec_helper'
describe Projects::Analytics::CodeReviewsController, type: :request do
let(:user) { create :user }
let(:project) { create(:project) }
before do
project.add_guest(user)
login_as user
stub_feature_flags(code_review_analytics: true)
end
describe 'GET /*namespace_id/:project_id/analytics/code_reviews' do
context 'with code_review_analytics included in plan' do
it 'is success' do
get project_analytics_code_reviews_path(project)
expect(response).to have_gitlab_http_status(200)
end
end
context 'without code_review_analytics in plan' do
before do
stub_licensed_features(code_review_analytics: false)
end
it 'is not found' do
get project_analytics_code_reviews_path(project)
expect(response).to have_gitlab_http_status(404)
end
end
end
end
...@@ -4514,6 +4514,9 @@ msgstr "" ...@@ -4514,6 +4514,9 @@ msgstr ""
msgid "Code Owners to the merge request changes." msgid "Code Owners to the merge request changes."
msgstr "" msgstr ""
msgid "Code Review"
msgstr ""
msgid "Code owner approval is required" msgid "Code owner approval is required"
msgstr "" msgstr ""
...@@ -13893,6 +13896,9 @@ msgstr "" ...@@ -13893,6 +13896,9 @@ msgstr ""
msgid "Project '%{project_name}' will be deleted on %{date}" msgid "Project '%{project_name}' will be deleted on %{date}"
msgstr "" msgstr ""
msgid "Project Analytics"
msgstr ""
msgid "Project Badges" msgid "Project Badges"
msgstr "" msgstr ""
...@@ -15556,6 +15562,9 @@ msgstr "" ...@@ -15556,6 +15562,9 @@ msgstr ""
msgid "Review the process for configuring service providers in your identity provider — in this case, GitLab is the \"service provider\" or \"relying party\"." msgid "Review the process for configuring service providers in your identity provider — in this case, GitLab is the \"service provider\" or \"relying party\"."
msgstr "" msgstr ""
msgid "Review time is defined as the time it takes from first comment until merged."
msgstr ""
msgid "Reviewing" msgid "Reviewing"
msgstr "" msgstr ""
......
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