Commit 77c8b68d authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'Remove-nextPage-function-logic-from-listmodel' into 'master'

Remove nextpage function logic from list model

See merge request gitlab-org/gitlab!31904
parents 509df13f f175fb22
/* eslint-disable no-underscore-dangle, class-methods-use-this, consistent-return */ /* eslint-disable no-underscore-dangle, class-methods-use-this */
import ListIssue from 'ee_else_ce/boards/models/issue'; import ListIssue from 'ee_else_ce/boards/models/issue';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -8,8 +8,6 @@ import flash from '~/flash'; ...@@ -8,8 +8,6 @@ import flash from '~/flash';
import boardsStore from '../stores/boards_store'; import boardsStore from '../stores/boards_store';
import ListMilestone from './milestone'; import ListMilestone from './milestone';
const PER_PAGE = 20;
const TYPES = { const TYPES = {
backlog: { backlog: {
isPreset: true, isPreset: true,
...@@ -91,13 +89,7 @@ class List { ...@@ -91,13 +89,7 @@ class List {
} }
nextPage() { nextPage() {
if (this.issuesSize > this.issues.length) { return boardsStore.goToNextPage(this);
if (this.issues.length / PER_PAGE >= 1) {
this.page += 1;
}
return this.getIssues(false);
}
} }
getIssues(emptyIssues = true) { getIssues(emptyIssues = true) {
......
/* eslint-disable no-shadow, no-param-reassign */ /* eslint-disable no-shadow, no-param-reassign,consistent-return */
/* global List */ /* global List */
import $ from 'jquery'; import $ from 'jquery';
...@@ -22,6 +22,7 @@ import ListLabel from '../models/label'; ...@@ -22,6 +22,7 @@ import ListLabel from '../models/label';
import ListAssignee from '../models/assignee'; import ListAssignee from '../models/assignee';
import ListMilestone from '../models/milestone'; import ListMilestone from '../models/milestone';
const PER_PAGE = 20;
const boardsStore = { const boardsStore = {
disabled: false, disabled: false,
timeTracking: { timeTracking: {
...@@ -137,6 +138,17 @@ const boardsStore = { ...@@ -137,6 +138,17 @@ const boardsStore = {
findIssueLabel(issue, findLabel) { findIssueLabel(issue, findLabel) {
return issue.labels.find(label => label.id === findLabel.id); return issue.labels.find(label => label.id === findLabel.id);
}, },
goToNextPage(list) {
if (list.issuesSize > list.issues.length) {
if (list.issues.length / PER_PAGE >= 1) {
list.page += 1;
}
return list.getIssues(false);
}
},
addListIssue(list, issue, listFrom, newIndex) { addListIssue(list, issue, listFrom, newIndex) {
let moveBeforeId = null; let moveBeforeId = null;
let moveAfterId = null; let moveAfterId = null;
......
---
title: Remove nextpage function logic from list model
merge_request: 31904
author: nuwe1
type: other
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