| ... | @@ -2,7 +2,7 @@ |
... | @@ -2,7 +2,7 @@ |
|
|
/* global List */
|
|
/* global List */
|
|
|
|
|
|
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
|
import _ from 'underscore';
|
|
import { sortBy } from 'lodash';
|
|
|
import Vue from 'vue';
|
|
import Vue from 'vue';
|
|
|
import Cookies from 'js-cookie';
|
|
import Cookies from 'js-cookie';
|
|
|
import BoardsStoreEE from 'ee_else_ce/boards/stores/boards_store_ee';
|
|
import BoardsStoreEE from 'ee_else_ce/boards/stores/boards_store_ee';
|
| ... | @@ -12,6 +12,10 @@ import axios from '~/lib/utils/axios_utils'; |
... | @@ -12,6 +12,10 @@ import axios from '~/lib/utils/axios_utils'; |
|
|
import { mergeUrlParams } from '~/lib/utils/url_utility';
|
|
import { mergeUrlParams } from '~/lib/utils/url_utility';
|
|
|
import eventHub from '../eventhub';
|
|
import eventHub from '../eventhub';
|
|
|
import { ListType } from '../constants';
|
|
import { ListType } from '../constants';
|
|
|
|
import IssueProject from '../models/project';
|
|
|
|
import ListLabel from '../models/label';
|
|
|
|
import ListAssignee from '../models/assignee';
|
|
|
|
import ListMilestone from '../models/milestone';
|
|
|
|
|
|
|
|
const boardsStore = {
|
|
const boardsStore = {
|
|
|
disabled: false,
|
|
disabled: false,
|
| ... | @@ -30,7 +34,6 @@ const boardsStore = { |
... | @@ -30,7 +34,6 @@ const boardsStore = { |
|
|
labels: [],
|
|
labels: [],
|
|
|
},
|
|
},
|
|
|
currentPage: '',
|
|
currentPage: '',
|
|
|
reload: false,
|
|
|
|
|
endpoints: {},
|
|
endpoints: {},
|
|
|
},
|
|
},
|
|
|
detail: {
|
|
detail: {
|
| ... | @@ -42,7 +45,14 @@ const boardsStore = { |
... | @@ -42,7 +45,14 @@ const boardsStore = { |
|
|
},
|
|
},
|
|
|
multiSelect: { list: [] },
|
|
multiSelect: { list: [] },
|
|
|
|
|
|
|
|
setEndpoints({ boardsEndpoint, listsEndpoint, bulkUpdatePath, boardId, recentBoardsEndpoint }) {
|
|
setEndpoints({
|
|
|
|
boardsEndpoint,
|
|
|
|
listsEndpoint,
|
|
|
|
bulkUpdatePath,
|
|
|
|
boardId,
|
|
|
|
recentBoardsEndpoint,
|
|
|
|
fullPath,
|
|
|
|
}) {
|
|
|
const listsEndpointGenerate = `${listsEndpoint}/generate.json`;
|
|
const listsEndpointGenerate = `${listsEndpoint}/generate.json`;
|
|
|
this.state.endpoints = {
|
|
this.state.endpoints = {
|
|
|
boardsEndpoint,
|
|
boardsEndpoint,
|
| ... | @@ -50,6 +60,7 @@ const boardsStore = { |
... | @@ -50,6 +60,7 @@ const boardsStore = { |
|
|
listsEndpoint,
|
|
listsEndpoint,
|
|
|
listsEndpointGenerate,
|
|
listsEndpointGenerate,
|
|
|
bulkUpdatePath,
|
|
bulkUpdatePath,
|
|
|
|
fullPath,
|
|
|
recentBoardsEndpoint: `${recentBoardsEndpoint}.json`,
|
|
recentBoardsEndpoint: `${recentBoardsEndpoint}.json`,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
| ... | @@ -61,13 +72,11 @@ const boardsStore = { |
... | @@ -61,13 +72,11 @@ const boardsStore = { |
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
showPage(page) {
|
|
showPage(page) {
|
|
|
this.state.reload = false;
|
|
|
|
|
this.state.currentPage = page;
|
|
this.state.currentPage = page;
|
|
|
},
|
|
},
|
|
|
addList(listObj, defaultAvatar) {
|
|
addList(listObj) {
|
|
|
const list = new List(listObj, defaultAvatar);
|
|
const list = new List(listObj);
|
|
|
this.state.lists = _.sortBy([...this.state.lists, list], 'position');
|
|
this.state.lists = sortBy([...this.state.lists, list], 'position');
|
|
|
|
|
|
|
|
return list;
|
|
return list;
|
|
|
},
|
|
},
|
|
|
new(listObj) {
|
|
new(listObj) {
|
| ... | @@ -80,7 +89,7 @@ const boardsStore = { |
... | @@ -80,7 +89,7 @@ const boardsStore = { |
|
|
// Remove any new issues from the backlog
|
|
// Remove any new issues from the backlog
|
|
|
// as they will be visible in the new list
|
|
// as they will be visible in the new list
|
|
|
list.issues.forEach(backlogList.removeIssue.bind(backlogList));
|
|
list.issues.forEach(backlogList.removeIssue.bind(backlogList));
|
|
|
this.state.lists = _.sortBy(this.state.lists, 'position');
|
|
this.state.lists = sortBy(this.state.lists, 'position');
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
// https://gitlab.com/gitlab-org/gitlab-foss/issues/30821
|
|
// https://gitlab.com/gitlab-org/gitlab-foss/issues/30821
|
| ... | @@ -184,10 +193,9 @@ const boardsStore = { |
... | @@ -184,10 +193,9 @@ const boardsStore = { |
|
|
|
|
|
|
|
moveMultipleIssuesToList({ listFrom, listTo, issues, newIndex }) {
|
|
moveMultipleIssuesToList({ listFrom, listTo, issues, newIndex }) {
|
|
|
const issueTo = issues.map(issue => listTo.findIssue(issue.id));
|
|
const issueTo = issues.map(issue => listTo.findIssue(issue.id));
|
|
|
const issueLists = _.flatten(issues.map(issue => issue.getLists()));
|
|
const issueLists = issues.map(issue => issue.getLists()).flat();
|
|
|
const listLabels = issueLists.map(list => list.label);
|
|
const listLabels = issueLists.map(list => list.label);
|
|
|
|
|
const hasMoveableIssues = issueTo.filter(Boolean).length > 0;
|
|
|
const hasMoveableIssues = _.compact(issueTo).length > 0;
|
|
|
|
|
|
|
|
|
|
if (!hasMoveableIssues) {
|
|
if (!hasMoveableIssues) {
|
|
|
// Check if target list assignee is already present in this issue
|
|
// Check if target list assignee is already present in this issue
|
| ... | @@ -335,7 +343,8 @@ const boardsStore = { |
... | @@ -335,7 +343,8 @@ const boardsStore = { |
|
|
return (
|
|
return (
|
|
|
(listTo.type !== 'label' && listFrom.type === 'assignee') ||
|
|
(listTo.type !== 'label' && listFrom.type === 'assignee') ||
|
|
|
(listTo.type !== 'assignee' && listFrom.type === 'label') ||
|
|
(listTo.type !== 'assignee' && listFrom.type === 'label') ||
|
|
|
listFrom.type === 'backlog'
|
|
listFrom.type === 'backlog' ||
|
|
|
|
listFrom.type === 'closed'
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
moveIssueInList(list, issue, oldIndex, newIndex, idArray) {
|
|
moveIssueInList(list, issue, oldIndex, newIndex, idArray) {
|
| ... | @@ -539,10 +548,6 @@ const boardsStore = { |
... | @@ -539,10 +548,6 @@ const boardsStore = { |
|
|
return axios.post(endpoint);
|
|
return axios.post(endpoint);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
allBoards() {
|
|
|
|
|
return axios.get(this.generateBoardsPath());
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
recentBoards() {
|
|
recentBoards() {
|
|
|
return axios.get(this.state.endpoints.recentBoardsEndpoint);
|
|
return axios.get(this.state.endpoints.recentBoardsEndpoint);
|
|
|
},
|
|
},
|
| ... | @@ -595,6 +600,38 @@ const boardsStore = { |
... | @@ -595,6 +600,38 @@ const boardsStore = { |
|
|
clearMultiSelect() {
|
|
clearMultiSelect() {
|
|
|
this.multiSelect.list = [];
|
|
this.multiSelect.list = [];
|
|
|
},
|
|
},
|
|
|
|
refreshIssueData(issue, obj) {
|
|
|
|
issue.id = obj.id;
|
|
|
|
issue.iid = obj.iid;
|
|
|
|
issue.title = obj.title;
|
|
|
|
issue.confidential = obj.confidential;
|
|
|
|
issue.dueDate = obj.due_date;
|
|
|
|
issue.sidebarInfoEndpoint = obj.issue_sidebar_endpoint;
|
|
|
|
issue.referencePath = obj.reference_path;
|
|
|
|
issue.path = obj.real_path;
|
|
|
|
issue.toggleSubscriptionEndpoint = obj.toggle_subscription_endpoint;
|
|
|
|
issue.project_id = obj.project_id;
|
|
|
|
issue.timeEstimate = obj.time_estimate;
|
|
|
|
issue.assignableLabelsEndpoint = obj.assignable_labels_endpoint;
|
|
|
|
issue.blocked = obj.blocked;
|
|
|
|
|
|
|
|
if (obj.project) {
|
|
|
|
issue.project = new IssueProject(obj.project);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (obj.milestone) {
|
|
|
|
issue.milestone = new ListMilestone(obj.milestone);
|
|
|
|
issue.milestone_id = obj.milestone.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (obj.labels) {
|
|
|
|
issue.labels = obj.labels.map(label => new ListLabel(label));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (obj.assignees) {
|
|
|
|
issue.assignees = obj.assignees.map(a => new ListAssignee(a));
|
|
|
|
}
|
|
|
|
},
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BoardsStoreEE.initEESpecific(boardsStore);
|
|
BoardsStoreEE.initEESpecific(boardsStore);
|
| ... | |
... | |
| ... | | ... | |