Commit 1af360de authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '324283-delete-epic-board-list' into 'master'

Delete epic board list [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!60559
parents 269efbd6 b6bbcfe1
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
return this.list?.label?.description || this.list?.assignee?.name || this.list.title || ''; return this.list?.label?.description || this.list?.assignee?.name || this.list.title || '';
}, },
showListHeaderButton() { showListHeaderButton() {
return !this.disabled && this.listType !== ListType.closed && !this.isEpicBoard; return !this.disabled && this.listType !== ListType.closed;
}, },
showMilestoneListDetails() { showMilestoneListDetails() {
return this.listType === ListType.milestone && this.list.milestone && this.showListDetails; return this.listType === ListType.milestone && this.list.milestone && this.showListDetails;
......
...@@ -29,17 +29,17 @@ export default { ...@@ -29,17 +29,17 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(['isSidebarOpen', 'shouldUseGraphQL']), ...mapGetters(['isSidebarOpen', 'shouldUseGraphQL', 'isEpicBoard']),
...mapState(['activeId', 'sidebarType', 'boardLists']), ...mapState(['activeId', 'sidebarType', 'boardLists']),
isWipLimitsOn() { isWipLimitsOn() {
return this.glFeatures.wipLimits; return this.glFeatures.wipLimits && !this.isEpicBoard;
}, },
activeList() { activeList() {
/* /*
Warning: Though a computed property it is not reactive because we are Warning: Though a computed property it is not reactive because we are
referencing a List Model class. Reactivity only applies to plain JS objects referencing a List Model class. Reactivity only applies to plain JS objects
*/ */
if (this.shouldUseGraphQL) { if (this.shouldUseGraphQL || this.isEpicBoard) {
return this.boardLists[this.activeId]; return this.boardLists[this.activeId];
} }
return boardsStore.state.lists.find(({ id }) => id === this.activeId); return boardsStore.state.lists.find(({ id }) => id === this.activeId);
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
deleteBoard() { deleteBoard() {
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
if (window.confirm(__('Are you sure you want to remove this list?'))) { if (window.confirm(__('Are you sure you want to remove this list?'))) {
if (this.shouldUseGraphQL) { if (this.shouldUseGraphQL || this.isEpicBoard) {
this.removeList(this.activeId); this.removeList(this.activeId);
} else { } else {
this.activeList.destroy(); this.activeList.destroy();
......
...@@ -2,6 +2,7 @@ import { __ } from '~/locale'; ...@@ -2,6 +2,7 @@ import { __ } from '~/locale';
import updateEpicSubscriptionMutation from '~/sidebar/queries/update_epic_subscription.mutation.graphql'; import updateEpicSubscriptionMutation from '~/sidebar/queries/update_epic_subscription.mutation.graphql';
import updateEpicTitleMutation from '~/sidebar/queries/update_epic_title.mutation.graphql'; import updateEpicTitleMutation from '~/sidebar/queries/update_epic_title.mutation.graphql';
import boardBlockingIssuesQuery from './graphql/board_blocking_issues.query.graphql'; import boardBlockingIssuesQuery from './graphql/board_blocking_issues.query.graphql';
import destroyBoardListMutation from './graphql/board_list_destroy.mutation.graphql';
import updateBoardListMutation from './graphql/board_list_update.mutation.graphql'; import updateBoardListMutation from './graphql/board_list_update.mutation.graphql';
import issueSetSubscriptionMutation from './graphql/issue_set_subscription.mutation.graphql'; import issueSetSubscriptionMutation from './graphql/issue_set_subscription.mutation.graphql';
import issueSetTitleMutation from './graphql/issue_set_title.mutation.graphql'; import issueSetTitleMutation from './graphql/issue_set_title.mutation.graphql';
...@@ -73,6 +74,12 @@ export const updateListQueries = { ...@@ -73,6 +74,12 @@ export const updateListQueries = {
}, },
}; };
export const deleteListQueries = {
[issuableTypes.issue]: {
mutation: destroyBoardListMutation,
},
};
export const titleQueries = { export const titleQueries = {
[issuableTypes.issue]: { [issuableTypes.issue]: {
mutation: issueSetTitleMutation, mutation: issueSetTitleMutation,
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
titleQueries, titleQueries,
subscriptionQueries, subscriptionQueries,
SupportedFilters, SupportedFilters,
deleteListQueries,
updateListQueries, updateListQueries,
} from 'ee_else_ce/boards/constants'; } from 'ee_else_ce/boards/constants';
import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql'; import createBoardListMutation from 'ee_else_ce/boards/graphql/board_list_create.mutation.graphql';
...@@ -31,7 +32,6 @@ import { ...@@ -31,7 +32,6 @@ import {
getSupportedParams, getSupportedParams,
} from '../boards_util'; } from '../boards_util';
import boardLabelsQuery from '../graphql/board_labels.query.graphql'; import boardLabelsQuery from '../graphql/board_labels.query.graphql';
import destroyBoardListMutation from '../graphql/board_list_destroy.mutation.graphql';
import groupProjectsQuery from '../graphql/group_projects.query.graphql'; import groupProjectsQuery from '../graphql/group_projects.query.graphql';
import issueCreateMutation from '../graphql/issue_create.mutation.graphql'; import issueCreateMutation from '../graphql/issue_create.mutation.graphql';
import issueSetDueDateMutation from '../graphql/issue_set_due_date.mutation.graphql'; import issueSetDueDateMutation from '../graphql/issue_set_due_date.mutation.graphql';
...@@ -265,14 +265,14 @@ export default { ...@@ -265,14 +265,14 @@ export default {
commit(types.TOGGLE_LIST_COLLAPSED, { listId, collapsed }); commit(types.TOGGLE_LIST_COLLAPSED, { listId, collapsed });
}, },
removeList: ({ state, commit }, listId) => { removeList: ({ state: { issuableType, boardLists }, commit }, listId) => {
const listsBackup = { ...state.boardLists }; const listsBackup = { ...boardLists };
commit(types.REMOVE_LIST, listId); commit(types.REMOVE_LIST, listId);
return gqlClient return gqlClient
.mutate({ .mutate({
mutation: destroyBoardListMutation, mutation: deleteListQueries[issuableType].mutation,
variables: { variables: {
listId, listId,
}, },
......
import { issuableTypes } from '~/boards/constants'; import { issuableTypes } from '~/boards/constants';
import destroyBoardListMutation from '~/boards/graphql/board_list_destroy.mutation.graphql';
import updateBoardListMutation from '~/boards/graphql/board_list_update.mutation.graphql'; import updateBoardListMutation from '~/boards/graphql/board_list_update.mutation.graphql';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import destroyEpicBoardListMutation from './graphql/epic_board_list_destroy.mutation.graphql';
import updateEpicBoardListMutation from './graphql/epic_board_list_update.mutation.graphql'; import updateEpicBoardListMutation from './graphql/epic_board_list_update.mutation.graphql';
export const DRAGGABLE_TAG = 'div'; export const DRAGGABLE_TAG = 'div';
...@@ -68,6 +70,15 @@ export const updateListQueries = { ...@@ -68,6 +70,15 @@ export const updateListQueries = {
}, },
}; };
export const deleteListQueries = {
[issuableTypes.issue]: {
mutation: destroyBoardListMutation,
},
[issuableTypes.epic]: {
mutation: destroyEpicBoardListMutation,
},
};
// re-export some FOSS constants so that lint does not yell // re-export some FOSS constants so that lint does not yell
// https://gitlab.com/gitlab-org/gitlab/-/issues/329164 // https://gitlab.com/gitlab-org/gitlab/-/issues/329164
export { export {
...@@ -82,6 +93,7 @@ export { ...@@ -82,6 +93,7 @@ export {
} from '~/boards/constants'; } from '~/boards/constants';
export default { export default {
deleteListQueries,
updateListQueries, updateListQueries,
DRAGGABLE_TAG, DRAGGABLE_TAG,
EpicFilterType, EpicFilterType,
......
mutation DestroyEpicBoardList($listId: BoardsEpicListID!) {
destroyBoardList: epicBoardListDestroy(input: { listId: $listId }) {
errors
}
}
...@@ -128,6 +128,18 @@ RSpec.describe 'epic boards', :js do ...@@ -128,6 +128,18 @@ RSpec.describe 'epic boards', :js do
expect(page).to have_selector(selector, text: label.title, count: 1) expect(page).to have_selector(selector, text: label.title, count: 1)
end end
it 'allows user to delete list from list settings sidebar' do
expect(page).to have_content(label.name)
page.within(find('.board:nth-child(2)')) do
click_button 'List settings'
end
accept_confirm { click_button 'Remove list' }
expect(page).not_to have_content(label.name)
end
end end
end end
...@@ -189,6 +201,14 @@ RSpec.describe 'epic boards', :js do ...@@ -189,6 +201,14 @@ RSpec.describe 'epic boards', :js do
end end
end end
end end
it 'does not show Remove list in list settings sidebar' do
page.within(find('.board:nth-child(2)')) do
click_button 'List settings'
end
expect(page).not_to have_button('Remove list')
end
end end
context 'filtered search' do context 'filtered search' do
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
formatIssue, formatIssue,
getMoveData, getMoveData,
} from '~/boards/boards_util'; } from '~/boards/boards_util';
import { inactiveId, ISSUABLE, ListType } from '~/boards/constants'; import { inactiveId, ISSUABLE, ListType, issuableTypes } from '~/boards/constants';
import destroyBoardListMutation from '~/boards/graphql/board_list_destroy.mutation.graphql'; import destroyBoardListMutation from '~/boards/graphql/board_list_destroy.mutation.graphql';
import issueCreateMutation from '~/boards/graphql/issue_create.mutation.graphql'; import issueCreateMutation from '~/boards/graphql/issue_create.mutation.graphql';
import actions, { gqlClient } from '~/boards/stores/actions'; import actions, { gqlClient } from '~/boards/stores/actions';
...@@ -459,7 +459,7 @@ describe('updateList', () => { ...@@ -459,7 +459,7 @@ describe('updateList', () => {
boardType: 'group', boardType: 'group',
disabled: false, disabled: false,
boardLists: [{ type: 'closed' }], boardLists: [{ type: 'closed' }],
issuableType: 'issue', issuableType: issuableTypes.issue,
}; };
testAction( testAction(
...@@ -503,6 +503,7 @@ describe('removeList', () => { ...@@ -503,6 +503,7 @@ describe('removeList', () => {
beforeEach(() => { beforeEach(() => {
state = { state = {
boardLists: mockListsById, boardLists: mockListsById,
issuableType: issuableTypes.issue,
}; };
}); });
...@@ -1375,7 +1376,7 @@ describe('setActiveItemSubscribed', () => { ...@@ -1375,7 +1376,7 @@ describe('setActiveItemSubscribed', () => {
[mockActiveIssue.id]: mockActiveIssue, [mockActiveIssue.id]: mockActiveIssue,
}, },
fullPath: 'gitlab-org', fullPath: 'gitlab-org',
issuableType: 'issue', issuableType: issuableTypes.issue,
}; };
const getters = { activeBoardItem: mockActiveIssue, isEpicBoard: false }; const getters = { activeBoardItem: mockActiveIssue, isEpicBoard: false };
const subscribedState = true; const subscribedState = true;
...@@ -1483,7 +1484,7 @@ describe('setActiveIssueMilestone', () => { ...@@ -1483,7 +1484,7 @@ describe('setActiveIssueMilestone', () => {
describe('setActiveItemTitle', () => { describe('setActiveItemTitle', () => {
const state = { const state = {
boardItems: { [mockIssue.id]: mockIssue }, boardItems: { [mockIssue.id]: mockIssue },
issuableType: 'issue', issuableType: issuableTypes.issue,
fullPath: 'path/f', fullPath: 'path/f',
}; };
const getters = { activeBoardItem: mockIssue, isEpicBoard: false }; const getters = { activeBoardItem: mockIssue, isEpicBoard: 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