diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index 72b8aef31a4b0ad01492148b028f2363cfe01046..db709d0bb9ec249090acf2f5118ebdea9376b1ce 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -24,7 +24,6 @@ const apolloProvider = new VueApollo({ function mountBoardApp(el) { const { boardId, groupId, fullPath, rootPath } = el.dataset; - const isApolloBoard = true; const rawFilterParams = queryToObject(window.location.search, { gatherArrays: true }); @@ -34,23 +33,6 @@ function mountBoardApp(el) { const boardType = el.dataset.parent; - if (!isApolloBoard) { - store.dispatch('fetchBoard', { - fullPath, - fullBoardId: fullBoardId(boardId), - boardType, - }); - - store.dispatch('setInitialBoardData', { - boardId, - fullBoardId: fullBoardId(boardId), - fullPath, - boardType, - disabled: parseBoolean(el.dataset.disabled) || true, - issuableType: TYPE_ISSUE, - }); - } - // eslint-disable-next-line no-new new Vue({ el, @@ -58,7 +40,6 @@ function mountBoardApp(el) { store, apolloProvider, provide: { - isApolloBoard, initialBoardId: fullBoardId(boardId), disabled: parseBoolean(el.dataset.disabled), groupId: Number(groupId), diff --git a/app/assets/javascripts/graphql_shared/issuable_client.js b/app/assets/javascripts/graphql_shared/issuable_client.js index d0ba34b6127ec4f9a587a777025ff9dd8475fe1d..0d911c497ff5cb74b6dc90d39c3ba7c923b2c952 100644 --- a/app/assets/javascripts/graphql_shared/issuable_client.js +++ b/app/assets/javascripts/graphql_shared/issuable_client.js @@ -1,6 +1,5 @@ import produce from 'immer'; import VueApollo from 'vue-apollo'; -import { defaultDataIdFromObject } from '@apollo/client/core'; import { concatPagination } from '@apollo/client/utilities'; import errorQuery from '~/boards/graphql/client/error.query.graphql'; import selectedBoardItemsQuery from '~/boards/graphql/client/selected_board_items.query.graphql'; @@ -14,13 +13,6 @@ import activeBoardItemQuery from 'ee_else_ce/boards/graphql/client/active_board_ export const config = { typeDefs, cacheConfig: { - // included temporarily until Vuex is removed from boards app - dataIdFromObject: (object) => { - // eslint-disable-next-line no-underscore-dangle - return object.__typename === 'BoardList' && !window.gon?.features?.apolloBoards - ? object.iid - : defaultDataIdFromObject(object); - }, typePolicies: { Query: { fields: { @@ -34,6 +26,12 @@ export const config = { return currentState ?? []; }, }, + boardList: { + keyArgs: ['id'], + }, + epicBoardList: { + keyArgs: ['id'], + }, }, }, Project: { @@ -135,104 +133,80 @@ export const config = { nodes: concatPagination(), }, }, - ...(window.gon?.features?.apolloBoards - ? { - BoardList: { - fields: { - issues: { - keyArgs: ['filters'], - }, - }, - }, - IssueConnection: { - merge(existing = { nodes: [] }, incoming, { args }) { - if (!args?.after) { - return incoming; - } - return { - ...incoming, - nodes: [...existing.nodes, ...incoming.nodes], - }; - }, - }, - EpicList: { - fields: { - epics: { - keyArgs: ['filters'], - }, - }, - }, - EpicConnection: { - merge(existing = { nodes: [] }, incoming, { args }) { - if (!args.after) { - return incoming; - } - return { - ...incoming, - nodes: [...existing.nodes, ...incoming.nodes], - }; - }, - }, - Group: { - fields: { - projects: { - keyArgs: ['includeSubgroups', 'search'], - }, - descendantGroups: { - keyArgs: ['includeSubgroups', 'search'], - }, - }, - }, - ProjectConnection: { - fields: { - nodes: concatPagination(), - }, - }, - GroupConnection: { - fields: { - nodes: concatPagination(), - }, - }, - Board: { - fields: { - epics: { - keyArgs: ['boardId'], - }, - }, - }, - BoardEpicConnection: { - merge(existing = { nodes: [] }, incoming, { args }) { - if (!args.after) { - return incoming; - } - return { - ...incoming, - nodes: [...existing.nodes, ...incoming.nodes], - }; - }, - }, - Query: { - fields: { - boardList: { - keyArgs: ['id'], - }, - epicBoardList: { - keyArgs: ['id'], - }, - isShowingLabels: { - read(currentState) { - return currentState ?? true; - }, - }, - selectedBoardItems: { - read(currentState) { - return currentState ?? []; - }, - }, - }, - }, + BoardList: { + fields: { + issues: { + keyArgs: ['filters'], + }, + }, + }, + IssueConnection: { + merge(existing = { nodes: [] }, incoming, { args }) { + if (!args?.after) { + return incoming; } - : {}), + return { + ...incoming, + nodes: [...existing.nodes, ...incoming.nodes], + }; + }, + }, + EpicList: { + fields: { + epics: { + keyArgs: ['filters'], + }, + }, + }, + EpicConnection: { + merge(existing = { nodes: [] }, incoming, { args }) { + if (!args.after) { + return incoming; + } + return { + ...incoming, + nodes: [...existing.nodes, ...incoming.nodes], + }; + }, + }, + Group: { + fields: { + projects: { + keyArgs: ['includeSubgroups', 'search'], + }, + descendantGroups: { + keyArgs: ['includeSubgroups', 'search'], + }, + }, + }, + ProjectConnection: { + fields: { + nodes: concatPagination(), + }, + }, + GroupConnection: { + fields: { + nodes: concatPagination(), + }, + }, + Board: { + fields: { + epics: { + keyArgs: ['boardId'], + }, + }, + }, + BoardEpicConnection: { + merge(existing = { nodes: [] }, incoming, { args }) { + if (!args.after) { + return incoming; + } + return { + ...incoming, + nodes: [...existing.nodes, ...incoming.nodes], + }; + }, + }, }, }, }; diff --git a/ee/app/assets/javascripts/boards/components/board_new_epic.vue b/ee/app/assets/javascripts/boards/components/board_new_epic.vue index 31d814689d82ef1a497b1c765abb60aa4c0e5a25..9f3e0d75bc6f5bb95b8fc82a36c7b1cf6b36c875 100644 --- a/ee/app/assets/javascripts/boards/components/board_new_epic.vue +++ b/ee/app/assets/javascripts/boards/components/board_new_epic.vue @@ -1,6 +1,4 @@ <script> -// eslint-disable-next-line no-restricted-imports -import { mapActions } from 'vuex'; import { s__ } from '~/locale'; import BoardNewItem from '~/boards/components/board_new_item.vue'; import { toggleFormEventPrefix } from '~/boards/constants'; @@ -19,7 +17,7 @@ export default { BoardNewItem, GroupSelect, }, - inject: ['boardType', 'fullPath', 'isApolloBoard'], + inject: ['boardType', 'fullPath'], props: { list: { type: Object, @@ -37,18 +35,13 @@ export default { }, apollo: { board: { - query() { - return epicBoardQuery; - }, + query: epicBoardQuery, variables() { return { fullPath: this.fullPath, boardId: this.boardId, }; }, - skip() { - return !this.isApolloBoard; - }, update(data) { const { board } = data.workspace; return { @@ -76,28 +69,15 @@ export default { }, }, methods: { - ...mapActions(['addListNewEpic']), submit({ title }) { const labels = this.list.label ? [this.list.label] : []; - if (this.isApolloBoard) { - return this.addNewEpicToList({ - epicInput: { - title, - labelIds: labels?.map((l) => getIdFromGraphQLId(l.id)), - groupPath: this.groupPath, - }, - }); - } - return this.addListNewEpic({ + return this.addNewEpicToList({ epicInput: { title, labelIds: labels?.map((l) => getIdFromGraphQLId(l.id)), groupPath: this.groupPath, }, - list: this.list, - }).then(() => { - eventHub.$emit(this.formEvent); }); }, addNewEpicToList({ epicInput }) { diff --git a/ee/app/assets/javascripts/boards/components/board_settings_wip_limit.vue b/ee/app/assets/javascripts/boards/components/board_settings_wip_limit.vue index 083070f17817f43938c17a9f2497928f78d7097c..3d71278212da3c825989e1f0372b4c513f2d01a3 100644 --- a/ee/app/assets/javascripts/boards/components/board_settings_wip_limit.vue +++ b/ee/app/assets/javascripts/boards/components/board_settings_wip_limit.vue @@ -1,7 +1,5 @@ <script> import { GlButton, GlFormInput } from '@gitlab/ui'; -// eslint-disable-next-line no-restricted-imports -import { mapActions, mapState } from 'vuex'; import { __, n__ } from '~/locale'; import autofocusonshow from '~/vue_shared/directives/autofocusonshow'; import { setError } from '~/boards/graphql/cache_updates'; @@ -23,7 +21,6 @@ export default { directives: { autofocusonshow, }, - inject: ['isApolloBoard'], props: { activeListId: { type: String, @@ -42,7 +39,6 @@ export default { }; }, computed: { - ...mapState(['activeId']), wipLimitTypeText() { return n__('%d issue', '%d issues', this.maxIssueCount); }, @@ -54,7 +50,6 @@ export default { }, }, methods: { - ...mapActions(['unsetActiveId', 'updateListWipLimit', 'setError']), showInput() { this.edit = true; this.currentWipLimit = this.maxIssueCount > 0 ? this.maxIssueCount : null; @@ -80,39 +75,13 @@ export default { // need to reassign bc were clearing the ref in resetStateAfterUpdate. const wipLimit = this.currentWipLimit; - if (this.isApolloBoard) { - this.updateWipLimit(this.activeListId, wipLimit); - } else { - this.updateListWipLimit({ maxIssueCount: wipLimit, listId: this.activeId }) - .catch(() => { - this.unsetActiveId(); - this.setError({ - message: this.$options.i18n.updateListError, - }); - }) - .finally(() => { - this.resetStateAfterUpdate(); - }); - } + this.updateWipLimit(this.activeListId, wipLimit); } else { this.edit = false; } }, clearWipLimit() { - if (this.isApolloBoard) { - this.updateWipLimit(this.activeListId, 0); - } else { - this.updateListWipLimit({ maxIssueCount: 0, listId: this.activeId }) - .catch(() => { - this.unsetActiveId(); - this.setError({ - message: this.$options.i18n.updateListError, - }); - }) - .finally(() => { - this.resetStateAfterUpdate(); - }); - } + this.updateWipLimit(this.activeListId, 0); }, async updateWipLimit(listId, maxIssueCount) { try { diff --git a/ee/app/assets/javascripts/boards/components/epic_lane.vue b/ee/app/assets/javascripts/boards/components/epic_lane.vue index a4e0f615c3a521db48b8d8ae4db1723902dc16bb..7ce23d990a4f0767b69215e1322322ca92ff7aa1 100644 --- a/ee/app/assets/javascripts/boards/components/epic_lane.vue +++ b/ee/app/assets/javascripts/boards/components/epic_lane.vue @@ -1,7 +1,5 @@ <script> import { GlButton, GlIcon, GlLink, GlLoadingIcon, GlPopover, GlTooltipDirective } from '@gitlab/ui'; -// eslint-disable-next-line no-restricted-imports -import { mapActions, mapGetters, mapState } from 'vuex'; import { STATUS_OPEN } from '~/issues/constants'; import { formatDate } from '~/lib/utils/datetime_utility'; import { __, n__, sprintf, s__ } from '~/locale'; @@ -26,7 +24,7 @@ export default { GlTooltip: GlTooltipDirective, }, mixins: [timeagoMixin], - inject: ['fullPath', 'boardType', 'isApolloBoard'], + inject: ['fullPath', 'boardType'], props: { epic: { type: Object, @@ -86,9 +84,6 @@ export default { isProject: this.boardType === BoardType.project, }; }, - skip() { - return !this.isApolloBoard; - }, update(data) { return data[this.boardType]?.board.lists.nodes; }, @@ -101,8 +96,6 @@ export default { }, }, computed: { - ...mapState(['epicsFlags']), - ...mapGetters(['getIssuesByEpic']), isOpen() { return this.epic.state === STATUS_OPEN; }, @@ -113,13 +106,7 @@ export default { return this.isCollapsed ? 'chevron-right' : 'chevron-down'; }, issuesCount() { - if (this.isApolloBoard) { - return this.listsWithIssues.reduce((total, list) => total + list.issues.nodes.length, 0); - } - return this.lists.reduce( - (total, list) => total + this.getIssuesByEpic(list.id, this.epic.id).length, - 0, - ); + return this.listsWithIssues.reduce((total, list) => total + list.issues.nodes.length, 0); }, issuesCountTooltipText() { return n__(`%d issue in this group`, `%d issues in this group`, this.issuesCount); @@ -137,10 +124,7 @@ export default { return formatDate(this.epic.createdAt); }, isLoading() { - return ( - Boolean(this.epicsFlags[this.epic.id]?.isLoading) || - this.$apollo.queries.listsWithIssues.loading - ); + return this.$apollo.queries.listsWithIssues.loading; }, shouldDisplay() { return this.issuesCount > 0 || this.isLoading; @@ -152,53 +136,25 @@ export default { return formatListIssuesForLanes(this.listsWithIssues); }, }, - watch: { - 'filterParams.epicId': { - handler(epicId) { - if (!this.isApolloBoard && (!epicId || epicId === this.epic.id)) { - this.fetchIssuesForEpic(this.epic.id); - } - }, - deep: true, - }, - }, - mounted() { - if (!this.isApolloBoard) { - this.fetchIssuesForEpic(this.epic.id); - } - }, methods: { - ...mapActions(['updateBoardEpicUserPreferences', 'fetchIssuesForEpic']), async toggleCollapsed() { this.isCollapsed = !this.isCollapsed; - if (this.isApolloBoard) { - try { - await this.$apollo.mutate({ - mutation: updateBoardEpicUserPreferencesMutation, - variables: { - boardId: this.boardId, - epicId: this.epic.id, - collapsed: this.isCollapsed, - }, - }); - } catch (error) { - setError({ error, message: __('Unable to save your preference') }); - } - } else { - this.updateBoardEpicUserPreferences({ - collapsed: this.isCollapsed, - epicId: this.epic.id, - }).catch(() => { - setError({ message: __('Unable to save your preference'), captureError: true }); + try { + await this.$apollo.mutate({ + mutation: updateBoardEpicUserPreferencesMutation, + variables: { + boardId: this.boardId, + epicId: this.epic.id, + collapsed: this.isCollapsed, + }, }); + } catch (error) { + setError({ error, message: __('Unable to save your preference') }); } }, getIssuesByList(listId) { - if (this.isApolloBoard) { - return this.issuesByList[listId]; - } - return this.getIssuesByEpic(listId, this.epic.id); + return this.issuesByList[listId]; }, }, }; @@ -266,7 +222,7 @@ export default { :can-admin-list="canAdminList" :board-id="boardId" :filter-params="filterParams" - :highlighted-lists-apollo="highlightedLists" + :highlighted-lists="highlightedLists" :can-admin-epic="canAdminEpic" :lists="lists" :total-issues-count="totalIssuesCountByListId[list.id]" diff --git a/ee/app/assets/javascripts/boards/components/epics_swimlanes.vue b/ee/app/assets/javascripts/boards/components/epics_swimlanes.vue index 82b67d004fb7a7e74fe2723084c7e92d5070a902..707db4f7b1b68afbc8674a937106182cc5e6bb5e 100644 --- a/ee/app/assets/javascripts/boards/components/epics_swimlanes.vue +++ b/ee/app/assets/javascripts/boards/components/epics_swimlanes.vue @@ -2,8 +2,6 @@ import { GlButton, GlIcon, GlTooltipDirective } from '@gitlab/ui'; import VirtualList from 'vue-virtual-scroll-list'; import Draggable from 'vuedraggable'; -// eslint-disable-next-line no-restricted-imports -import { mapActions, mapGetters, mapState } from 'vuex'; import BoardListHeader from 'ee_else_ce/boards/components/board_list_header.vue'; import { isListDraggable } from '~/boards/boards_util'; import { setError } from '~/boards/graphql/cache_updates'; @@ -38,7 +36,7 @@ export default { directives: { GlTooltip: GlTooltipDirective, }, - inject: ['boardType', 'disabled', 'fullPath', 'isApolloBoard'], + inject: ['boardType', 'disabled', 'fullPath'], props: { lists: { type: Array, @@ -80,12 +78,9 @@ export default { variables() { return { ...this.baseVariables, - issueFilters: this.filtersToUse, + issueFilters: this.filters, }; }, - skip() { - return !this.isApolloBoard; - }, update(data) { return data[this.boardType].board.epics; }, @@ -98,14 +93,6 @@ export default { }, }, computed: { - ...mapState([ - 'epics', - 'pageInfoByListId', - 'filterParams', - 'epicsSwimlanesFetchInProgress', - 'hasMoreEpics', - ]), - ...mapGetters(['getUnassignedIssues']), baseVariables() { return { fullPath: this.fullPath, @@ -114,25 +101,20 @@ export default { isProject: this.boardType === BoardType.project, }; }, - epicsToUse() { - return this.isApolloBoard ? this.rawEpics?.nodes || [] : this.epics; - }, - filtersToUse() { - return this.isApolloBoard ? this.filters : this.filterParams; + epics() { + return this.rawEpics?.nodes || []; }, pageInfo() { return this.rawEpics.pageInfo; }, hasMoreEpicsToLoad() { - return this.isApolloBoard ? this.pageInfo?.hasNextPage : this.hasMoreEpics; + return this.pageInfo?.hasNextPage; }, isLoadingMoreEpics() { - return this.isApolloBoard - ? this.isLoadingMore - : this.epicsSwimlanesFetchInProgress.epicLanesFetchMoreInProgress; + return this.isLoadingMore; }, canAdminEpic() { - return this.epicsToUse[0]?.userPermissions?.adminEpic; + return this.epics[0]?.userPermissions?.adminEpic; }, treeRootWrapper() { return this.canAdminList ? Draggable : DRAGGABLE_TAG; @@ -151,20 +133,10 @@ export default { return this.canAdminList ? options : {}; }, hasMoreUnassignedIssues() { - if (this.isApolloBoard) { - return this.lists.some((list) => this.hasMoreUnassignedIssuables[list.id]); - } - return this.lists.some((list) => this.pageInfoByListId[list.id]?.hasNextPage); + return this.lists.some((list) => this.hasMoreUnassignedIssuables[list.id]); }, isLoading() { - if (this.isApolloBoard) { - return this.$apollo.queries.rawEpics.loading && !this.isLoadingMoreEpics; - } - const { - epicLanesFetchInProgress, - listItemsFetchInProgress, - } = this.epicsSwimlanesFetchInProgress; - return epicLanesFetchInProgress || listItemsFetchInProgress; + return this.$apollo.queries.rawEpics.loading && !this.isLoadingMoreEpics; }, chevronTooltip() { return this.isUnassignedCollapsed ? __('Expand') : __('Collapse'); @@ -179,19 +151,6 @@ export default { return !this.isUnassignedCollapsed && this.hasMoreUnassignedIssues; }, }, - watch: { - filterParams: { - handler() { - if (!this.isApolloBoard) { - Promise.all(this.epics.map((epic) => this.fetchIssuesForEpic(epic.id))) - .then(() => this.doneLoadingSwimlanesItems()) - .catch(() => {}); - } - }, - deep: true, - immediate: true, - }, - }, mounted() { this.bufferSize = calculateSwimlanesBufferSize(this.$el.offsetTop); }, @@ -202,37 +161,19 @@ export default { eventHub.$off('open-unassigned-lane', this.openUnassignedLane); }, methods: { - ...mapActions([ - 'fetchEpicsSwimlanes', - 'fetchIssuesForEpic', - 'fetchItemsForList', - 'doneLoadingSwimlanesItems', - ]), async fetchMoreEpics() { - if (this.isApolloBoard) { - this.isLoadingMore = true; - await this.$apollo.queries.rawEpics.fetchMore({ - variables: { - ...this.baseVariables, - issueFilters: this.filtersToUse, - after: this.pageInfo.endCursor, - }, - }); - this.isLoadingMore = false; - } else { - this.fetchEpicsSwimlanes({ fetchNext: true }); - } + this.isLoadingMore = true; + await this.$apollo.queries.rawEpics.fetchMore({ + variables: { + ...this.baseVariables, + issueFilters: this.filters, + after: this.pageInfo.endCursor, + }, + }); + this.isLoadingMore = false; }, fetchMoreUnassignedIssues() { - if (this.isApolloBoard) { - this.isLoadingMoreIssues = true; - return; - } - this.lists.forEach((list) => { - if (this.pageInfoByListId[list.id]?.hasNextPage) { - this.fetchItemsForList({ listId: list.id, fetchNext: true, noEpicIssues: true }); - } - }); + this.isLoadingMoreIssues = true; }, isListDraggable(list) { return isListDraggable(list); @@ -246,14 +187,14 @@ export default { }, getEpicLaneProps(index) { return { - key: this.epicsToUse[index].id, + key: this.epics[index].id, props: { - epic: this.epicsToUse[index], + epic: this.epics[index], lists: this.lists, disabled: this.disabled, canAdminList: this.canAdminList, boardId: this.boardId, - filterParams: this.filtersToUse, + filterParams: this.filters, highlightedLists: this.highlightedLists, canAdminEpic: this.canAdminEpic, totalIssuesCountByListId: this.totalIssuesCountByListId, @@ -266,9 +207,6 @@ export default { openUnassignedLane() { this.isUnassignedCollapsed = false; }, - unassignedIssues(listId) { - return this.getUnassignedIssues(listId); - }, updatePageInfo(pageInfo, listId) { this.hasMoreUnassignedIssuables = { ...this.hasMoreUnassignedIssuables, @@ -312,7 +250,7 @@ export default { <board-list-header :can-admin-list="canAdminList" :list="list" - :filter-params="filtersToUse" + :filter-params="filters" :is-swimlanes-header="true" :board-id="boardId" @setActiveList="$emit('setActiveList', $event)" @@ -322,13 +260,13 @@ export default { </component> <div class="board-epics-swimlanes gl-display-table"> <virtual-list - v-if="epicsToUse.length" + v-if="epics.length" :size="$options.epicLaneBaseHeight" :remain="bufferSize" :bench="bufferSize" :scrollelement="$refs.scrollableContainer" :item="$options.EpicLane" - :itemcount="epicsToUse.length" + :itemcount="epics.length" :itemprops="getEpicLaneProps" /> <div v-if="hasMoreEpicsToLoad" class="swimlanes-button gl-pb-3 gl-pl-3 gl-sticky gl-left-0"> @@ -380,13 +318,12 @@ export default { v-for="list in lists" :key="`${list.id}-issues`" :list="list" - :issues="unassignedIssues(list.id)" :is-unassigned-issues-lane="true" :can-admin-list="canAdminList" :board-id="boardId" - :filter-params="filtersToUse" + :filter-params="filters" :is-loading-more-issues="isLoadingMoreIssues" - :highlighted-lists-apollo="highlightedLists" + :highlighted-lists="highlightedLists" :can-admin-epic="canAdminEpic" :lists="lists" :total-issues-count="totalIssuesCountByListId[list.id]" diff --git a/ee/app/assets/javascripts/boards/components/issues_lane_list.vue b/ee/app/assets/javascripts/boards/components/issues_lane_list.vue index 8575d1066a176fa5f181defd5e4a1e496ac10a12..7508497edadcfa7efabc6c82ea15bcf704df8761 100644 --- a/ee/app/assets/javascripts/boards/components/issues_lane_list.vue +++ b/ee/app/assets/javascripts/boards/components/issues_lane_list.vue @@ -1,8 +1,6 @@ <script> import { GlLoadingIcon } from '@gitlab/ui'; import Draggable from 'vuedraggable'; -// eslint-disable-next-line no-restricted-imports -import { mapState, mapActions } from 'vuex'; import { __, s__ } from '~/locale'; import BoardCard from '~/boards/components/board_card.vue'; import BoardNewIssue from '~/boards/components/board_new_issue.vue'; @@ -26,7 +24,7 @@ export default { BoardNewIssue, GlLoadingIcon, }, - inject: ['boardType', 'fullPath', 'isApolloBoard'], + inject: ['boardType', 'fullPath'], props: { list: { type: Object, @@ -74,7 +72,7 @@ export default { required: false, default: false, }, - highlightedListsApollo: { + highlightedLists: { type: Array, required: false, default: () => [], @@ -101,7 +99,7 @@ export default { }; }, skip() { - return !this.isApolloBoard || !this.isUnassignedIssuesLane; + return !this.isUnassignedIssuesLane; }, update(data) { return data[this.boardType]?.board.lists.nodes[0]; @@ -123,7 +121,6 @@ export default { }, }, computed: { - ...mapState(['listsFlags', 'highlightedLists']), baseVariables() { return { fullPath: this.fullPath, @@ -138,16 +135,12 @@ export default { }; }, issuesToUse() { - if (this.isUnassignedIssuesLane && this.isApolloBoard) { + if (this.isUnassignedIssuesLane) { return this.currentListWithUnassignedIssues?.issues.nodes || []; } return this.issues; }, - highlightedListsToUse() { - return this.isApolloBoard ? this.highlightedListsApollo : this.highlightedLists; - }, - treeRootWrapper() { return this.canAdminList && (this.canAdminEpic || this.isUnassignedIssuesLane) ? Draggable @@ -168,13 +161,8 @@ export default { return this.canAdminList ? options : {}; }, isLoading() { - if (this.isApolloBoard) { - return ( - this.$apollo.queries.currentListWithUnassignedIssues.loading && !this.isLoadingMoreIssues - ); - } return ( - this.listsFlags[this.list.id]?.isLoading || this.listsFlags[this.list.id]?.isLoadingMore + this.$apollo.queries.currentListWithUnassignedIssues.loading && !this.isLoadingMoreIssues ); }, pageInfo() { @@ -182,7 +170,7 @@ export default { }, highlighted() { - return this.highlightedListsToUse.includes(this.list.id); + return this.highlightedLists.includes(this.list.id); }, toList() { if (!this.toListId) { @@ -199,15 +187,6 @@ export default { }, }, watch: { - filterParams: { - handler() { - if (this.isUnassignedIssuesLane && !this.isApolloBoard) { - this.fetchItemsForList({ listId: this.list.id, noEpicIssues: true }); - } - }, - deep: true, - immediate: true, - }, highlighted: { handler(highlighted) { if (highlighted) { @@ -231,7 +210,6 @@ export default { eventHub.$off(`toggle-issue-form-${this.list.id}`, this.toggleForm); }, methods: { - ...mapActions(['moveIssue', 'fetchItemsForList']), toggleForm() { this.showIssueForm = !this.showIssueForm; if (this.showIssueForm && this.isUnassignedIssuesLane) { @@ -244,7 +222,7 @@ export default { handleDragOnEnd(params) { document.body.classList.remove('is-dragging'); const { newIndex, oldIndex, from, to, item } = params; - const { itemId, itemIid, itemPath } = item.dataset; + const { itemIid } = item.dataset; const { children } = to; let moveBeforeId; let moveAfterId; @@ -272,30 +250,17 @@ export default { } } - if (this.isApolloBoard) { - this.moveBoardItem( - { - iid: itemIid, - epicId: to.dataset.epicId, - fromListId: from.dataset.listId, - toListId: to.dataset.listId, - moveBeforeId, - moveAfterId, - }, - newIndex, - ); - } else { - this.moveIssue({ - itemId, - itemIid, - itemPath, + this.moveBoardItem( + { + iid: itemIid, + epicId: to.dataset.epicId, fromListId: from.dataset.listId, toListId: to.dataset.listId, moveBeforeId, moveAfterId, - epicId: from.dataset.epicId !== to.dataset.epicId ? to.dataset.epicId || null : undefined, - }); - } + }, + newIndex, + ); }, async fetchMoreIssues() { await this.$apollo.queries.currentListWithUnassignedIssues.fetchMore({ diff --git a/ee/app/assets/javascripts/boards/components/toggle_epics_swimlanes.vue b/ee/app/assets/javascripts/boards/components/toggle_epics_swimlanes.vue index dafe2fff9f7c8aefcecedf4f027c8f0402ad780e..b541c470d2b92a868405407bc6d58a76809183d7 100644 --- a/ee/app/assets/javascripts/boards/components/toggle_epics_swimlanes.vue +++ b/ee/app/assets/javascripts/boards/components/toggle_epics_swimlanes.vue @@ -1,6 +1,4 @@ <script> -// eslint-disable-next-line no-restricted-imports -import { mapActions } from 'vuex'; import { GlCollapsibleListbox } from '@gitlab/ui'; import { __ } from '~/locale'; import Tracking from '~/tracking'; @@ -30,7 +28,6 @@ export default { GlCollapsibleListbox, }, mixins: [trackingMixin], - inject: ['isApolloBoard'], props: { isSwimlanesOn: { type: Boolean, @@ -46,7 +43,6 @@ export default { }, }, methods: { - ...mapActions(['fetchEpicsSwimlanes', 'fetchLists']), toggleEpicSwimlanes() { if (this.isSwimlanesOn) { historyPushState(removeParams(['group_by']), window.location.href, true); @@ -58,10 +54,6 @@ export default { }), ); this.$emit('toggleSwimlanes', true); - if (!this.isApolloBoard) { - this.fetchEpicsSwimlanes(); - this.fetchLists(); - } } }, onToggle() { diff --git a/ee/app/assets/javascripts/epic_boards/index.js b/ee/app/assets/javascripts/epic_boards/index.js index 481b55616c3081c167b807c984ea6740edd0ad8d..af36c2c31ca499ddc1ceb6c87532c66cc69c58d1 100644 --- a/ee/app/assets/javascripts/epic_boards/index.js +++ b/ee/app/assets/javascripts/epic_boards/index.js @@ -25,7 +25,6 @@ const apolloProvider = new VueApollo({ function mountBoardApp(el) { const { boardId, groupId, fullPath, rootPath } = el.dataset; - const isApolloBoard = window.gon?.features?.apolloBoards; const rawFilterParams = queryToObject(window.location.search, { gatherArrays: true }); @@ -35,23 +34,6 @@ function mountBoardApp(el) { const boardType = el.dataset.parent; - if (!isApolloBoard) { - store.dispatch('fetchEpicBoard', { - fullPath, - boardId: fullEpicBoardId(boardId), - }); - - store.dispatch('setInitialBoardData', { - allowSubEpics: parseBoolean(el.dataset.subEpicsFeatureAvailable), - boardType, - disabled: parseBoolean(el.dataset.disabled) || true, - issuableType: TYPE_EPIC, - boardId, - fullBoardId: fullEpicBoardId(boardId), - fullPath, - }); - } - // eslint-disable-next-line no-new new Vue({ el, @@ -59,7 +41,6 @@ function mountBoardApp(el) { store, apolloProvider, provide: { - isApolloBoard, initialBoardId: fullEpicBoardId(boardId), disabled: parseBoolean(el.dataset.disabled), boardId, diff --git a/ee/spec/frontend/boards/board_card_inner_spec.js b/ee/spec/frontend/boards/board_card_inner_spec.js index ae35b890789ed77bbc8381a09fdd83b01a8f3dbd..c40bf0555da492ba28a2c039404f8150dcf5d61c 100644 --- a/ee/spec/frontend/boards/board_card_inner_spec.js +++ b/ee/spec/frontend/boards/board_card_inner_spec.js @@ -52,7 +52,6 @@ describe('Board card component', () => { allowSubEpics: isEpicBoard, issuableType: TYPE_ISSUE, isGroupBoard: true, - isApolloBoard: false, }, }); }; diff --git a/ee/spec/frontend/boards/board_list_helper.js b/ee/spec/frontend/boards/board_list_helper.js index 5d8c70d72261746c4c98c9dd3d40121fff8a095f..0dbad56fc5ef91718eaabd88bb5b040981841731 100644 --- a/ee/spec/frontend/boards/board_list_helper.js +++ b/ee/spec/frontend/boards/board_list_helper.js @@ -134,7 +134,6 @@ export default function createComponent({ disabled: false, boardType: 'group', issuableType: 'issue', - isApolloBoard: true, ...provide, }, stubs, diff --git a/ee/spec/frontend/boards/components/board_add_new_column_spec.js b/ee/spec/frontend/boards/components/board_add_new_column_spec.js index 7d2363e116bec641b3d0ae73acfb76e2be2405a8..b76d9abb57b15bc2f37853ac2a38643e41d6bc9f 100644 --- a/ee/spec/frontend/boards/components/board_add_new_column_spec.js +++ b/ee/spec/frontend/boards/components/board_add_new_column_spec.js @@ -168,7 +168,7 @@ describe('BoardAddNewColumn', () => { describe('List types', () => { describe('assignee list', () => { beforeEach(async () => { - mountComponent({ provide: { isApolloBoard: true } }); + mountComponent(); listTypeSelect(ListType.assignee); await nextTick(); @@ -196,7 +196,7 @@ describe('BoardAddNewColumn', () => { describe('iteration list', () => { beforeEach(async () => { - mountComponent({ provide: { isApolloBoard: true } }); + mountComponent(); await selectIteration(); }); @@ -219,7 +219,6 @@ describe('BoardAddNewColumn', () => { describe('when fetch milestones query fails', () => { beforeEach(async () => { mountComponent({ - provide: { isApolloBoard: true }, milestonesHandler: milestonesQueryHandlerFailure, }); listTypeSelect(ListType.milestone); @@ -238,7 +237,6 @@ describe('BoardAddNewColumn', () => { describe('when fetch assignees query fails', () => { beforeEach(async () => { mountComponent({ - provide: { isApolloBoard: true }, assigneesHandler: assigneesQueryHandlerFailure, }); listTypeSelect(ListType.assignee); @@ -257,7 +255,6 @@ describe('BoardAddNewColumn', () => { describe('when fetch iterations query fails', () => { beforeEach(async () => { mountComponent({ - provide: { isApolloBoard: true }, iterationHandler: iterationsQueryHandlerFailure, }); await selectIteration(); diff --git a/ee/spec/frontend/boards/components/board_app_spec.js b/ee/spec/frontend/boards/components/board_app_spec.js index 83767c16f943b2303297b316ca37e887f1576f27..cd2289772797d44aa13431d697cb284bc98a80c6 100644 --- a/ee/spec/frontend/boards/components/board_app_spec.js +++ b/ee/spec/frontend/boards/components/board_app_spec.js @@ -38,7 +38,6 @@ describe('BoardApp', () => { boardType: 'group', isIssueBoard: true, isGroupBoard: true, - isApolloBoard: true, ...provide, }, }); @@ -52,7 +51,7 @@ describe('BoardApp', () => { 'fetches $issuableType lists', ({ issuableType, isIssueBoard, isEpicBoard, queryHandler, notCalledHandler }) => { createComponent({ - provide: { isApolloBoard: true, issuableType, isEpicBoard, isIssueBoard }, + provide: { issuableType, isEpicBoard, isIssueBoard }, }); expect(queryHandler).toHaveBeenCalled(); diff --git a/ee/spec/frontend/boards/components/board_content_spec.js b/ee/spec/frontend/boards/components/board_content_spec.js index 83c40f1c8df97b4dbeca26e4f16748b405d9e384..9f5e4bbc6b84aaeaec78060906b39475a46e84d2 100644 --- a/ee/spec/frontend/boards/components/board_content_spec.js +++ b/ee/spec/frontend/boards/components/board_content_spec.js @@ -25,7 +25,6 @@ describe('ee/BoardContent', () => { isEpicBoard, isGroupBoard: true, disabled: false, - isApolloBoard: true, }, propsData: { boardLists: {}, diff --git a/ee/spec/frontend/boards/components/board_filtered_search_spec.js b/ee/spec/frontend/boards/components/board_filtered_search_spec.js index b6536a55c43f832c83b22eb51edcfb12408aa755..2bc1118397d73938fd1c8a436a0eb9897d364d6f 100644 --- a/ee/spec/frontend/boards/components/board_filtered_search_spec.js +++ b/ee/spec/frontend/boards/components/board_filtered_search_spec.js @@ -20,7 +20,6 @@ describe('ee/BoardFilteredSearch', () => { }, provide: { boardBaseUrl: 'root', - isApolloBoard: false, initialFilterParams: [], ...provide, }, diff --git a/ee/spec/frontend/boards/components/board_list_spec.js b/ee/spec/frontend/boards/components/board_list_spec.js index c50897a171b3a5fde6388cfcbc5b3eade8263b61..99216a5168963a93cd78fdeccf0bc71f17a8aeab 100644 --- a/ee/spec/frontend/boards/components/board_list_spec.js +++ b/ee/spec/frontend/boards/components/board_list_spec.js @@ -186,7 +186,6 @@ describe('BoardList Component', () => { isProjectBoard: boardType === WORKSPACE_PROJECT, isGroupBoard: boardType === WORKSPACE_GROUP, isEpicBoard, - isApolloBoard: true, }, apolloQueryHandlers: [ [listIssuesQuery, queryHandler], @@ -222,7 +221,6 @@ describe('BoardList Component', () => { isProjectBoard: boardType === WORKSPACE_PROJECT, isGroupBoard: boardType === WORKSPACE_GROUP, isEpicBoard, - isApolloBoard: true, }, apolloQueryHandlers: [ [listIssuesQuery, queryHandlerFailure], @@ -250,7 +248,6 @@ describe('BoardList Component', () => { isProjectBoard: false, isGroupBoard: true, isEpicBoard, - isApolloBoard: true, glFeatures: { epicColorHighlight: false }, }, apolloQueryHandlers, @@ -295,7 +292,6 @@ describe('BoardList Component', () => { isProjectBoard: false, isGroupBoard: true, isEpicBoard, - isApolloBoard: true, glFeatures: { epicColorHighlight: false }, }, apolloQueryHandlers: [ @@ -330,7 +326,6 @@ describe('BoardList Component', () => { isProjectBoard: false, isGroupBoard: true, isEpicBoard, - isApolloBoard: true, glFeatures: { epicColorHighlight: false }, }, apolloQueryHandlers, @@ -361,7 +356,6 @@ describe('BoardList Component', () => { isProjectBoard: false, isGroupBoard: true, isEpicBoard, - isApolloBoard: true, glFeatures: { epicColorHighlight: false }, }, apolloQueryHandlers: [ @@ -407,7 +401,6 @@ describe('BoardList Component', () => { isProjectBoard: false, isGroupBoard: true, isEpicBoard, - isApolloBoard: true, glFeatures: { epicColorHighlight: false }, }, apolloQueryHandlers, @@ -448,7 +441,6 @@ describe('BoardList Component', () => { isProjectBoard: false, isGroupBoard: true, isEpicBoard, - isApolloBoard: true, glFeatures: { epicColorHighlight: false }, }, apolloQueryHandlers: [ diff --git a/ee/spec/frontend/boards/components/board_new_epic_spec.js b/ee/spec/frontend/boards/components/board_new_epic_spec.js index a5e4a8aa76358a9f90c83dd7a4ebe4a554bcbdc8..73584fb9f04008d540ca81e13244c42761833a44 100644 --- a/ee/spec/frontend/boards/components/board_new_epic_spec.js +++ b/ee/spec/frontend/boards/components/board_new_epic_spec.js @@ -1,7 +1,5 @@ import { shallowMount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; -// eslint-disable-next-line no-restricted-imports -import Vuex from 'vuex'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -16,21 +14,14 @@ import eventHub from '~/boards/eventhub'; import { mockEpicBoardResponse } from '../mock_data'; -Vue.use(Vuex); Vue.use(VueApollo); -const addListNewEpicSpy = jest.fn().mockResolvedValue(); -const mockActions = { addListNewEpic: addListNewEpicSpy }; - const epicBoardQueryHandlerSuccess = jest.fn().mockResolvedValue(mockEpicBoardResponse); const mockApollo = createMockApollo([[epicBoardQuery, epicBoardQueryHandlerSuccess]]); -const createComponent = ({ actions = mockActions, isApolloBoard = false } = {}) => +const createComponent = () => shallowMount(BoardNewEpic, { apolloProvider: mockApollo, - store: new Vuex.Store({ - actions, - }), propsData: { list: mockList, boardId: 'gid://gitlab/Board::EpicBoard/1', @@ -38,7 +29,6 @@ const createComponent = ({ actions = mockActions, isApolloBoard = false } = {}) provide: { boardType: 'group', fullPath: 'gitlab-org', - isApolloBoard, }, stubs: { BoardNewItem, @@ -63,6 +53,14 @@ describe('Epic boards new epic form', () => { await nextTick(); }); + it('fetches board when creating epic and emits addNewEpic event', async () => { + await submitForm(wrapper); + await waitForPromises(); + + expect(epicBoardQueryHandlerSuccess).toHaveBeenCalled(); + expect(wrapper.emitted('addNewEpic')[0][0]).toMatchObject({ title: 'Foo' }); + }); + it('renders board-new-item component', () => { const boardNewItem = findBoardNewItem(); expect(boardNewItem.exists()).toBe(true); @@ -81,19 +79,6 @@ describe('Epic boards new epic form', () => { expect(groupSelect.exists()).toBe(true); }); - it('calls action `addListNewEpic` when "Create epic" button is clicked', async () => { - await submitForm(wrapper); - - expect(addListNewEpicSpy).toHaveBeenCalledWith(expect.any(Object), { - list: expect.any(Object), - epicInput: { - title: 'Foo', - labelIds: [], - groupPath: 'gitlab-org', - }, - }); - }); - it('emits event `toggle-epic-form` with current list Id suffix on eventHub when `board-new-item` emits form-cancel event', async () => { jest.spyOn(eventHub, '$emit').mockImplementation(); findBoardNewItem().vm.$emit('form-cancel'); @@ -101,20 +86,4 @@ describe('Epic boards new epic form', () => { await nextTick(); expect(eventHub.$emit).toHaveBeenCalledWith(`toggle-epic-form-${mockList.id}`); }); - - describe('Apollo boards', () => { - beforeEach(async () => { - wrapper = createComponent({ isApolloBoard: true }); - - await nextTick(); - }); - - it('fetches board when creating epic and emits addNewEpic event', async () => { - await submitForm(wrapper); - await waitForPromises(); - - expect(epicBoardQueryHandlerSuccess).toHaveBeenCalled(); - expect(wrapper.emitted('addNewEpic')[0][0]).toMatchObject({ title: 'Foo' }); - }); - }); }); diff --git a/ee/spec/frontend/boards/components/board_settings_sidebar_spec.js b/ee/spec/frontend/boards/components/board_settings_sidebar_spec.js index 374d2838f5d30a84e37ede7b8852fb22cb76df69..f79976419bd3a2dbf3e29c8df00029521be163de 100644 --- a/ee/spec/frontend/boards/components/board_settings_sidebar_spec.js +++ b/ee/spec/frontend/boards/components/board_settings_sidebar_spec.js @@ -19,7 +19,6 @@ describe('ee/BoardSettingsSidebar', () => { isIssueBoard: true, boardType: 'group', issuableType: 'issue', - isApolloBoard: true, ...provide, }, propsData: { diff --git a/ee/spec/frontend/boards/components/board_settings_wip_limit_spec.js b/ee/spec/frontend/boards/components/board_settings_wip_limit_spec.js index 727610d939e518638cecdbd3795634a4e2f10f5f..1f41fe5ab8400b398392513b9136b56f00f2da42 100644 --- a/ee/spec/frontend/boards/components/board_settings_wip_limit_spec.js +++ b/ee/spec/frontend/boards/components/board_settings_wip_limit_spec.js @@ -1,9 +1,6 @@ import { GlFormInput } from '@gitlab/ui'; -import { noop } from 'lodash'; import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; -// eslint-disable-next-line no-restricted-imports -import Vuex from 'vuex'; import BoardSettingsWipLimit from 'ee_component/boards/components/board_settings_wip_limit.vue'; import listUpdateLimitMetricsMutation from 'ee_component/boards/graphql/list_update_limit_metrics.mutation.graphql'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -14,12 +11,10 @@ import * as cacheUpdates from '~/boards/graphql/cache_updates'; import { mockUpdateListWipLimitResponse } from '../mock_data'; Vue.use(VueApollo); -Vue.use(Vuex); describe('BoardSettingsWipLimit', () => { let wrapper; let mockApollo; - let storeActions; const listId = mockLabelList.id; const currentWipLimit = 1; // Needs to be other than null to trigger requests @@ -36,8 +31,6 @@ describe('BoardSettingsWipLimit', () => { .mockRejectedValue(new Error(errorMessage)); const createComponent = ({ - vuexState = { activeId: listId }, - actions = {}, localState = {}, props = { maxIssueCount: 0 }, injectedProps = {}, @@ -46,24 +39,14 @@ describe('BoardSettingsWipLimit', () => { mockApollo = createMockApollo([ [listUpdateLimitMetricsMutation, listUpdateWipLimitMutationHandler], ]); - storeActions = actions; - - const store = new Vuex.Store({ - state: vuexState, - actions: storeActions, - }); wrapper = shallowMountExtended(BoardSettingsWipLimit, { apolloProvider: mockApollo, - provide: { - isApolloBoard: false, - ...injectedProps, - }, + provide: injectedProps, propsData: { activeListId: listId, ...props, }, - store, data() { return localState; }, @@ -95,9 +78,7 @@ describe('BoardSettingsWipLimit', () => { describe('when activeListWipLimit is 0', () => { it('renders "None" in the block', () => { createComponent({ - vuexState: { - activeId: listId, - }, + props: { maxIssueCount: 0 }, }); expect(findWipLimit().text()).toBe('None'); @@ -111,9 +92,6 @@ describe('BoardSettingsWipLimit', () => { ${11} | ${'11 issues'} `('renders $num', ({ num, expected }) => { createComponent({ - vuexState: { - activeId: listId, - }, props: { maxIssueCount: num }, }); @@ -126,10 +104,6 @@ describe('BoardSettingsWipLimit', () => { const maxIssueCount = 4; beforeEach(async () => { createComponent({ - vuexState: { - activeId: listId, - }, - actions: { updateListWipLimit: noop }, props: { maxIssueCount }, }); @@ -151,15 +125,8 @@ describe('BoardSettingsWipLimit', () => { describe('remove limit', () => { describe('when wipLimit is set', () => { - const spy = jest.fn().mockResolvedValue({ - data: { boardListUpdateLimitMetrics: { list: { maxIssueCount: 0 } } }, - }); beforeEach(() => { createComponent({ - vuexState: { - activeId: listId, - }, - actions: { updateListWipLimit: spy }, props: { maxIssueCount: 4 }, }); }); @@ -171,18 +138,16 @@ describe('BoardSettingsWipLimit', () => { await waitForPromises(); await nextTick(); - expect(spy).toHaveBeenCalledWith( - expect.anything(), - expect.objectContaining({ listId, maxIssueCount: 0 }), - ); + expect(listUpdateLimitMetricsMutationHandler).toHaveBeenCalledWith({ + input: { listId, maxIssueCount: 0 }, + }); }); }); describe('when wipLimit is not set', () => { beforeEach(() => { createComponent({ - vuexState: { activeId: listId }, - actions: { updateListWipLimit: noop }, + props: { maxIssueCount: 0 }, }); }); @@ -199,53 +164,40 @@ describe('BoardSettingsWipLimit', () => { ${'blur'} `('$blurMethod', ({ blurMethod }) => { describe(`when blur is triggered by ${blurMethod}`, () => { - it('calls updateListWipLimit', async () => { - const spy = jest.fn().mockResolvedValue({ - data: { boardListUpdateLimitMetrics: { list: { maxIssueCount: 4 } } }, - }); + it('calls listUpdateLimitMetricsMutation', async () => { createComponent({ - vuexState: { - activeId: listId, - }, - actions: { updateListWipLimit: spy }, localState: { edit: true, currentWipLimit }, }); await triggerBlur(blurMethod); - expect(spy).toHaveBeenCalledTimes(1); + expect(listUpdateLimitMetricsMutationHandler).toHaveBeenCalledWith({ + input: { listId, maxIssueCount: currentWipLimit }, + }); }); describe('when component wipLimit and List.maxIssueCount are equal', () => { - it('does not call updateListWipLimit', async () => { - const spy = jest.fn().mockResolvedValue({}); + it('does not call listUpdateLimitMetricsMutation', async () => { createComponent({ - vuexState: { - activeId: listId, - }, - actions: { updateListWipLimit: spy }, localState: { edit: true, currentWipLimit: 2 }, props: { maxIssueCount: 2 }, }); await triggerBlur(blurMethod); - expect(spy).toHaveBeenCalledTimes(0); + expect(listUpdateLimitMetricsMutationHandler).toHaveBeenCalledTimes(0); }); }); describe('when currentWipLimit is null', () => { - it('does not call updateListWipLimit', async () => { - const spy = jest.fn().mockResolvedValue({}); + it('does not call listUpdateLimitMetricsMutation', async () => { createComponent({ - vuexState: { activeId: listId }, - actions: { updateListWipLimit: spy }, localState: { edit: true, currentWipLimit: null }, }); await triggerBlur(blurMethod); - expect(spy).toHaveBeenCalledTimes(0); + expect(listUpdateLimitMetricsMutationHandler).toHaveBeenCalledTimes(0); }); }); @@ -253,12 +205,7 @@ describe('BoardSettingsWipLimit', () => { const maxIssueCount = 11; beforeEach(async () => { - const spy = jest.fn().mockResolvedValue({}); createComponent({ - vuexState: { - activeId: listId, - }, - actions: { updateListWipLimit: spy }, localState: { edit: true, currentWipLimit: maxIssueCount }, props: { maxIssueCount }, }); @@ -277,26 +224,17 @@ describe('BoardSettingsWipLimit', () => { }); describe('when response fails', () => { - let setErrorMock; - beforeEach(async () => { - setErrorMock = jest.fn(); - createComponent({ - vuexState: { activeId: listId }, - actions: { - updateListWipLimit: jest.fn().mockRejectedValue(), - setError: setErrorMock, - unsetActiveId: noop, - }, localState: { edit: true, currentWipLimit }, + listUpdateWipLimitMutationHandler: listUpdateLimitMetricsMutationHandlerFailure, }); await triggerBlur(blurMethod); }); - it('calls flash with expected error', () => { - expect(setErrorMock).toHaveBeenCalledTimes(1); + it('sets error', () => { + expect(cacheUpdates.setError).toHaveBeenCalled(); }); }); }); @@ -305,8 +243,6 @@ describe('BoardSettingsWipLimit', () => { describe('passing of props to gl-form-input', () => { beforeEach(() => { createComponent({ - vuexState: { activeId: listId }, - actions: { updateListWipLimit: noop }, localState: { edit: true }, }); }); @@ -320,59 +256,4 @@ describe('BoardSettingsWipLimit', () => { }); }); }); - - describe('Apollo boards', () => { - it('adds limit', async () => { - createComponent({ - injectedProps: { - isApolloBoard: true, - }, - }); - - expect(findWipLimit().text()).toContain('None'); - - await clickEdit(); - findInput().vm.$emit('input', 11); - await triggerBlur('blur'); - - expect(listUpdateLimitMetricsMutationHandler).toHaveBeenCalledWith({ - input: { listId, maxIssueCount: 11 }, - }); - }); - - it('removes limit', async () => { - createComponent({ - props: { maxIssueCount: 11 }, - injectedProps: { - isApolloBoard: true, - }, - }); - - expect(findWipLimit().text()).toContain('11'); - - findRemoveWipLimit().vm.$emit('click'); - await waitForPromises(); - - expect(listUpdateLimitMetricsMutationHandler).toHaveBeenCalledWith({ - input: { listId, maxIssueCount: 0 }, - }); - }); - - it('sets error when list update fails', async () => { - createComponent({ - props: { maxIssueCount: 11 }, - injectedProps: { - isApolloBoard: true, - }, - listUpdateWipLimitMutationHandler: listUpdateLimitMetricsMutationHandlerFailure, - }); - - expect(findWipLimit().text()).toContain('11'); - - findRemoveWipLimit().vm.$emit('click'); - await waitForPromises(); - - expect(cacheUpdates.setError).toHaveBeenCalled(); - }); - }); }); diff --git a/ee/spec/frontend/boards/components/board_top_bar_spec.js b/ee/spec/frontend/boards/components/board_top_bar_spec.js index 290299a5e10f9f4098f3450d4a2f28e76bf17a8d..c15b0e9f081031e545f54624d88e41aa097d3de0 100644 --- a/ee/spec/frontend/boards/components/board_top_bar_spec.js +++ b/ee/spec/frontend/boards/components/board_top_bar_spec.js @@ -58,7 +58,6 @@ describe('BoardTopBar', () => { isIssueBoard: true, isEpicBoard: false, isGroupBoard: true, - isApolloBoard: true, ...provide, }, stubs: { IssueBoardFilteredSearch, EpicBoardFilteredSearch, ToggleLabels }, diff --git a/ee/spec/frontend/boards/components/boards_selector_spec.js b/ee/spec/frontend/boards/components/boards_selector_spec.js index bc740dd48cd863c05dd8a547dd2ca9e8e908c44a..d9a80616d010b7fb8f0ab34369f8693273c8ab94 100644 --- a/ee/spec/frontend/boards/components/boards_selector_spec.js +++ b/ee/spec/frontend/boards/components/boards_selector_spec.js @@ -82,7 +82,6 @@ describe('BoardsSelector', () => { boardType: isGroupBoard ? WORKSPACE_GROUP : WORKSPACE_PROJECT, isGroupBoard, isProjectBoard, - isApolloBoard: false, }, }); }; diff --git a/ee/spec/frontend/boards/components/epic_lane_spec.js b/ee/spec/frontend/boards/components/epic_lane_spec.js index a117bb09ebdb6779c12eed6c7b43dfe2132f34ed..eafc6446e90112db3579a325b6fe76489a9b1357 100644 --- a/ee/spec/frontend/boards/components/epic_lane_spec.js +++ b/ee/spec/frontend/boards/components/epic_lane_spec.js @@ -1,59 +1,27 @@ import { GlButton, GlIcon, GlLoadingIcon } from '@gitlab/ui'; import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; -// eslint-disable-next-line no-restricted-imports -import Vuex from 'vuex'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql'; import * as cacheUpdates from '~/boards/graphql/cache_updates'; import EpicLane from 'ee/boards/components/epic_lane.vue'; import IssuesLaneList from 'ee/boards/components/issues_lane_list.vue'; -import getters from 'ee/boards/stores/getters'; import updateBoardEpicUserPreferencesMutation from 'ee/boards/graphql/update_board_epic_user_preferences.mutation.graphql'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import { - mockEpic, - mockLists, - mockIssuesByListId, - issues, - mockGroupIssuesResponse, -} from '../mock_data'; +import { mockEpic, mockLists, mockGroupIssuesResponse } from '../mock_data'; Vue.use(VueApollo); -Vue.use(Vuex); describe('EpicLane', () => { let wrapper; let mockApollo; - const updateBoardEpicUserPreferencesSpy = jest.fn(); - const fetchIssuesForEpicSpy = jest.fn(); - const findChevronButton = () => wrapper.findComponent(GlButton); const findIssuesLaneLists = () => wrapper.findAllComponents(IssuesLaneList); const findEpicLane = () => wrapper.findByTestId('board-epic-lane'); const findEpicLaneIssueCount = () => wrapper.findByTestId('epic-lane-issue-count'); - const createStore = ({ boardItemsByListId = mockIssuesByListId, isLoading = false }) => { - return new Vuex.Store({ - actions: { - updateBoardEpicUserPreferences: updateBoardEpicUserPreferencesSpy, - fetchIssuesForEpic: fetchIssuesForEpicSpy, - }, - state: { - boardItemsByListId, - boardItems: issues, - epicsFlags: { - [mockEpic.id]: { - isLoading, - }, - }, - }, - getters, - }); - }; - const listIssuesQueryHandlerSuccess = jest.fn().mockResolvedValue(mockGroupIssuesResponse()); const errorMessage = 'Failed to fetch issues'; const listIssuesQueryHandlerFailure = jest.fn().mockRejectedValue(new Error(errorMessage)); @@ -61,12 +29,8 @@ describe('EpicLane', () => { const createComponent = ({ props = {}, - boardItemsByListId = mockIssuesByListId, listIssuesQueryHandler = listIssuesQueryHandlerSuccess, - isLoading = false, - isApolloBoard = false, } = {}) => { - const store = createStore({ boardItemsByListId, isLoading }); mockApollo = createMockApollo([ [listsIssuesQuery, listIssuesQueryHandler], [updateBoardEpicUserPreferencesMutation, updateEpicPreferencesMutationHandler], @@ -86,11 +50,9 @@ describe('EpicLane', () => { ...props, }, apolloProvider: mockApollo, - store, provide: { fullPath: 'gitlab-org', boardType: 'group', - isApolloBoard, }, }); }; @@ -99,23 +61,14 @@ describe('EpicLane', () => { cacheUpdates.setError = jest.fn(); }); - describe('mounted', () => { - beforeEach(() => { - createComponent(); - }); - - it('calls fetchIssuesForEpic action on mount', () => { - expect(fetchIssuesForEpicSpy).toHaveBeenCalledWith(expect.any(Object), mockEpic.id); - }); - }); - describe('template', () => { - beforeEach(() => { + beforeEach(async () => { createComponent(); + await waitForPromises(); }); it('displays count of issues in epic which belong to board', () => { - expect(findEpicLaneIssueCount().text()).toContain('2'); + expect(findEpicLaneIssueCount().text()).toContain('1'); }); it('displays 1 icon', () => { @@ -152,36 +105,43 @@ describe('EpicLane', () => { expect(findEpicLaneIssueCount().exists()).toBe(false); }); - it('invokes `updateBoardEpicUserPreferences` method on collapse', async () => { + it('updates epic user preferences on collapse', async () => { + createComponent(); + + await waitForPromises(); + const collapsedValue = false; - expect(wrapper.vm.isCollapsed).toBe(collapsedValue); expect(findEpicLane().classes()).toContain('board-epic-lane-shadow'); + expect(findIssuesLaneLists()).toHaveLength(wrapper.props('lists').length); findChevronButton().vm.$emit('click'); - await nextTick(); - expect(updateBoardEpicUserPreferencesSpy).toHaveBeenCalled(); - - const payload = updateBoardEpicUserPreferencesSpy.mock.calls[0][1]; - - expect(payload).toEqual({ + await waitForPromises(); + expect(updateEpicPreferencesMutationHandler).toHaveBeenCalledWith({ + boardId: 'gid://gitlab/Board/1', collapsed: !collapsedValue, epicId: mockEpic.id, }); - expect(wrapper.vm.isCollapsed).toBe(true); + expect(findEpicLane().classes()).not.toContain('board-epic-lane-shadow'); + expect(findIssuesLaneLists()).toHaveLength(0); }); - it('does not render when issuesCount is 0', () => { - createComponent({ boardItemsByListId: {} }); + it('does not render when issuesCount is 0', async () => { + createComponent({ + listIssuesQueryHandler: jest + .fn() + .mockResolvedValue(mockGroupIssuesResponse('gid://gitlab/List/1', [])), + }); + await waitForPromises(); expect(findEpicLane().exists()).toBe(false); }); }); - describe('Apollo boards', () => { + describe('queries', () => { it('fetches list issues', async () => { - createComponent({ isApolloBoard: true }); + createComponent(); await nextTick(); expect(listIssuesQueryHandlerSuccess).toHaveBeenCalled(); @@ -190,36 +150,10 @@ describe('EpicLane', () => { it('sets error when list issues query fails', async () => { createComponent({ listIssuesQueryHandler: listIssuesQueryHandlerFailure, - isApolloBoard: true, }); await waitForPromises(); expect(cacheUpdates.setError).toHaveBeenCalled(); }); - - it('updates epic user preferences on collapse', async () => { - createComponent({ - isApolloBoard: true, - }); - - await waitForPromises(); - - const collapsedValue = false; - - expect(findEpicLane().classes()).toContain('board-epic-lane-shadow'); - expect(findIssuesLaneLists()).toHaveLength(wrapper.props('lists').length); - - findChevronButton().vm.$emit('click'); - - await waitForPromises(); - expect(updateEpicPreferencesMutationHandler).toHaveBeenCalledWith({ - boardId: 'gid://gitlab/Board/1', - collapsed: !collapsedValue, - epicId: mockEpic.id, - }); - - expect(findEpicLane().classes()).not.toContain('board-epic-lane-shadow'); - expect(findIssuesLaneLists()).toHaveLength(0); - }); }); }); diff --git a/ee/spec/frontend/boards/components/epics_swimlanes_spec.js b/ee/spec/frontend/boards/components/epics_swimlanes_spec.js index aac47833e15ae354533458bea32dbcdf131ea0b7..4ab81e6c77394246e884684b08fce2fc79e03823 100644 --- a/ee/spec/frontend/boards/components/epics_swimlanes_spec.js +++ b/ee/spec/frontend/boards/components/epics_swimlanes_spec.js @@ -2,8 +2,6 @@ import Vue, { nextTick } from 'vue'; import VirtualList from 'vue-virtual-scroll-list'; import Draggable from 'vuedraggable'; import VueApollo from 'vue-apollo'; -// eslint-disable-next-line no-restricted-imports -import Vuex from 'vuex'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import * as BoardUtils from 'ee/boards/boards_util'; @@ -12,21 +10,13 @@ import EpicsSwimlanes from 'ee/boards/components/epics_swimlanes.vue'; import IssueLaneList from 'ee/boards/components/issues_lane_list.vue'; import SwimlanesLoadingSkeleton from 'ee/boards/components/swimlanes_loading_skeleton.vue'; import { EPIC_LANE_BASE_HEIGHT } from 'ee/boards/constants'; -import getters from 'ee/boards/stores/getters'; import epicsSwimlanesQuery from 'ee/boards/graphql/epics_swimlanes.query.graphql'; import BoardListHeader from 'ee_else_ce/boards/components/board_list_header.vue'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import * as cacheUpdates from '~/boards/graphql/cache_updates'; -import { - mockLists, - mockEpics, - mockIssuesByListId, - issues, - mockEpicSwimlanesResponse, -} from '../mock_data'; +import { mockLists, mockEpics, mockEpic, mockEpicSwimlanesResponse } from '../mock_data'; Vue.use(VueApollo); -Vue.use(Vuex); jest.mock('ee/boards/boards_util'); describe('EpicsSwimlanes', () => { @@ -40,57 +30,33 @@ describe('EpicsSwimlanes', () => { const findLaneUnassignedIssues = () => wrapper.findByTestId('board-lane-unassigned-issues-title'); const findToggleUnassignedLaneButton = () => wrapper.findByTestId('unassigned-lane-toggle'); const findLoadMoreIssuesButton = () => wrapper.findByTestId('board-lane-load-more-issues-button'); + const findLoadingSkeleton = () => wrapper.findComponent(SwimlanesLoadingSkeleton); - const fetchItemsForListSpy = jest.fn(); - const fetchIssuesForEpicSpy = jest.fn(); - const fetchEpicsSwimlanesSpy = jest.fn(); - - const createStore = ({ - epicLanesFetchInProgress = false, - listItemsFetchInProgress = false, - epicLanesFetchMoreInProgress = false, - hasMoreEpics = false, - } = {}) => { - return new Vuex.Store({ - state: { - epics: mockEpics, - boardItemsByListId: mockIssuesByListId, - boardItems: issues, - pageInfoByListId: { - 'gid://gitlab/List/1': {}, - 'gid://gitlab/List/2': {}, - }, - epicsSwimlanesFetchInProgress: { - epicLanesFetchInProgress, - listItemsFetchInProgress, - epicLanesFetchMoreInProgress, - }, - hasMoreEpics, - filterParams: {}, - }, - getters, - actions: { - fetchItemsForList: fetchItemsForListSpy, - fetchIssuesForEpic: fetchIssuesForEpicSpy, - fetchEpicsSwimlanes: fetchEpicsSwimlanesSpy, - }, - }); - }; - - const epicsSwimlanesQueryHandlerSuccess = jest.fn().mockResolvedValue(mockEpicSwimlanesResponse); + const epicsSwimlanesQueryHandlerSuccess = jest + .fn() + .mockResolvedValue(mockEpicSwimlanesResponse()); const errorMessage = 'Failed to fetch issues'; const epicsSwimlanesQueryHandlerFailure = jest.fn().mockRejectedValue(new Error(errorMessage)); const createComponent = ({ canAdminList = false, - epicLanesFetchInProgress = false, - listItemsFetchInProgress = false, - hasMoreEpics = false, epicsSwimlanesQueryHandler = epicsSwimlanesQueryHandlerSuccess, - isApolloBoard = false, } = {}) => { - const store = createStore({ epicLanesFetchInProgress, listItemsFetchInProgress, hasMoreEpics }); - mockApollo = createMockApollo([[epicsSwimlanesQuery, epicsSwimlanesQueryHandler]]); + mockApollo = createMockApollo( + [[epicsSwimlanesQuery, epicsSwimlanesQueryHandler]], + {}, + { + typePolicies: { + Group: { + fields: { + board: { + merge: true, + }, + }, + }, + }, + }, + ); const defaultProps = { lists: mockLists, boardId: 'gid://gitlab/Board/1', @@ -99,12 +65,10 @@ describe('EpicsSwimlanes', () => { wrapper = shallowMountExtended(EpicsSwimlanes, { propsData: { ...defaultProps, canAdminList, filters: {} }, apolloProvider: mockApollo, - store, provide: { fullPath: 'gitlab-org', boardType: 'group', disabled: false, - isApolloBoard, }, }); }; @@ -114,15 +78,15 @@ describe('EpicsSwimlanes', () => { cacheUpdates.setError = jest.fn(); }); - it('calls fetchIssuesForEpic on mounted', () => { - createComponent(); - expect(fetchIssuesForEpicSpy).toHaveBeenCalled(); + afterEach(() => { + mockApollo = null; }); describe('reorder lists', () => { describe('when canAdminList prop is true', () => { - beforeEach(() => { + beforeEach(async () => { createComponent({ canAdminList: true }); + await waitForPromises(); }); it('should return Draggable reference when canAdminList prop is true', () => { @@ -149,8 +113,9 @@ describe('EpicsSwimlanes', () => { }); describe('template', () => { - beforeEach(() => { + beforeEach(async () => { createComponent(); + await waitForPromises(); }); it('displays BoardListHeader components for lists', () => { @@ -208,43 +173,50 @@ describe('EpicsSwimlanes', () => { }); describe('load more epics', () => { - beforeEach(() => { - createComponent({ hasMoreEpics: true }); - }); + const queryLoadMoreHandler = jest.fn(); - it('displays load more epics button if there are more epics', () => { - expect(findLoadMoreEpicsButton().exists()).toBe(true); + beforeEach(async () => { + queryLoadMoreHandler.mockResolvedValueOnce(mockEpicSwimlanesResponse({ hasNextPage: true })); + queryLoadMoreHandler.mockResolvedValueOnce( + mockEpicSwimlanesResponse({ + epics: [ + { + ...mockEpic, + id: 'gid://gitlab/Epic/417', + userPreferences: { + collapsed: false, + }, + }, + ], + }), + ); + createComponent({ epicsSwimlanesQueryHandler: queryLoadMoreHandler }); + await waitForPromises(); }); - it('calls fetchEpicsSwimlanes action when loading more epics', async () => { + it('fetches more epics on click on Load more epics button', async () => { + expect(findLoadMoreEpicsButton().exists()).toBe(true); findLoadMoreEpicsButton().vm.$emit('click'); - await nextTick(); + await waitForPromises(); - expect(fetchEpicsSwimlanesSpy).toHaveBeenCalled(); + expect(queryLoadMoreHandler).toHaveBeenCalledTimes(2); }); }); - describe('Loading skeleton', () => { - it.each` - epicLanesFetchInProgress | listItemsFetchInProgress | expected - ${true} | ${true} | ${true} - ${false} | ${true} | ${true} - ${true} | ${false} | ${true} - ${false} | ${false} | ${false} - `( - 'loading is $expected when epicLanesFetchInProgress is $epicLanesFetchInProgress and listItemsFetchInProgress is $listItemsFetchInProgress', - ({ epicLanesFetchInProgress, listItemsFetchInProgress, expected }) => { - createComponent({ epicLanesFetchInProgress, listItemsFetchInProgress }); - - expect(wrapper.findComponent(SwimlanesLoadingSkeleton).exists()).toBe(expected); - }, - ); + it('displays loading skeleton while data is loading', async () => { + createComponent(); + + expect(findLoadingSkeleton().exists()).toBe(true); + + await waitForPromises(); + + expect(findLoadingSkeleton().exists()).toBe(false); }); - describe('Apollo boards', () => { + describe('Queries', () => { beforeEach(async () => { - createComponent({ isApolloBoard: true, canAdminList: true }); + createComponent({ canAdminList: true }); await waitForPromises(); }); @@ -287,7 +259,6 @@ describe('EpicsSwimlanes', () => { it('sets error when fetch epics swimlanes query fails', async () => { createComponent({ - isApolloBoard: true, canAdminList: true, epicsSwimlanesQueryHandler: epicsSwimlanesQueryHandlerFailure, }); diff --git a/ee/spec/frontend/boards/components/issues_lane_list_spec.js b/ee/spec/frontend/boards/components/issues_lane_list_spec.js index 183ec6b656aa621de57a8a96481456f4f71c61a8..7ae7fbd16cd3087fbf9d61537afdff76e9751f50 100644 --- a/ee/spec/frontend/boards/components/issues_lane_list_spec.js +++ b/ee/spec/frontend/boards/components/issues_lane_list_spec.js @@ -13,7 +13,6 @@ import BoardNewIssue from '~/boards/components/board_new_issue.vue'; import { ListType } from '~/boards/constants'; import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql'; import issueCreateMutation from '~/boards/graphql/issue_create.mutation.graphql'; -import { createStore, storeOptions } from '~/boards/stores'; import * as cacheUpdates from '~/boards/graphql/cache_updates'; import issueMoveListMutation from 'ee/boards/graphql/issue_move_list.mutation.graphql'; import { mockList, boardListQueryResponse } from 'jest/boards/mock_data'; @@ -29,7 +28,6 @@ Vue.use(VueApollo); describe('IssuesLaneList', () => { let wrapper; - let store; let mockApollo; const findNewIssueForm = () => wrapper.findComponent(BoardNewIssue); @@ -47,8 +45,8 @@ describe('IssuesLaneList', () => { collapsed = false, isUnassignedIssuesLane = false, canAdminEpic = false, + highlightedLists = [], totalIssuesCount = 2, - isApolloBoard = false, listsIssuesQueryHandler = listIssuesQueryHandlerSuccess, moveIssueMutationHandler = moveIssueMutationHandlerSuccess, createIssueMutationHandler = createIssueMutationHandlerSuccess, @@ -107,7 +105,6 @@ describe('IssuesLaneList', () => { wrapper = shallowMount(IssuesLaneList, { apolloProvider: mockApollo, - store, propsData: { boardId: 'gid://gitlab/Board/1', list: listMock, @@ -117,12 +114,12 @@ describe('IssuesLaneList', () => { isUnassignedIssuesLane, filterParams: {}, lists: mockLists, + highlightedLists, totalIssuesCount, }, provide: { fullPath: 'gitlab-org', boardType: 'group', - isApolloBoard, }, }); }; @@ -140,8 +137,6 @@ describe('IssuesLaneList', () => { describe('if list is expanded', () => { beforeEach(() => { - store = createStore(); - createComponent(); }); @@ -156,8 +151,6 @@ describe('IssuesLaneList', () => { describe('if list is collapsed', () => { beforeEach(() => { - store = createStore(); - createComponent({ collapsed: true }); }); @@ -172,8 +165,6 @@ describe('IssuesLaneList', () => { describe('drag & drop permissions', () => { beforeEach(() => { - store = createStore(); - createComponent(); }); @@ -207,7 +198,6 @@ describe('IssuesLaneList', () => { it('removes class `is-dragging` from document body', () => { createComponent({ canAdminEpic: true }); - jest.spyOn(store, 'dispatch').mockImplementation(() => {}); document.body.classList.add('is-dragging'); wrapper.find(`[data-testid="tree-root-wrapper"]`).vm.$emit('end', { @@ -230,15 +220,7 @@ describe('IssuesLaneList', () => { describe('highlighting', () => { it('scrolls to column when highlighted', async () => { - const options = { - ...storeOptions, - state: { - ...storeOptions.state(), - highlightedLists: [mockList.id], - }, - }; - store = createStore(options); - createComponent(); + createComponent({ highlightedLists: [mockList.id] }); await nextTick(); @@ -248,10 +230,6 @@ describe('IssuesLaneList', () => { }); describe('max issue count warning', () => { - beforeEach(() => { - store = createStore(); - }); - describe('when issue count exceeds max issue count', () => { it('sets background to red-100', () => { createComponent({ listProps: { maxIssueCount: 3 }, totalIssuesCount: 4 }); @@ -270,7 +248,7 @@ describe('IssuesLaneList', () => { }); }); - describe('Apollo boards', () => { + describe('Queries', () => { const endDragVariables = { oldIndex: 1, newIndex: 0, @@ -296,7 +274,7 @@ describe('IssuesLaneList', () => { `( 'fetches issues $performsQuery when isUnassignedIssuesLane is $isUnassignedIssuesLane', async ({ isUnassignedIssuesLane, queryCalledTimes }) => { - createComponent({ isUnassignedIssuesLane, isApolloBoard: true }); + createComponent({ isUnassignedIssuesLane }); await waitForPromises(); @@ -307,7 +285,6 @@ describe('IssuesLaneList', () => { it('sets error when fetching unassigned issues fails', async () => { createComponent({ isUnassignedIssuesLane: true, - isApolloBoard: true, listsIssuesQueryHandler: queryHandlerFailure, }); @@ -317,7 +294,7 @@ describe('IssuesLaneList', () => { }); it('calls moveIssue mutation on drag & drop card', async () => { - createComponent({ isApolloBoard: true, canAdminEpic: true }); + createComponent({ canAdminEpic: true }); await waitForPromises(); @@ -330,7 +307,6 @@ describe('IssuesLaneList', () => { it('sets error when moveIssue mutation fails', async () => { createComponent({ - isApolloBoard: true, canAdminEpic: true, moveIssueMutationHandler: queryHandlerFailure, }); @@ -350,7 +326,6 @@ describe('IssuesLaneList', () => { id: mockList.id, }, isUnassignedIssuesLane: true, - isApolloBoard: true, canAdminEpic: true, }); @@ -372,7 +347,6 @@ describe('IssuesLaneList', () => { id: mockList.id, }, isUnassignedIssuesLane: true, - isApolloBoard: true, canAdminEpic: true, createIssueMutationHandler: queryHandlerFailure, }); diff --git a/ee/spec/frontend/boards/components/toggle_epics_swimlanes_spec.js b/ee/spec/frontend/boards/components/toggle_epics_swimlanes_spec.js index 6793492a8a851ddc81e7ae0c2177c354e396c292..33ab9ca7b103db4306f04a4992bab20cddc17465 100644 --- a/ee/spec/frontend/boards/components/toggle_epics_swimlanes_spec.js +++ b/ee/spec/frontend/boards/components/toggle_epics_swimlanes_spec.js @@ -15,9 +15,6 @@ describe('ToggleEpicsSwimlanes', () => { propsData: { isSwimlanesOn, }, - provide: { - isApolloBoard: true, - }, stubs: { GlCollapsibleListbox, }, diff --git a/ee/spec/frontend/boards/mock_data.js b/ee/spec/frontend/boards/mock_data.js index e3085dfacb15c51c8adf28ef0c2c3602623c3f1e..d0e86d27691b7160818f1462ed2ed9356f57f684 100644 --- a/ee/spec/frontend/boards/mock_data.js +++ b/ee/spec/frontend/boards/mock_data.js @@ -853,24 +853,24 @@ export const mockTokens = (fetchLabels, fetchIterations, fetchIterationCadences) }, ]; -export const mockEpicSwimlanesResponse = { +export const mockEpicSwimlanesResponse = ({ hasNextPage = false, epics = mockEpics } = {}) => ({ data: { group: { id: 'gid://gitlab/Group/114', board: { id: 'gid://gitlab/Board/1', epics: { - nodes: [mockEpics], + nodes: epics, pageInfo: { endCursor: null, - hasNextPage: false, + hasNextPage, }, }, }, __typename: 'Group', }, }, -}; +}); export const mockUpdateListWipLimitResponse = { data: { diff --git a/spec/frontend/boards/board_list_helper.js b/spec/frontend/boards/board_list_helper.js index e3afd2dec2f1f865cb65eb4885626858bba5e2d2..1ee4a7353ce3be507b2842f6032daac4d6b127a1 100644 --- a/spec/frontend/boards/board_list_helper.js +++ b/spec/frontend/boards/board_list_helper.js @@ -64,7 +64,6 @@ export default function createComponent({ disabled: false, boardType: 'group', issuableType: 'issue', - isApolloBoard: true, ...provide, }, stubs, diff --git a/spec/frontend/boards/components/board_app_spec.js b/spec/frontend/boards/components/board_app_spec.js index 157c76b4fff8da42989ec792cdb3be837c84f759..9452e3e10c90978c6aeb560981eb7b4cd3bbda2d 100644 --- a/spec/frontend/boards/components/board_app_spec.js +++ b/spec/frontend/boards/components/board_app_spec.js @@ -47,7 +47,7 @@ describe('BoardApp', () => { beforeEach(async () => { cacheUpdates.setError = jest.fn(); - createComponent({ isApolloBoard: true }); + createComponent(); await nextTick(); }); @@ -60,7 +60,7 @@ describe('BoardApp', () => { }); it('should not have is-compact class when no card is selected', async () => { - createComponent({ isApolloBoard: true, issue: {} }); + createComponent({ issue: {} }); await nextTick(); expect(wrapper.classes()).not.toContain('is-compact'); @@ -69,14 +69,14 @@ describe('BoardApp', () => { it('refetches lists when updateBoard event is received', async () => { jest.spyOn(eventHub, '$on').mockImplementation(() => {}); - createComponent({ isApolloBoard: true }); + createComponent(); await waitForPromises(); expect(eventHub.$on).toHaveBeenCalledWith('updateBoard', wrapper.vm.refetchLists); }); it('sets error on fetch lists failure', async () => { - createComponent({ isApolloBoard: true, handler: boardListQueryHandlerFailure }); + createComponent({ handler: boardListQueryHandlerFailure }); await waitForPromises(); diff --git a/spec/frontend/boards/components/board_card_move_to_position_spec.js b/spec/frontend/boards/components/board_card_move_to_position_spec.js index d3c43a4e054e48bbc5aa80038a28b1f07bb71ed9..23ac8e8f75344cee849f67c7b971907988db6e08 100644 --- a/spec/frontend/boards/components/board_card_move_to_position_spec.js +++ b/spec/frontend/boards/components/board_card_move_to_position_spec.js @@ -30,12 +30,9 @@ describe('Board Card Move to position', () => { let store; const itemIndex = 1; - const createComponent = (propsData, isApolloBoard = false) => { + const createComponent = (propsData) => { wrapper = shallowMount(BoardCardMoveToPosition, { store, - provide: { - isApolloBoard, - }, propsData: { item: mockIssue2, list: mockList, diff --git a/spec/frontend/boards/components/board_card_spec.js b/spec/frontend/boards/components/board_card_spec.js index dae0db2710483db299abd03f57f63430b658daa7..1781c58c11f311639c93fc4ac9ce555d8db1f622 100644 --- a/spec/frontend/boards/components/board_card_spec.js +++ b/spec/frontend/boards/components/board_card_spec.js @@ -76,7 +76,6 @@ describe('Board card', () => { isGroupBoard: true, disabled: false, allowSubEpics: false, - isApolloBoard: true, ...provide, }, }); diff --git a/spec/frontend/boards/components/board_top_bar_spec.js b/spec/frontend/boards/components/board_top_bar_spec.js index 03526600114d460f00eb18522c38f9f4aaca39f4..477c504ecbab7970bf356d2867b8ff723ef1b963 100644 --- a/spec/frontend/boards/components/board_top_bar_spec.js +++ b/spec/frontend/boards/components/board_top_bar_spec.js @@ -56,7 +56,6 @@ describe('BoardTopBar', () => { isIssueBoard: true, isEpicBoard: false, isGroupBoard: true, - // isApolloBoard: false, ...provide, }, stubs: { IssueBoardFilteredSearch }, diff --git a/spec/frontend/boards/components/boards_selector_spec.js b/spec/frontend/boards/components/boards_selector_spec.js index 8766b1c25f27342c943991e8abd0915694ee1cbe..db5243732c687e4165c24d59c148804b3705a8a6 100644 --- a/spec/frontend/boards/components/boards_selector_spec.js +++ b/spec/frontend/boards/components/boards_selector_spec.js @@ -94,7 +94,6 @@ describe('BoardsSelector', () => { boardType: isGroupBoard ? 'group' : 'project', isGroupBoard, isProjectBoard, - // isApolloBoard: false, ...provide, }, });