Commit c8fdb6ed authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'toggle-analytics-navbar-feature-flags' into 'master'

Toggle analytics navbar feature flags default on

See merge request gitlab-org/gitlab!24470
parents 60334a6a 323574cc
...@@ -31,7 +31,7 @@ module AnalyticsNavbarHelper ...@@ -31,7 +31,7 @@ module AnalyticsNavbarHelper
end end
def cycle_analytics_navbar_link(project, current_user) def cycle_analytics_navbar_link(project, current_user)
return unless Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, project) return unless Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, project, default_enabled: true)
return unless project_nav_tab?(:cycle_analytics) return unless project_nav_tab?(:cycle_analytics)
navbar_sub_item( navbar_sub_item(
...@@ -43,7 +43,7 @@ module AnalyticsNavbarHelper ...@@ -43,7 +43,7 @@ module AnalyticsNavbarHelper
end end
def repository_analytics_navbar_link(project, current_user) def repository_analytics_navbar_link(project, current_user)
return if Feature.disabled?(:analytics_pages_under_project_analytics_sidebar, project) return if Feature.disabled?(:analytics_pages_under_project_analytics_sidebar, project, default_enabled: true)
return if project.empty_repo? return if project.empty_repo?
navbar_sub_item( navbar_sub_item(
...@@ -55,7 +55,7 @@ module AnalyticsNavbarHelper ...@@ -55,7 +55,7 @@ module AnalyticsNavbarHelper
end end
def ci_cd_analytics_navbar_link(project, current_user) def ci_cd_analytics_navbar_link(project, current_user)
return unless Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, project) return unless Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, project, default_enabled: true)
return unless project_nav_tab?(:pipelines) return unless project_nav_tab?(:pipelines)
return unless project.feature_available?(:builds, current_user) || !project.empty_repo? return unless project.feature_available?(:builds, current_user) || !project.empty_repo?
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
= link_to navbar_links.first.link do = link_to navbar_links.first.link do
.nav-icon-container .nav-icon-container
= sprite_icon('chart') = sprite_icon('chart')
%span.nav-item-name %span.nav-item-name{ data: { qa_selector: 'analytics_link' } }
= _('Analytics') = _('Analytics')
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items{ data: { qa_selector: 'analytics_sidebar_submenu' } }
- navbar_links.each do |menu_item| - navbar_links.each do |menu_item|
= nav_link(path: menu_item.path) do = nav_link(path: menu_item.path) do
= link_to(menu_item.link, menu_item.link_to_options) do = link_to(menu_item.link, menu_item.link_to_options) do
......
- should_display_analytics_pages_in_sidebar = Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, @group) - should_display_analytics_pages_in_sidebar = Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, @group, default_enabled: true)
- issues_count = group_issues_count(state: 'opened') - issues_count = group_issues_count(state: 'opened')
- merge_requests_count = group_merge_requests_count(state: 'opened') - merge_requests_count = group_merge_requests_count(state: 'opened')
......
- should_display_analytics_pages_in_sidebar = Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, @project) - should_display_analytics_pages_in_sidebar = Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, @project, default_enabled: true)
.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) }
.nav-sidebar-inner-scroll .nav-sidebar-inner-scroll
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile', width: 40, height: 40) = project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile', width: 40, height: 40)
.sidebar-context-title .sidebar-context-title
= @project.name = @project.name
%ul.sidebar-top-level-items %ul.sidebar-top-level-items.qa-project-sidebar
- paths = sidebar_projects_paths - paths = sidebar_projects_paths
- paths << 'cycle_analytics#show' unless should_display_analytics_pages_in_sidebar - paths << 'cycle_analytics#show' unless should_display_analytics_pages_in_sidebar
= nav_link(path: paths, html_options: { class: 'home' }) do = nav_link(path: paths, html_options: { class: 'home' }) do
......
---
title: Move analytics pages under the sidebar for projects and groups
merge_request: 24470
author:
type: changed
...@@ -16,7 +16,7 @@ group: ...@@ -16,7 +16,7 @@ group:
- Merge requests - Merge requests
- Push events - Push events
To view the Contribution Analytics, go to your group's **Overview > Contribution Analytics** To view the Contribution Analytics, go to your group's **Analytics > Contribution Analytics**
page. page.
## Use cases ## Use cases
......
...@@ -14,10 +14,10 @@ requests to be merged and much more. ...@@ -14,10 +14,10 @@ requests to be merged and much more.
## View your group's Insights ## View your group's Insights
You can access your group's Insights by clicking the **Overview > Insights** You can access your group's Insights by clicking the **Analytics > Insights**
link in the left sidebar: link in the left sidebar:
![Insights sidebar link](img/insights_sidebar_link.png) ![Insights sidebar link](img/insights_sidebar_link_v12_8.png)
## Configure your Insights ## Configure your Insights
......
...@@ -10,7 +10,7 @@ Issues Analytics is a bar graph which illustrates the number of issues created e ...@@ -10,7 +10,7 @@ Issues Analytics is a bar graph which illustrates the number of issues created e
The default timespan is 13 months, which includes the current month, and the 12 months The default timespan is 13 months, which includes the current month, and the 12 months
prior. prior.
To access the chart, navigate to a group's sidebar and select **Issues > Analytics**. To access the chart, navigate to a group's sidebar and select **Analytics > Issues Analytics**.
Hover over each bar to see the total number of issues. Hover over each bar to see the total number of issues.
...@@ -28,7 +28,7 @@ You can change the total number of months displayed by setting a URL parameter. ...@@ -28,7 +28,7 @@ You can change the total number of months displayed by setting a URL parameter.
For example, `https://gitlab.com/groups/gitlab-org/-/issues_analytics?months_back=15` For example, `https://gitlab.com/groups/gitlab-org/-/issues_analytics?months_back=15`
shows a total of 15 months for the chart in the GitLab.org group. shows a total of 15 months for the chart in the GitLab.org group.
![Issues created per month](img/issues_created_per_month.png) ![Issues created per month](img/issues_created_per_month_v12_8.png)
<!-- ## Troubleshooting <!-- ## Troubleshooting
......
...@@ -13,10 +13,10 @@ This feature is [also available at the group level](../../group/insights/index.m ...@@ -13,10 +13,10 @@ This feature is [also available at the group level](../../group/insights/index.m
## View your project's Insights ## View your project's Insights
You can access your project's Insights by clicking the **Project > Insights** You can access your project's Insights by clicking the **Analytics > Insights**
link in the left sidebar: link in the left sidebar:
![Insights sidebar link](img/insights_sidebar_link.png) ![Insights sidebar link](img/insights_sidebar_link_v12_8.png)
## Configure your Insights ## Configure your Insights
......
...@@ -52,7 +52,7 @@ relatively quickly to work, and they will take you to another page in the projec ...@@ -52,7 +52,7 @@ relatively quickly to work, and they will take you to another page in the projec
| <kbd>t</kbd> | Go to the project file search page. (**Repository > Files**, click **Find Files**). | | <kbd>t</kbd> | Go to the project file search page. (**Repository > Files**, click **Find Files**). |
| <kbd>g</kbd> + <kbd>c</kbd> | Go to the project commits list (**Repository > Commits**). | | <kbd>g</kbd> + <kbd>c</kbd> | Go to the project commits list (**Repository > Commits**). |
| <kbd>g</kbd> + <kbd>n</kbd> | Go to the [repository graph](#repository-graph) page (**Repository > Graph**). | | <kbd>g</kbd> + <kbd>n</kbd> | Go to the [repository graph](#repository-graph) page (**Repository > Graph**). |
| <kbd>g</kbd> + <kbd>d</kbd> | Go to repository charts (**Repository > Charts**). | | <kbd>g</kbd> + <kbd>d</kbd> | Go to repository charts (**Analytics > Repository Analytics**). |
| <kbd>g</kbd> + <kbd>i</kbd> | Go to the project issues list (**Issues > List**). | | <kbd>g</kbd> + <kbd>i</kbd> | Go to the project issues list (**Issues > List**). |
| <kbd>i</kbd> | Go to the New Issue page (**Issues**, click **New Issue** ). | | <kbd>i</kbd> | Go to the New Issue page (**Issues**, click **New Issue** ). |
| <kbd>g</kbd> + <kbd>b</kbd> | Go to the project issue boards list (**Issues > Boards**). | | <kbd>g</kbd> + <kbd>b</kbd> | Go to the project issue boards list (**Issues > Boards**). |
......
...@@ -37,7 +37,7 @@ module EE ...@@ -37,7 +37,7 @@ module EE
end end
def contribution_analytics_navbar_link(group, current_user) def contribution_analytics_navbar_link(group, current_user)
return unless ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, group) return unless ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, group, default_enabled: true)
return unless group_sidebar_link?(:contribution_analytics) return unless group_sidebar_link?(:contribution_analytics)
navbar_sub_item( navbar_sub_item(
...@@ -49,7 +49,7 @@ module EE ...@@ -49,7 +49,7 @@ module EE
end end
def group_insights_navbar_link(group, current_user) def group_insights_navbar_link(group, current_user)
return unless ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, group) return unless ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, group, default_enabled: true)
return unless group_sidebar_link?(:group_insights) return unless group_sidebar_link?(:group_insights)
navbar_sub_item( navbar_sub_item(
...@@ -61,7 +61,7 @@ module EE ...@@ -61,7 +61,7 @@ module EE
end end
def issues_analytics_navbar_link(group, current_user) def issues_analytics_navbar_link(group, current_user)
return unless ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, group) return unless ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, group, default_enabled: true)
return unless group_sidebar_link?(:analytics) return unless group_sidebar_link?(:analytics)
navbar_sub_item( navbar_sub_item(
...@@ -72,7 +72,7 @@ module EE ...@@ -72,7 +72,7 @@ module EE
end end
def insights_navbar_link(project, current_user) def insights_navbar_link(project, current_user)
return unless ::Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, project) return unless ::Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, project, default_enabled: true)
return unless project_nav_tab?(:project_insights) return unless project_nav_tab?(:project_insights)
navbar_sub_item( navbar_sub_item(
......
...@@ -13,7 +13,7 @@ module EE ...@@ -13,7 +13,7 @@ module EE
override :group_overview_nav_link_paths override :group_overview_nav_link_paths
def group_overview_nav_link_paths def group_overview_nav_link_paths
if ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, @group) if ::Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, @group, default_enabled: true)
super super
else else
super + %w[ super + %w[
......
...@@ -6,7 +6,7 @@ module EE ...@@ -6,7 +6,7 @@ module EE
override :sidebar_projects_paths override :sidebar_projects_paths
def sidebar_projects_paths def sidebar_projects_paths
if ::Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, @project) if ::Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, @project, default_enabled: true)
super super
else else
super + %w[ super + %w[
......
- page_title _('Analytics') - page_title _('Issues Analytics')
= render 'shared/issuable/search_bar', type: :issues_analytics, show_sorting_dropdown: false = render 'shared/issuable/search_bar', type: :issues_analytics, show_sorting_dropdown: false
#js-issues-analytics{ data: { endpoint: group_issues_analytics_path(@group) } } #js-issues-analytics{ data: { endpoint: group_issues_analytics_path(@group) } }
...@@ -159,6 +159,10 @@ module QA ...@@ -159,6 +159,10 @@ module QA
autoload :Validator, 'qa/page/validator' autoload :Validator, 'qa/page/validator'
autoload :Validatable, 'qa/page/validatable' autoload :Validatable, 'qa/page/validatable'
module SubMenus
autoload :Common, 'qa/page/sub_menus/common'
end
module Main module Main
autoload :Login, 'qa/page/main/login' autoload :Login, 'qa/page/main/login'
autoload :Menu, 'qa/page/main/menu' autoload :Menu, 'qa/page/main/menu'
......
...@@ -71,8 +71,10 @@ module QA ...@@ -71,8 +71,10 @@ module QA
end end
def click_group_insights_link def click_group_insights_link
within_sidebar do hover_element(:analytics_link) do
click_element(:group_insights_link) within_submenu(:analytics_sidebar_submenu) do
click_element(:group_insights_link)
end
end end
end end
......
...@@ -15,8 +15,10 @@ module QA ...@@ -15,8 +15,10 @@ module QA
end end
def click_project_insights_link def click_project_insights_link
within_sidebar do hover_element(:analytics_link) do
click_element(:project_insights_link) within_submenu(:analytics_sidebar_submenu) do
click_element(:project_insights_link)
end
end end
end end
end end
......
...@@ -13,15 +13,22 @@ module QA ...@@ -13,15 +13,22 @@ module QA
element :contribution_analytics_link element :contribution_analytics_link
end end
view 'app/views/layouts/nav/sidebar/_analytics_links.html.haml' do
element :analytics_link
element :analytics_sidebar_submenu
end
def click_group_members_item def click_group_members_item
within_sidebar do within_sidebar do
click_element(:group_members_item) click_element(:group_members_item)
end end
end end
def click_group_analytics_item def click_contribution_analytics_item
within_sidebar do hover_element(:analytics_link) do
click_element(:contribution_analytics_link) within_submenu(:analytics_sidebar_submenu) do
click_element(:contribution_analytics_link)
end
end end
end end
......
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
module Group module Group
module SubMenus module SubMenus
module Common module Common
include QA::Page::SubMenus::Common
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
view 'app/views/layouts/nav/sidebar/_group.html.haml' do view 'app/views/layouts/nav/sidebar/_group.html.haml' do
...@@ -13,23 +15,10 @@ module QA ...@@ -13,23 +15,10 @@ module QA
end end
end end
def hover_element(element) private
within_sidebar do
find_element(element).hover
yield
end
end
def within_sidebar def sidebar_element
within_element(:group_sidebar) do :group_sidebar
yield
end
end
def within_submenu(element)
within_element(element) do
yield
end
end end
end end
end end
......
...@@ -5,20 +5,12 @@ module QA ...@@ -5,20 +5,12 @@ module QA
module Project module Project
module SubMenus module SubMenus
module Common module Common
def within_sidebar include QA::Page::SubMenus::Common
within('.sidebar-top-level-items') do
yield private
end
end
def within_submenu def sidebar_element
if has_css?('.fly-out-list') :project_sidebar
within('.fly-out-list') do
yield
end
else
yield
end
end end
end end
end end
......
# frozen_string_literal: true
module QA
module Page
module SubMenus
module Common
def hover_element(element)
within_sidebar do
find_element(element).hover
yield
end
end
def within_sidebar
within_element(sidebar_element) do
yield
end
end
def within_submenu(element = nil)
if element
within_element(element) do
yield
end
else
within_submenu_without_element do
yield
end
end
end
private
def within_submenu_without_element
if has_css?('.fly-out-list')
within('.fly-out-list') do
yield
end
else
yield
end
end
def sidebar_element
raise NotImplementedError
end
end
end
end
end
...@@ -38,7 +38,7 @@ module QA ...@@ -38,7 +38,7 @@ module QA
Page::MergeRequest::Show.perform(&:merge!) Page::MergeRequest::Show.perform(&:merge!)
group.visit! group.visit!
Page::Group::Menu.perform(&:click_group_analytics_item) Page::Group::Menu.perform(&:click_contribution_analytics_item)
end end
it 'tests contributions' do it 'tests contributions' do
......
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