Commit d83a9726 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'ntepluhina-intersection-observer-2' into 'master'

Fix loading board lists on big screen size

See merge request gitlab-org/gitlab!63004
parents 38118f13 cf348fc0
...@@ -142,6 +142,7 @@ export default { ...@@ -142,6 +142,7 @@ export default {
}, },
onReachingListBottom() { onReachingListBottom() {
if (!this.loadingMore && this.hasNextPage) { if (!this.loadingMore && this.hasNextPage) {
this.showCount = true;
this.loadNextPage(); this.loadNextPage();
} }
}, },
...@@ -150,12 +151,19 @@ export default { ...@@ -150,12 +151,19 @@ export default {
}, },
handleDragOnEnd(params) { handleDragOnEnd(params) {
sortableEnd(); sortableEnd();
const { newIndex, oldIndex, from, to, item } = params; const { oldIndex, from, to, item } = params;
let { newIndex } = params;
const { itemId, itemIid, itemPath } = item.dataset; const { itemId, itemIid, itemPath } = item.dataset;
const { children } = to; let { children } = to;
let moveBeforeId; let moveBeforeId;
let moveAfterId; let moveAfterId;
children = Array.from(children).filter((card) => card.classList.contains('board-card'));
if (newIndex > children.length) {
newIndex = children.length;
}
const getItemId = (el) => Number(el.dataset.itemId); const getItemId = (el) => Number(el.dataset.itemId);
// If item is being moved within the same list // If item is being moved within the same list
...@@ -218,6 +226,7 @@ export default { ...@@ -218,6 +226,7 @@ export default {
:data-board="list.id" :data-board="list.id"
:data-board-type="list.listType" :data-board-type="list.listType"
:class="{ 'bg-danger-100': boardItemsSizeExceedsMax }" :class="{ 'bg-danger-100': boardItemsSizeExceedsMax }"
draggable=".board-card"
class="board-list gl-w-full gl-h-full gl-list-style-none gl-mb-0 gl-p-2 js-board-list" class="board-list gl-w-full gl-h-full gl-list-style-none gl-mb-0 gl-p-2 js-board-list"
data-testid="tree-root-wrapper" data-testid="tree-root-wrapper"
@start="handleDragOnStart" @start="handleDragOnStart"
...@@ -232,17 +241,17 @@ export default { ...@@ -232,17 +241,17 @@ export default {
:item="item" :item="item"
:disabled="disabled" :disabled="disabled"
/> />
<li v-if="showCount" class="board-list-count gl-text-center" data-issue-id="-1"> <gl-intersection-observer @appear="onReachingListBottom">
<gl-loading-icon <li v-if="showCount" class="board-list-count gl-text-center" data-issue-id="-1">
v-if="loadingMore" <gl-loading-icon
:label="$options.i18n.loadingMoreboardItems" v-if="loadingMore"
data-testid="count-loading-icon" :label="$options.i18n.loadingMoreboardItems"
/> data-testid="count-loading-icon"
<span v-if="showingAllItems">{{ showingAllItemsText }}</span> />
<gl-intersection-observer v-else @appear="onReachingListBottom"> <span v-if="showingAllItems">{{ showingAllItemsText }}</span>
<span>{{ paginatedIssueText }}</span> <span v-else>{{ paginatedIssueText }}</span>
</gl-intersection-observer> </li>
</li> </gl-intersection-observer>
</component> </component>
</div> </div>
</template> </template>
...@@ -157,7 +157,7 @@ RSpec.describe 'Issue Boards', :js do ...@@ -157,7 +157,7 @@ RSpec.describe 'Issue Boards', :js do
end end
it 'moves to bottom of another list' do it 'moves to bottom of another list' do
drag(list_from_index: 1, list_to_index: 2, to_index: 2, duration: 1020) drag(list_from_index: 1, list_to_index: 2, to_index: 3, duration: 1020)
wait_for_requests wait_for_requests
......
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