Commit 2dd83ce4 authored by Eulyeon Ko's avatar Eulyeon Ko

Fix epic swimlanes list drag drop reordering

We added a check to "moveList" vuex action
which serves as the handler for list Draggables in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68126.

The check ensured that only move events fired by
list Draggables were handled by "moveList" by checking
for data-draggable-item-type attribute.

The attribute's been missing for epic swimlane columns
breaking the drag and drop reordering of lists in
epic swimlanes.

This commit adds the attribute to epic swimlane columns

Changelog: fixed
EE: true
parent a1f1fc87
...@@ -11,7 +11,7 @@ import { s__, n__, __ } from '~/locale'; ...@@ -11,7 +11,7 @@ import { s__, n__, __ } from '~/locale';
import defaultSortableConfig from '~/sortable/sortable_config'; import defaultSortableConfig from '~/sortable/sortable_config';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { calculateSwimlanesBufferSize } from '../boards_util'; import { calculateSwimlanesBufferSize } from '../boards_util';
import { DRAGGABLE_TAG, EPIC_LANE_BASE_HEIGHT } from '../constants'; import { DRAGGABLE_TAG, EPIC_LANE_BASE_HEIGHT, DraggableItemTypes } from '../constants';
import EpicLane from './epic_lane.vue'; import EpicLane from './epic_lane.vue';
import IssuesLaneList from './issues_lane_list.vue'; import IssuesLaneList from './issues_lane_list.vue';
import SwimlanesLoadingSkeleton from './swimlanes_loading_skeleton.vue'; import SwimlanesLoadingSkeleton from './swimlanes_loading_skeleton.vue';
...@@ -19,6 +19,7 @@ import SwimlanesLoadingSkeleton from './swimlanes_loading_skeleton.vue'; ...@@ -19,6 +19,7 @@ import SwimlanesLoadingSkeleton from './swimlanes_loading_skeleton.vue';
export default { export default {
EpicLane, EpicLane,
epicLaneBaseHeight: EPIC_LANE_BASE_HEIGHT, epicLaneBaseHeight: EPIC_LANE_BASE_HEIGHT,
draggableItemTypes: DraggableItemTypes,
components: { components: {
BoardAddNewColumn, BoardAddNewColumn,
BoardListHeader, BoardListHeader,
...@@ -215,6 +216,7 @@ export default { ...@@ -215,6 +216,7 @@ export default {
class="board gl-display-inline-block gl-px-3 gl-vertical-align-top gl-white-space-normal" class="board gl-display-inline-block gl-px-3 gl-vertical-align-top gl-white-space-normal"
:data-list-id="list.id" :data-list-id="list.id"
data-testid="board-header-container" data-testid="board-header-container"
:data-draggable-item-type="$options.draggableItemTypes.list"
> >
<board-list-header <board-list-header
:can-admin-list="canAdminList" :can-admin-list="canAdminList"
......
...@@ -33,7 +33,7 @@ RSpec.describe 'epics swimlanes', :js do ...@@ -33,7 +33,7 @@ RSpec.describe 'epics swimlanes', :js do
stub_licensed_features(epics: true, swimlanes: true) stub_licensed_features(epics: true, swimlanes: true)
sign_in(user) sign_in(user)
visit_board_page load_board project_boards_path(project)
load_epic_swimlanes load_epic_swimlanes
load_unassigned_issues load_unassigned_issues
end end
...@@ -117,9 +117,24 @@ RSpec.describe 'epics swimlanes', :js do ...@@ -117,9 +117,24 @@ RSpec.describe 'epics swimlanes', :js do
end end
end end
def visit_board_page context 'drag and drop list' do
visit project_boards_path(project) let_it_be(:label2) { create(:label, project: project, name: 'Label 2') }
wait_for_requests let_it_be(:list2) { create(:list, board: board, label: label2, position: 1) }
it 're-orders lists' do
drag(list_from_index: 1, list_to_index: 2, selector: '.board-header')
wait_for_requests
expect(find_board_list_header(2)).to have_content(label2.title)
expect(find_board_list_header(3)).to have_content(label.title)
expect(list.reload.position).to eq(1)
expect(list2.reload.position).to eq(0)
end
end
def find_board_list_header(list_idx)
find(".board:nth-child(#{list_idx}) [data-testid=\"board-list-header\"]")
end end
def select_epics def select_epics
......
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