Commit 16b4cf42 authored by Florie Guibert's avatar Florie Guibert

Clean up unecessary uses of deprecated BoardsStore

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