Commit f044f887 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '329767-ee-only-components-should-not-be-available-in-boards-when-in-ce' into 'master'

Boards - Hide EE components in CE [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61083
parents 6102cc94 6c403eb4
......@@ -11,7 +11,6 @@ import { contentTop } from '~/lib/utils/common_utils';
import SidebarAssigneesWidget from '~/sidebar/components/assignees/sidebar_assignees_widget.vue';
import SidebarConfidentialityWidget from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue';
import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
headerHeight: `${contentTop()}px`,
......@@ -32,7 +31,17 @@ export default {
SidebarIterationWidget: () =>
import('ee_component/sidebar/components/sidebar_iteration_widget.vue'),
},
mixins: [glFeatureFlagsMixin()],
inject: {
epicFeatureAvailable: {
default: false,
},
iterationFeatureAvailable: {
default: false,
},
weightFeatureAvailable: {
default: false,
},
},
computed: {
...mapGetters([
'isSidebarOpen',
......@@ -77,10 +86,11 @@ export default {
class="assignee"
@assignees-updated="setAssignees"
/>
<board-sidebar-epic-select class="epic" />
<board-sidebar-epic-select v-if="epicFeatureAvailable" class="epic" />
<div>
<board-sidebar-milestone-select />
<sidebar-iteration-widget
v-if="iterationFeatureAvailable"
:iid="activeBoardItem.iid"
:workspace-path="projectPathForActiveIssue"
:iterations-workspace-path="groupPathForActiveIssue"
......@@ -91,7 +101,7 @@ export default {
<board-sidebar-time-tracker class="swimlanes-sidebar-time-tracker" />
<board-sidebar-due-date />
<board-sidebar-labels-select class="labels" />
<board-sidebar-weight-input v-if="glFeatures.issueWeights" class="weight" />
<board-sidebar-weight-input v-if="weightFeatureAvailable" class="weight" />
<sidebar-confidentiality-widget
:iid="activeBoardItem.iid"
:full-path="fullPath"
......
......@@ -101,6 +101,8 @@ export default () => {
labelsManagePath: $boardApp.dataset.labelsManagePath,
labelsFilterBasePath: $boardApp.dataset.labelsFilterBasePath,
timeTrackingLimitToHours: parseBoolean($boardApp.dataset.timeTrackingLimitToHours),
epicFeatureAvailable: parseBoolean($boardApp.dataset.epicFeatureAvailable),
iterationFeatureAvailable: parseBoolean($boardApp.dataset.iterationFeatureAvailable),
weightFeatureAvailable: parseBoolean($boardApp.dataset.weightFeatureAvailable),
boardWeight: $boardApp.dataset.boardWeight
? parseInt($boardApp.dataset.boardWeight, 10)
......
......@@ -29,6 +29,8 @@ module EE
milestone_lists_available: current_board_parent.feature_available?(:board_milestone_lists).to_s,
assignee_lists_available: current_board_parent.feature_available?(:board_assignee_lists).to_s,
iteration_lists_available: current_board_parent.feature_available?(:board_iteration_lists).to_s,
epic_feature_available: current_board_parent.feature_available?(:epics).to_s,
iteration_feature_available: current_board_parent.feature_available?(:iterations).to_s,
show_promotion: show_feature_promotion,
scoped_labels: current_board_parent.feature_available?(:scoped_labels)&.to_s,
can_update: can_update?.to_s,
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ee/BoardContentSidebar matches the snapshot 1`] = `
<div>
Issue details
<board-sidebar-title-stub />
<sidebar-assignees-widget-stub
allowmultipleassignees="true"
class="assignee"
fullpath="gitlab-org/gitlab-test"
iid="27"
initialassignees="[object Object],[object Object]"
issuabletype="issue"
/>
<board-editable-item-stub
class="epic"
data-testid="sidebar-epic"
handleoffclick="true"
title="Epic"
>
<epics-select-stub
canedit="true"
class="gl-w-full"
epicissueid="0"
groupid="1"
initialepic="[object Object]"
issueid="0"
variant="standalone"
/>
</board-editable-item-stub>
<div>
<board-sidebar-milestone-select-stub />
<div
class="gl-mt-5"
data-qa-selector="iteration_container"
>
<sidebar-editable-item-stub
canedit="true"
data-testid="iteration-edit-link"
title="Iteration"
tracking="[object Object]"
/>
</div>
</div>
<board-sidebar-time-tracker-stub
class="swimlanes-sidebar-time-tracker"
/>
<board-sidebar-due-date-stub />
<board-sidebar-labels-select-stub
class="labels"
/>
<board-editable-item-stub
class="weight"
data-testid="sidebar-weight"
handleoffclick="true"
title="Weight"
>
<gl-form-stub>
<gl-form-input-stub
min="0"
placeholder="Enter a number"
type="number"
/>
</gl-form-stub>
</board-editable-item-stub>
<sidebar-confidentiality-widget-stub
fullpath="gitlab-org/gitlab-test"
iid="27"
issuabletype="issue"
/>
<sidebar-subscriptions-widget-stub
data-testid="sidebar-notifications"
fullpath="gitlab-org/gitlab-test"
iid="27"
issuabletype="issue"
/>
</div>
`;
import { GlDrawer } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import SidebarIterationWidget from 'ee_component/sidebar/components/sidebar_iteration_widget';
import { stubComponent } from 'helpers/stub_component';
import BoardContentSidebar from '~/boards/components/board_content_sidebar.vue';
import { ISSUABLE, issuableTypes } from '~/boards/constants';
......@@ -45,6 +44,9 @@ describe('ee/BoardContentSidebar', () => {
canUpdate: true,
rootPath: '/',
groupId: 1,
epicFeatureAvailable: true,
iterationFeatureAvailable: true,
weightFeatureAvailable: true,
},
store,
stubs: {
......@@ -80,7 +82,7 @@ describe('ee/BoardContentSidebar', () => {
wrapper = null;
});
it('renders SidebarIterationWidget', () => {
expect(wrapper.find(SidebarIterationWidget).exists()).toBe(true);
it('matches the snapshot', () => {
expect(wrapper.element).toMatchSnapshot();
});
});
# frozen_string_literal: true
RSpec.shared_examples 'issue boards sidebar EE' do
context 'epic dropdown' do
let_it_be(:epic1) { create(:epic, group: group) }
let_it_be(:epic2) { create(:epic, group: group) }
context 'epics' do
context 'when epic feature available' do
let_it_be(:epic1) { create(:epic, group: group) }
let_it_be(:epic2) { create(:epic, group: group) }
let_it_be(:epic_issue, reload: true) { create(:epic_issue, epic: epic1, issue: issue) }
let_it_be(:epic_issue, reload: true) { create(:epic_issue, epic: epic1, issue: issue) }
context 'when the issue is associated with an epic' do
before do
first_card_with_epic.click
context 'when the issue is associated with an epic' do
before do
stub_licensed_features(epics: true)
first_card_with_epic.click
end
it 'displays name of epic and links to it' do
page.within('[data-testid="sidebar-epic"]') do
expect(page).to have_link(epic1.title, href: epic_path(epic1))
end
end
it 'updates the epic associated with the issue' do
page.within('[data-testid="sidebar-epic"]') do
find("[data-testid='edit-button']").click
wait_for_requests
find('.gl-new-dropdown-item', text: epic2.title).click
wait_for_requests
expect(page).to have_link(epic2.title, href: epic_path(epic2))
end
end
context 'when epics feature is not available' do
before do
stub_licensed_features(epics: false)
first_card_with_epic.click
wait_for_all_requests
end
it 'cannot find sidebar-epic' do
expect(page).not_to have_selector('[data-testid="sidebar-epic"]')
end
end
end
end
context 'iterations' do
context 'when iterations feature available' do
let_it_be(:iteration) { create(:iteration, group: group, start_date: 1.day.from_now, due_date: 2.days.from_now, title: 'Iteration 1') }
let_it_be(:iteration2) { create(:iteration, group: group, start_date: 2.days.ago, due_date: 1.day.ago, title: 'Iteration 2', state: 'closed', skip_future_date_validation: true) }
before do
iteration
stub_licensed_features(iterations: true)
first_card.click
wait_for_all_requests
end
it 'selects and updates the right iteration' do
find_and_click_edit_iteration
select_iteration(iteration.title)
expect(page.find('[data-testid="iteration-edit-link"]')).to have_content('Iteration 1')
find_and_click_edit_iteration
it 'displays name of epic and links to it' do
page.within('[data-testid="sidebar-epic"]') do
expect(page).to have_link(epic1.title, href: epic_path(epic1))
select_iteration('No iteration')
expect(page.find('[data-testid="iteration-edit-link"]')).to have_content('None')
end
context 'when iteration feature is not available' do
before do
stub_licensed_features(iterations: false)
first_card.click
wait_for_all_requests
end
it 'cannot find the iteration-edit-link' do
expect(page).not_to have_selector('[data-testid="iteration-edit-link"]')
end
end
end
end
def find_and_click_edit_iteration
page.find('[data-testid="iteration-edit-link"] [data-testid="edit-button"]').click
wait_for_all_requests
end
def select_iteration(iteration_name)
click_button(iteration_name)
wait_for_all_requests
end
end
context 'weight' do
context 'when issue weight feature available' do
before do
stub_licensed_features(issue_weights: true)
first_card.click
wait_for_all_requests
end
it 'updates the epic associated with the issue' do
page.within('[data-testid="sidebar-epic"]') do
find("[data-testid='edit-button']").click
it 'selects and updates weight' do
page.within('[data-testid="sidebar-weight"]') do
expect(page).to have_content('None')
click_button('Edit')
wait_for_requests
fill_in 'Enter a number', with: '2'
find_field('Enter a number').native.send_keys :enter
find('.gl-new-dropdown-item', text: epic2.title).click
wait_for_all_requests
wait_for_requests
expect(page).to have_content('2')
end
end
context 'when issue weight feature is not available' do
before do
stub_licensed_features(issue_weights: false)
first_card.click
wait_for_all_requests
end
expect(page).to have_link(epic2.title, href: epic_path(epic2))
it 'cannot find the sidebar-weight' do
expect(page).not_to have_selector('[data-testid="sidebar-weight"]')
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