Commit 03fc5f19 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch '340844-display-existing-planning-hierarchy-at-the-project-level-flag' into 'master'

Moved feature flags for planning hierarchy

See merge request gitlab-org/gitlab!80004
parents 3b05c836 4e50d379
...@@ -25,14 +25,20 @@ export default { ...@@ -25,14 +25,20 @@ export default {
workItemTypes() { workItemTypes() {
return this.workItemHierarchy.reduce( return this.workItemHierarchy.reduce(
(itemTypes, item) => { (itemTypes, item) => {
const skipItem = workItemTypes[item.type].isWorkItem && !window.gon?.features?.workItems;
if (skipItem) {
return itemTypes;
}
const key = item.available ? 'available' : 'unavailable'; const key = item.available ? 'available' : 'unavailable';
const nestedTypes = item.nestedTypes?.map((type) => workItemTypes[type]);
itemTypes[key].push({ itemTypes[key].push({
...item, ...item,
...workItemTypes[item.type], ...workItemTypes[item.type],
nestedTypes: item.nestedTypes nestedTypes,
? item.nestedTypes.map((type) => workItemTypes[type])
: null,
}); });
return itemTypes; return itemTypes;
}, },
{ available: [], unavailable: [] }, { available: [], unavailable: [] },
......
...@@ -31,6 +31,7 @@ export const workItemTypes = { ...@@ -31,6 +31,7 @@ export const workItemTypes = {
icon: 'task-done', icon: 'task-done',
color: '#217645', color: '#217645',
backgroundColor: '#C3E6CD', backgroundColor: '#C3E6CD',
isWorkItem: true,
}, },
INCIDENT: { INCIDENT: {
title: __('Incident'), title: __('Incident'),
......
...@@ -7,8 +7,6 @@ module PlanningHierarchy ...@@ -7,8 +7,6 @@ module PlanningHierarchy
def planning_hierarchy def planning_hierarchy
return access_denied! unless can?(current_user, :read_planning_hierarchy, @project) return access_denied! unless can?(current_user, :read_planning_hierarchy, @project)
return render_404 unless Feature.enabled?(:work_items_hierarchy, @project, default_enabled: :yaml)
render 'shared/planning_hierarchy' render 'shared/planning_hierarchy'
end end
# rubocop:enable Gitlab/ModuleWithInstanceVariables # rubocop:enable Gitlab/ModuleWithInstanceVariables
......
...@@ -42,6 +42,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -42,6 +42,7 @@ class ProjectsController < Projects::ApplicationController
push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml) push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml)
push_licensed_feature(:file_locks) if @project.present? && @project.licensed_feature_available?(:file_locks) push_licensed_feature(:file_locks) if @project.present? && @project.licensed_feature_available?(:file_locks)
push_frontend_feature_flag(:consolidated_edit_button, @project, default_enabled: :yaml) push_frontend_feature_flag(:consolidated_edit_button, @project, default_enabled: :yaml)
push_frontend_feature_flag(:work_items, @project, default_enabled: :yaml)
end end
layout :determine_layout layout :determine_layout
......
---
name: work_items_hierarchy
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79315
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350451
milestone: '14.8'
type: development
group: group::product planning
default_enabled: false
...@@ -19,8 +19,7 @@ module Sidebars ...@@ -19,8 +19,7 @@ module Sidebars
end end
def show_hierarachy_menu_item?(container) def show_hierarachy_menu_item?(container)
Feature.enabled?(:work_items_hierarchy, container, default_enabled: :yaml) && can?(context.current_user, :read_planning_hierarchy, container)
can?(context.current_user, :read_planning_hierarchy, container)
end end
end end
end end
......
...@@ -5,22 +5,7 @@ require 'spec_helper' ...@@ -5,22 +5,7 @@ require 'spec_helper'
RSpec.describe Sidebars::Concerns::WorkItemHierarchy do RSpec.describe Sidebars::Concerns::WorkItemHierarchy do
shared_examples 'hierarchy menu' do shared_examples 'hierarchy menu' do
let(:item_id) { :hierarchy } let(:item_id) { :hierarchy }
specify { is_expected.not_to be_nil }
context 'when the feature is disabled does not render' do
before do
stub_feature_flags(work_items_hierarchy: false)
end
specify { is_expected.to be_nil }
end
context 'when the feature is enabled does render' do
before do
stub_feature_flags(work_items_hierarchy: true)
end
specify { is_expected.not_to be_nil }
end
end end
describe 'Project hierarchy menu item' do describe 'Project hierarchy menu item' do
......
...@@ -63,21 +63,7 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do ...@@ -63,21 +63,7 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
describe 'Hierarchy' do describe 'Hierarchy' do
let(:item_id) { :hierarchy } let(:item_id) { :hierarchy }
context 'when the feature is disabled' do specify { is_expected.not_to be_nil }
before do
stub_feature_flags(work_items_hierarchy: false)
end
specify { is_expected.to be_nil }
end
context 'when the feature is enabled' do
before do
stub_feature_flags(work_items_hierarchy: true)
end
specify { is_expected.not_to be_nil }
end
end end
end end
end end
...@@ -14,21 +14,10 @@ RSpec.describe PlanningHierarchy, type: :request do ...@@ -14,21 +14,10 @@ RSpec.describe PlanningHierarchy, type: :request do
describe 'GET #planning_hierarchy' do describe 'GET #planning_hierarchy' do
it 'renders planning hierarchy' do it 'renders planning hierarchy' do
stub_feature_flags(work_items_hierarchy: true)
get project_planning_hierarchy_path(project) get project_planning_hierarchy_path(project)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to match(/id="js-work-items-hierarchy"/) expect(response.body).to match(/id="js-work-items-hierarchy"/)
end end
it 'renders 404 page' do
stub_feature_flags(work_items_hierarchy: false)
get project_planning_hierarchy_path(project)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).not_to match(/id="js-work-items-hierarchy"/)
end
end end
end end
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