Commit b49c7b8b authored by Adam Hegyi's avatar Adam Hegyi

Remove tasks_by_type_chart feature flag

parent 0138be44
# frozen_string_literal: true # frozen_string_literal: true
class Analytics::TasksByTypeController < Analytics::ApplicationController class Analytics::TasksByTypeController < Analytics::ApplicationController
check_feature_flag Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG
before_action :load_group before_action :load_group
before_action -> { check_feature_availability!(:type_of_work_analytics) } before_action -> { check_feature_availability!(:type_of_work_analytics) }
before_action -> { authorize_view_by_action!(:view_type_of_work_charts) } before_action -> { authorize_view_by_action!(:view_type_of_work_charts) }
......
---
title: Remove tasks_by_type_chart feature flag
merge_request: 30034
author:
type: changed
...@@ -18,11 +18,9 @@ namespace :analytics do ...@@ -18,11 +18,9 @@ namespace :analytics do
get '/cycle_analytics', to: redirect('-/analytics/value_stream_analytics') get '/cycle_analytics', to: redirect('-/analytics/value_stream_analytics')
end end
constraints(::Constraints::FeatureConstrainer.new(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG)) do
scope :type_of_work do scope :type_of_work do
resource :tasks_by_type, controller: :tasks_by_type, only: :show do resource :tasks_by_type, controller: :tasks_by_type, only: :show do
get :top_labels get :top_labels
end end
end end
end
end end
...@@ -23,7 +23,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do ...@@ -23,7 +23,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
namespace :analytics do namespace :analytics do
resource :productivity_analytics, only: :show, constraints: -> (req) { Gitlab::Analytics.productivity_analytics_enabled? } resource :productivity_analytics, only: :show, constraints: -> (req) { Gitlab::Analytics.productivity_analytics_enabled? }
constraints(::Constraints::FeatureConstrainer.new(Gitlab::Analytics::CYCLE_ANALYTICS_FEATURE_FLAG, default_enabled: Gitlab::Analytics.feature_enabled_by_default?(Gitlab::Analytics::CYCLE_ANALYTICS_FEATURE_FLAG))) do feature_default_enabled = Gitlab::Analytics.feature_enabled_by_default?(Gitlab::Analytics::CYCLE_ANALYTICS_FEATURE_FLAG)
constrainer = ::Constraints::FeatureConstrainer.new(Gitlab::Analytics::CYCLE_ANALYTICS_FEATURE_FLAG, default_enabled: feature_default_enabled)
constraints(constrainer) do
resource :cycle_analytics, only: :show, path: 'value_stream_analytics' resource :cycle_analytics, only: :show, path: 'value_stream_analytics'
scope module: :cycle_analytics, as: 'cycle_analytics', path: 'value_stream_analytics' do scope module: :cycle_analytics, as: 'cycle_analytics', path: 'value_stream_analytics' do
resources :stages, only: [:index, :create, :update, :destroy] do resources :stages, only: [:index, :create, :update, :destroy] do
...@@ -38,14 +40,12 @@ constraints(::Constraints::GroupUrlConstrainer.new) do ...@@ -38,14 +40,12 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
get '/cycle_analytics', to: redirect('-/analytics/value_stream_analytics') get '/cycle_analytics', to: redirect('-/analytics/value_stream_analytics')
end end
constraints(::Constraints::FeatureConstrainer.new(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG)) do
scope :type_of_work do scope :type_of_work do
resource :tasks_by_type, controller: :tasks_by_type, only: :show do resource :tasks_by_type, controller: :tasks_by_type, only: :show do
get :top_labels get :top_labels
end end
end end
end end
end
resource :ldap, only: [] do resource :ldap, only: [] do
member do member do
......
...@@ -5,12 +5,10 @@ module Gitlab ...@@ -5,12 +5,10 @@ module Gitlab
# Normally each analytics feature should be guarded with a feature flag. # Normally each analytics feature should be guarded with a feature flag.
CYCLE_ANALYTICS_FEATURE_FLAG = :cycle_analytics CYCLE_ANALYTICS_FEATURE_FLAG = :cycle_analytics
PRODUCTIVITY_ANALYTICS_FEATURE_FLAG = :productivity_analytics PRODUCTIVITY_ANALYTICS_FEATURE_FLAG = :productivity_analytics
TASKS_BY_TYPE_CHART_FEATURE_FLAG = :tasks_by_type_chart
FEATURE_FLAGS = [ FEATURE_FLAGS = [
CYCLE_ANALYTICS_FEATURE_FLAG, CYCLE_ANALYTICS_FEATURE_FLAG,
PRODUCTIVITY_ANALYTICS_FEATURE_FLAG, PRODUCTIVITY_ANALYTICS_FEATURE_FLAG
TASKS_BY_TYPE_CHART_FEATURE_FLAG
].freeze ].freeze
FEATURE_FLAG_DEFAULTS = { FEATURE_FLAG_DEFAULTS = {
......
...@@ -13,7 +13,6 @@ describe Analytics::TasksByTypeController do ...@@ -13,7 +13,6 @@ describe Analytics::TasksByTypeController do
before do before do
stub_licensed_features(type_of_work_analytics: true) stub_licensed_features(type_of_work_analytics: true)
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => true)
group.add_reporter(user) group.add_reporter(user)
sign_in(user) sign_in(user)
...@@ -52,18 +51,6 @@ describe Analytics::TasksByTypeController do ...@@ -52,18 +51,6 @@ describe Analytics::TasksByTypeController do
end end
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => false)
end
it 'returns not_found as response' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when `created_after` parameter is invalid' do context 'when `created_after` parameter is invalid' do
before do before do
params[:created_after] = 'invalid_date' params[:created_after] = 'invalid_date'
......
...@@ -10,7 +10,6 @@ describe Analytics::TasksByTypeController do ...@@ -10,7 +10,6 @@ describe Analytics::TasksByTypeController do
before do before do
stub_licensed_features(type_of_work_analytics: true) stub_licensed_features(type_of_work_analytics: true)
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => true)
group.add_reporter(user) group.add_reporter(user)
sign_in(user) sign_in(user)
...@@ -49,18 +48,6 @@ describe Analytics::TasksByTypeController do ...@@ -49,18 +48,6 @@ describe Analytics::TasksByTypeController do
end end
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => false)
end
it 'returns not_found as response' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when `created_after` parameter is invalid' do context 'when `created_after` parameter is invalid' do
before do before do
params[:created_after] = 'invalid_date' params[:created_after] = 'invalid_date'
......
...@@ -37,9 +37,6 @@ describe 'Group Value Stream Analytics', :js do ...@@ -37,9 +37,6 @@ describe 'Group Value Stream Analytics', :js do
before do before do
stub_licensed_features(cycle_analytics_for_groups: true) stub_licensed_features(cycle_analytics_for_groups: true)
# chart returns an error since theres no data
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => false)
group.add_owner(user) group.add_owner(user)
project.add_maintainer(user) project.add_maintainer(user)
...@@ -355,7 +352,6 @@ describe 'Group Value Stream Analytics', :js do ...@@ -355,7 +352,6 @@ describe 'Group Value Stream Analytics', :js do
context 'enabled' do context 'enabled' do
before do before do
stub_licensed_features(cycle_analytics_for_groups: true, type_of_work_analytics: true) stub_licensed_features(cycle_analytics_for_groups: true, type_of_work_analytics: true)
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => true)
sign_in(user) sign_in(user)
end end
...@@ -400,21 +396,6 @@ describe 'Group Value Stream Analytics', :js do ...@@ -400,21 +396,6 @@ describe 'Group Value Stream Analytics', :js do
end end
end end
end end
context 'not enabled' do
before do
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => false)
visit analytics_cycle_analytics_path
select_group
end
it 'will not display the tasks by type chart' do
expect(page).not_to have_selector('.js-tasks-by-type-chart')
expect(page).not_to have_text('Tasks by type')
end
end
end end
describe 'Customizable cycle analytics', :js do describe 'Customizable cycle analytics', :js do
......
...@@ -220,7 +220,6 @@ describe 'Analytics (JavaScript fixtures)', :sidekiq_inline do ...@@ -220,7 +220,6 @@ describe 'Analytics (JavaScript fixtures)', :sidekiq_inline do
end end
stub_licensed_features(type_of_work_analytics: true) stub_licensed_features(type_of_work_analytics: true)
stub_feature_flags(Gitlab::Analytics::TASKS_BY_TYPE_CHART_FEATURE_FLAG => true)
group.add_maintainer(user) group.add_maintainer(user)
......
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