Commit 2b68c483 authored by Simon Knox's avatar Simon Knox

Merge branch '232573-remove-the-use-of-boardsstore-in-board_settings_sidebar' into 'master'

Clean up unnecessary uses of deprecated BoardsStore

See merge request gitlab-org/gitlab!69329
parents d956823c 16b4cf42
...@@ -3,7 +3,6 @@ import { GlButton, GlDrawer, GlLabel } from '@gitlab/ui'; ...@@ -3,7 +3,6 @@ import { GlButton, GlDrawer, GlLabel } from '@gitlab/ui';
import { MountingPortal } from 'portal-vue'; import { MountingPortal } from 'portal-vue';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { LIST, ListType, ListTypeTitles } from '~/boards/constants'; import { LIST, ListType, ListTypeTitles } from '~/boards/constants';
import boardsStore from '~/boards/stores/boards_store';
import { isScopedLabel } from '~/lib/utils/common_utils'; import { isScopedLabel } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import eventHub from '~/sidebar/event_hub'; import eventHub from '~/sidebar/event_hub';
...@@ -23,7 +22,7 @@ export default { ...@@ -23,7 +22,7 @@ export default {
import('ee_component/boards/components/board_settings_list_types.vue'), import('ee_component/boards/components/board_settings_list_types.vue'),
}, },
mixins: [glFeatureFlagMixin(), Tracking.mixin()], mixins: [glFeatureFlagMixin(), Tracking.mixin()],
inject: ['canAdminList'], inject: ['canAdminList', 'scopedLabelsAvailable'],
inheritAttrs: false, inheritAttrs: false,
data() { data() {
return { return {
...@@ -61,7 +60,7 @@ export default { ...@@ -61,7 +60,7 @@ export default {
methods: { methods: {
...mapActions(['unsetActiveId', 'removeList']), ...mapActions(['unsetActiveId', 'removeList']),
showScopedLabels(label) { showScopedLabels(label) {
return boardsStore.scopedLabels.enabled && isScopedLabel(label); return this.scopedLabelsAvailable && isScopedLabel(label);
}, },
deleteBoard() { deleteBoard() {
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
......
...@@ -15,11 +15,6 @@ export default { ...@@ -15,11 +15,6 @@ export default {
}, },
mixins: [Tracking.mixin()], mixins: [Tracking.mixin()],
props: { props: {
boardsStore: {
type: Object,
required: false,
default: null,
},
canAdminList: { canAdminList: {
type: Boolean, type: Boolean,
required: true, required: true,
...@@ -41,9 +36,6 @@ export default { ...@@ -41,9 +36,6 @@ export default {
showPage() { showPage() {
this.track('click_button', { label: 'edit_board' }); this.track('click_button', { label: 'edit_board' });
eventHub.$emit('showBoardModal', formType.edit); eventHub.$emit('showBoardModal', formType.edit);
if (this.boardsStore) {
this.boardsStore.showPage(formType.edit);
}
}, },
}, },
}; };
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import ConfigToggle from './components/config_toggle.vue'; import ConfigToggle from './components/config_toggle.vue';
export default (boardsStore = undefined) => { export default () => {
const el = document.querySelector('.js-board-config'); const el = document.querySelector('.js-board-config');
if (!el) { if (!el) {
...@@ -15,7 +15,6 @@ export default (boardsStore = undefined) => { ...@@ -15,7 +15,6 @@ export default (boardsStore = undefined) => {
render(h) { render(h) {
return h(ConfigToggle, { return h(ConfigToggle, {
props: { props: {
boardsStore,
canAdminList: parseBoolean(el.dataset.canAdminList), canAdminList: parseBoolean(el.dataset.canAdminList),
hasScope: parseBoolean(el.dataset.hasScope), hasScope: parseBoolean(el.dataset.hasScope),
}, },
......
...@@ -298,7 +298,7 @@ export default () => { ...@@ -298,7 +298,7 @@ export default () => {
}); });
} }
boardConfigToggle(boardsStore); boardConfigToggle();
toggleFocusMode(); toggleFocusMode();
toggleLabels(); toggleLabels();
......
import { GlLabel } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
...@@ -33,6 +34,7 @@ describe('ee/BoardSettingsSidebar', () => { ...@@ -33,6 +34,7 @@ describe('ee/BoardSettingsSidebar', () => {
wipLimits: isWipLimitsOn, wipLimits: isWipLimitsOn,
}, },
canAdminList: false, canAdminList: false,
scopedLabelsAvailable: true,
}, },
stubs: { stubs: {
'board-settings-sidebar-wip-limit': BoardSettingsWipLimit, 'board-settings-sidebar-wip-limit': BoardSettingsWipLimit,
...@@ -48,12 +50,20 @@ describe('ee/BoardSettingsSidebar', () => { ...@@ -48,12 +50,20 @@ describe('ee/BoardSettingsSidebar', () => {
it('confirms we render BoardSettingsSidebarWipLimit', () => { it('confirms we render BoardSettingsSidebarWipLimit', () => {
createComponent({ list: mockLabelList, isWipLimitsOn: true }); createComponent({ list: mockLabelList, isWipLimitsOn: true });
expect(wrapper.find(BoardSettingsWipLimit).exists()).toBe(true); expect(wrapper.findComponent(BoardSettingsWipLimit).exists()).toBe(true);
}); });
it('confirms we render BoardSettingsListTypes', () => { it('confirms we render BoardSettingsListTypes', () => {
createComponent({ list: mockMilestoneList }); createComponent({ list: mockMilestoneList });
expect(wrapper.find(BoardSettingsListTypes).exists()).toBe(true); expect(wrapper.findComponent(BoardSettingsListTypes).exists()).toBe(true);
});
it('passes scoped prop to label when label is scoped', () => {
createComponent({
list: { ...mockLabelList, label: { ...mockLabelList.label, title: 'foo::bar' } },
});
expect(wrapper.findComponent(GlLabel).props('scoped')).toBe(true);
}); });
}); });
import '~/boards/models/list';
import { GlDrawer, GlLabel } from '@gitlab/ui'; import { GlDrawer, GlLabel } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { MountingPortal } from 'portal-vue'; import { MountingPortal } from 'portal-vue';
...@@ -44,6 +43,7 @@ describe('BoardSettingsSidebar', () => { ...@@ -44,6 +43,7 @@ describe('BoardSettingsSidebar', () => {
store, store,
provide: { provide: {
canAdminList, canAdminList,
scopedLabelsAvailable: false,
}, },
}), }),
); );
......
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