2020-09-10 05:08:27 -04:00
|
|
|
/* global List */
|
|
|
|
|
2021-08-06 23:08:35 -04:00
|
|
|
import { GlFilteredSearchToken } from '@gitlab/ui';
|
2020-11-09 07:09:24 -05:00
|
|
|
import { keyBy } from 'lodash';
|
2021-02-14 13:09:20 -05:00
|
|
|
import Vue from 'vue';
|
2020-09-10 05:08:27 -04:00
|
|
|
import '~/boards/models/list';
|
2021-04-13 20:10:39 -04:00
|
|
|
import { ListType } from '~/boards/constants';
|
2020-03-23 23:09:28 -04:00
|
|
|
import boardsStore from '~/boards/stores/boards_store';
|
2021-07-13 23:08:27 -04:00
|
|
|
import { __ } from '~/locale';
|
|
|
|
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
|
|
|
|
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
|
2021-08-06 02:10:16 -04:00
|
|
|
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
|
2020-03-23 23:09:28 -04:00
|
|
|
|
2019-12-13 10:08:02 -05:00
|
|
|
export const boardObj = {
|
|
|
|
id: 1,
|
|
|
|
name: 'test',
|
|
|
|
milestone_id: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const listObj = {
|
|
|
|
id: 300,
|
|
|
|
position: 0,
|
|
|
|
title: 'Test',
|
|
|
|
list_type: 'label',
|
|
|
|
weight: 3,
|
|
|
|
label: {
|
|
|
|
id: 5000,
|
|
|
|
title: 'Test',
|
2020-04-02 14:08:11 -04:00
|
|
|
color: '#ff0000',
|
2019-12-13 10:08:02 -05:00
|
|
|
description: 'testing;',
|
|
|
|
textColor: 'white',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const listObjDuplicate = {
|
|
|
|
id: listObj.id,
|
|
|
|
position: 1,
|
|
|
|
title: 'Test',
|
|
|
|
list_type: 'label',
|
|
|
|
weight: 3,
|
|
|
|
label: {
|
|
|
|
id: listObj.label.id,
|
|
|
|
title: 'Test',
|
2020-04-02 14:08:11 -04:00
|
|
|
color: '#ff0000',
|
2019-12-13 10:08:02 -05:00
|
|
|
description: 'testing;',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockAssigneesList = [
|
|
|
|
{
|
|
|
|
id: 2,
|
|
|
|
name: 'Terrell Graham',
|
|
|
|
username: 'monserrate.gleichner',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/598fd02741ac58b88854a99d16704309?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/monserrate.gleichner',
|
|
|
|
path: '/monserrate.gleichner',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 12,
|
|
|
|
name: 'Susy Johnson',
|
|
|
|
username: 'tana_harvey',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/e021a7b0f3e4ae53b5068d487e68c031?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/tana_harvey',
|
|
|
|
path: '/tana_harvey',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 20,
|
|
|
|
name: 'Conchita Eichmann',
|
|
|
|
username: 'juliana_gulgowski',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/c43c506cb6fd7b37017d3b54b94aa937?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/juliana_gulgowski',
|
|
|
|
path: '/juliana_gulgowski',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 6,
|
|
|
|
name: 'Bryce Turcotte',
|
|
|
|
username: 'melynda',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/cc2518f2c6f19f8fac49e1a5ee092a9b?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/melynda',
|
|
|
|
path: '/melynda',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
name: 'Administrator',
|
|
|
|
username: 'root',
|
|
|
|
state: 'active',
|
|
|
|
avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
|
|
|
|
web_url: 'http://127.0.0.1:3001/root',
|
|
|
|
path: '/root',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const mockMilestone = {
|
|
|
|
id: 1,
|
|
|
|
state: 'active',
|
|
|
|
title: 'Milestone title',
|
|
|
|
description: 'Harum corporis aut consequatur quae dolorem error sequi quia.',
|
|
|
|
start_date: '2018-01-01',
|
|
|
|
due_date: '2019-12-31',
|
|
|
|
};
|
2020-03-23 23:09:28 -04:00
|
|
|
|
2021-07-30 08:10:12 -04:00
|
|
|
export const mockMilestones = [
|
|
|
|
{
|
|
|
|
id: 'gid://gitlab/Milestone/1',
|
|
|
|
title: 'Milestone 1',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'gid://gitlab/Milestone/2',
|
|
|
|
title: 'Milestone 2',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2020-12-14 16:09:47 -05:00
|
|
|
export const assignees = [
|
2020-09-15 05:09:30 -04:00
|
|
|
{
|
|
|
|
id: 'gid://gitlab/User/2',
|
|
|
|
username: 'angelina.herman',
|
|
|
|
name: 'Bernardina Bosco',
|
|
|
|
avatar: 'https://www.gravatar.com/avatar/eb7b664b13a30ad9f9ba4b61d7075470?s=80&d=identicon',
|
|
|
|
webUrl: 'http://127.0.0.1:3000/angelina.herman',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2020-10-15 14:08:43 -04:00
|
|
|
export const labels = [
|
2020-09-15 05:09:30 -04:00
|
|
|
{
|
|
|
|
id: 'gid://gitlab/GroupLabel/5',
|
|
|
|
title: 'Cosync',
|
|
|
|
color: '#34ebec',
|
|
|
|
description: null,
|
|
|
|
},
|
2020-10-15 14:08:43 -04:00
|
|
|
{
|
|
|
|
id: 'gid://gitlab/GroupLabel/6',
|
|
|
|
title: 'Brock',
|
|
|
|
color: '#e082b6',
|
|
|
|
description: null,
|
|
|
|
},
|
2020-09-15 05:09:30 -04:00
|
|
|
];
|
|
|
|
|
2020-09-10 05:08:27 -04:00
|
|
|
export const rawIssue = {
|
2020-09-15 05:09:30 -04:00
|
|
|
title: 'Issue 1',
|
|
|
|
id: 'gid://gitlab/Issue/436',
|
2021-03-16 02:09:57 -04:00
|
|
|
iid: '27',
|
2020-09-15 05:09:30 -04:00
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
2020-09-10 05:08:27 -04:00
|
|
|
confidential: false,
|
2020-09-15 08:09:30 -04:00
|
|
|
referencePath: 'gitlab-org/test-subgroup/gitlab-test#27',
|
|
|
|
path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/27',
|
2020-09-10 05:08:27 -04:00
|
|
|
labels: {
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
title: 'test',
|
2021-01-22 04:08:53 -05:00
|
|
|
color: '#F0AD4E',
|
2020-09-10 05:08:27 -04:00
|
|
|
description: 'testing',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
assignees: {
|
2020-09-15 05:09:30 -04:00
|
|
|
nodes: assignees,
|
|
|
|
},
|
|
|
|
epic: {
|
|
|
|
id: 'gid://gitlab/Epic/41',
|
2020-09-10 05:08:27 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-05-14 17:10:41 -04:00
|
|
|
export const mockIssueFullPath = 'gitlab-org/test-subgroup/gitlab-test';
|
|
|
|
|
2020-08-13 05:10:09 -04:00
|
|
|
export const mockIssue = {
|
2020-09-15 05:09:30 -04:00
|
|
|
id: 'gid://gitlab/Issue/436',
|
2021-03-16 02:09:57 -04:00
|
|
|
iid: '27',
|
2020-09-15 05:09:30 -04:00
|
|
|
title: 'Issue 1',
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
2020-08-13 05:10:09 -04:00
|
|
|
confidential: false,
|
2021-05-14 17:10:41 -04:00
|
|
|
referencePath: `${mockIssueFullPath}#27`,
|
|
|
|
path: `/${mockIssueFullPath}/-/issues/27`,
|
2020-09-15 05:09:30 -04:00
|
|
|
assignees,
|
2020-08-13 05:10:09 -04:00
|
|
|
labels: [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
title: 'test',
|
2021-01-22 04:08:53 -05:00
|
|
|
color: '#F0AD4E',
|
2020-08-13 05:10:09 -04:00
|
|
|
description: 'testing',
|
|
|
|
},
|
|
|
|
],
|
2020-09-15 05:09:30 -04:00
|
|
|
epic: {
|
|
|
|
id: 'gid://gitlab/Epic/41',
|
|
|
|
},
|
2020-08-13 05:10:09 -04:00
|
|
|
};
|
|
|
|
|
2020-11-16 04:09:18 -05:00
|
|
|
export const mockActiveIssue = {
|
|
|
|
...mockIssue,
|
2021-07-15 02:09:39 -04:00
|
|
|
fullId: 'gid://gitlab/Issue/436',
|
2020-11-16 04:09:18 -05:00
|
|
|
id: 436,
|
|
|
|
iid: '27',
|
|
|
|
subscribed: false,
|
|
|
|
emailsDisabled: false,
|
|
|
|
};
|
|
|
|
|
2020-09-09 17:08:33 -04:00
|
|
|
export const mockIssue2 = {
|
2020-09-15 05:09:30 -04:00
|
|
|
id: 'gid://gitlab/Issue/437',
|
|
|
|
iid: 28,
|
|
|
|
title: 'Issue 2',
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
2020-09-09 17:08:33 -04:00
|
|
|
confidential: false,
|
2020-09-15 08:09:30 -04:00
|
|
|
referencePath: 'gitlab-org/test-subgroup/gitlab-test#28',
|
|
|
|
path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/28',
|
2020-09-15 05:09:30 -04:00
|
|
|
assignees,
|
|
|
|
labels,
|
|
|
|
epic: {
|
|
|
|
id: 'gid://gitlab/Epic/40',
|
|
|
|
},
|
2020-09-09 17:08:33 -04:00
|
|
|
};
|
|
|
|
|
2020-09-15 05:09:30 -04:00
|
|
|
export const mockIssue3 = {
|
|
|
|
id: 'gid://gitlab/Issue/438',
|
|
|
|
iid: 29,
|
|
|
|
title: 'Issue 3',
|
|
|
|
referencePath: '#29',
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
|
|
|
confidential: false,
|
|
|
|
path: '/gitlab-org/gitlab-test/-/issues/28',
|
|
|
|
assignees,
|
|
|
|
labels,
|
|
|
|
epic: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockIssue4 = {
|
|
|
|
id: 'gid://gitlab/Issue/439',
|
|
|
|
iid: 30,
|
|
|
|
title: 'Issue 4',
|
|
|
|
referencePath: '#30',
|
|
|
|
dueDate: null,
|
|
|
|
timeEstimate: 0,
|
|
|
|
weight: null,
|
|
|
|
confidential: false,
|
|
|
|
path: '/gitlab-org/gitlab-test/-/issues/28',
|
|
|
|
assignees,
|
|
|
|
labels,
|
|
|
|
epic: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockIssues = [mockIssue, mockIssue2];
|
|
|
|
|
2020-03-23 23:09:28 -04:00
|
|
|
export const BoardsMockData = {
|
|
|
|
GET: {
|
|
|
|
'/test/-/boards/1/lists/300/issues?id=300&page=1': {
|
|
|
|
issues: [
|
|
|
|
{
|
|
|
|
title: 'Testing',
|
|
|
|
id: 1,
|
|
|
|
iid: 1,
|
|
|
|
confidential: false,
|
|
|
|
labels: [],
|
|
|
|
assignees: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'/test/issue-boards/-/milestones.json': [
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
title: 'test',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
POST: {
|
|
|
|
'/test/-/boards/1/lists': listObj,
|
|
|
|
},
|
|
|
|
PUT: {
|
|
|
|
'/test/issue-boards/-/board/1/lists{/id}': {},
|
|
|
|
},
|
|
|
|
DELETE: {
|
|
|
|
'/test/issue-boards/-/board/1/lists{/id}': {},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
export const boardsMockInterceptor = (config) => {
|
2020-03-23 23:09:28 -04:00
|
|
|
const body = BoardsMockData[config.method.toUpperCase()][config.url];
|
|
|
|
return [200, body];
|
|
|
|
};
|
|
|
|
|
|
|
|
export const setMockEndpoints = (opts = {}) => {
|
|
|
|
const boardsEndpoint = opts.boardsEndpoint || '/test/issue-boards/-/boards.json';
|
|
|
|
const listsEndpoint = opts.listsEndpoint || '/test/-/boards/1/lists';
|
|
|
|
const bulkUpdatePath = opts.bulkUpdatePath || '';
|
|
|
|
const boardId = opts.boardId || '1';
|
|
|
|
|
|
|
|
boardsStore.setEndpoints({
|
|
|
|
boardsEndpoint,
|
|
|
|
listsEndpoint,
|
|
|
|
bulkUpdatePath,
|
|
|
|
boardId,
|
|
|
|
});
|
|
|
|
};
|
2020-08-24 02:10:15 -04:00
|
|
|
|
2020-12-14 16:09:47 -05:00
|
|
|
export const mockList = {
|
|
|
|
id: 'gid://gitlab/List/1',
|
2021-07-19 23:08:21 -04:00
|
|
|
title: 'Open',
|
2021-01-18 04:11:05 -05:00
|
|
|
position: -Infinity,
|
2020-12-14 16:09:47 -05:00
|
|
|
listType: 'backlog',
|
|
|
|
collapsed: false,
|
|
|
|
label: null,
|
|
|
|
assignee: null,
|
|
|
|
milestone: null,
|
|
|
|
loading: false,
|
|
|
|
issuesCount: 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockLabelList = {
|
|
|
|
id: 'gid://gitlab/List/2',
|
|
|
|
title: 'To Do',
|
|
|
|
position: 0,
|
|
|
|
listType: 'label',
|
|
|
|
collapsed: false,
|
|
|
|
label: {
|
|
|
|
id: 'gid://gitlab/GroupLabel/121',
|
2020-08-24 02:10:15 -04:00
|
|
|
title: 'To Do',
|
2020-12-14 16:09:47 -05:00
|
|
|
color: '#F0AD4E',
|
|
|
|
textColor: '#FFFFFF',
|
|
|
|
description: null,
|
2020-08-24 02:10:15 -04:00
|
|
|
},
|
2020-12-14 16:09:47 -05:00
|
|
|
assignee: null,
|
|
|
|
milestone: null,
|
|
|
|
loading: false,
|
|
|
|
issuesCount: 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockLists = [mockList, mockLabelList];
|
2020-08-24 02:10:15 -04:00
|
|
|
|
2020-11-09 07:09:24 -05:00
|
|
|
export const mockListsById = keyBy(mockLists, 'id');
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
export const mockListsWithModel = mockLists.map((listMock) =>
|
2020-08-24 02:10:15 -04:00
|
|
|
Vue.observable(new List({ ...listMock, doNotFetchIssues: true })),
|
|
|
|
);
|
2020-09-15 05:09:30 -04:00
|
|
|
|
|
|
|
export const mockIssuesByListId = {
|
|
|
|
'gid://gitlab/List/1': [mockIssue.id, mockIssue3.id, mockIssue4.id],
|
|
|
|
'gid://gitlab/List/2': mockIssues.map(({ id }) => id),
|
|
|
|
};
|
|
|
|
|
2020-11-06 04:08:56 -05:00
|
|
|
export const participants = [
|
|
|
|
{
|
|
|
|
id: '1',
|
|
|
|
username: 'test',
|
|
|
|
name: 'test',
|
|
|
|
avatar: '',
|
|
|
|
avatarUrl: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '2',
|
|
|
|
username: 'hello',
|
|
|
|
name: 'hello',
|
|
|
|
avatar: '',
|
|
|
|
avatarUrl: '',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2020-09-15 05:09:30 -04:00
|
|
|
export const issues = {
|
|
|
|
[mockIssue.id]: mockIssue,
|
|
|
|
[mockIssue2.id]: mockIssue2,
|
|
|
|
[mockIssue3.id]: mockIssue3,
|
|
|
|
[mockIssue4.id]: mockIssue4,
|
|
|
|
};
|
2020-12-23 04:10:13 -05:00
|
|
|
|
2021-03-12 10:09:33 -05:00
|
|
|
// The response from group project REST API
|
2020-12-23 04:10:13 -05:00
|
|
|
export const mockRawGroupProjects = [
|
|
|
|
{
|
|
|
|
id: 0,
|
|
|
|
name: 'Example Project',
|
|
|
|
name_with_namespace: 'Awesome Group / Example Project',
|
|
|
|
path_with_namespace: 'awesome-group/example-project',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
name: 'Foobar Project',
|
|
|
|
name_with_namespace: 'Awesome Group / Foobar Project',
|
|
|
|
path_with_namespace: 'awesome-group/foobar-project',
|
|
|
|
},
|
|
|
|
];
|
2021-01-14 04:10:22 -05:00
|
|
|
|
2021-03-12 10:09:33 -05:00
|
|
|
// The response from GraphQL endpoint
|
|
|
|
export const mockGroupProject1 = {
|
|
|
|
id: 0,
|
|
|
|
name: 'Example Project',
|
|
|
|
nameWithNamespace: 'Awesome Group / Example Project',
|
|
|
|
fullPath: 'awesome-group/example-project',
|
|
|
|
archived: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockGroupProject2 = {
|
|
|
|
id: 1,
|
|
|
|
name: 'Foobar Project',
|
|
|
|
nameWithNamespace: 'Awesome Group / Foobar Project',
|
|
|
|
fullPath: 'awesome-group/foobar-project',
|
|
|
|
archived: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockArchivedGroupProject = {
|
|
|
|
id: 2,
|
|
|
|
name: 'Archived Project',
|
|
|
|
nameWithNamespace: 'Awesome Group / Archived Project',
|
|
|
|
fullPath: 'awesome-group/archived-project',
|
|
|
|
archived: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockGroupProjects = [mockGroupProject1, mockGroupProject2];
|
|
|
|
|
|
|
|
export const mockActiveGroupProjects = [
|
|
|
|
{ ...mockGroupProject1, archived: false },
|
|
|
|
{ ...mockGroupProject2, archived: false },
|
2021-01-14 04:10:22 -05:00
|
|
|
];
|
2021-03-16 02:09:57 -04:00
|
|
|
|
|
|
|
export const mockIssueGroupPath = 'gitlab-org';
|
|
|
|
export const mockIssueProjectPath = `${mockIssueGroupPath}/gitlab-test`;
|
|
|
|
|
|
|
|
export const mockBlockingIssue1 = {
|
|
|
|
id: 'gid://gitlab/Issue/525',
|
|
|
|
iid: '6',
|
|
|
|
title: 'blocking issue title 1',
|
|
|
|
reference: 'gitlab-org/my-project-1#6',
|
|
|
|
webUrl: 'http://gdk.test:3000/gitlab-org/my-project-1/-/issues/6',
|
|
|
|
__typename: 'Issue',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockingIssue2 = {
|
|
|
|
id: 'gid://gitlab/Issue/524',
|
|
|
|
iid: '5',
|
|
|
|
title:
|
|
|
|
'blocking issue title 2 + blocking issue title 2 + blocking issue title 2 + blocking issue title 2',
|
|
|
|
reference: 'gitlab-org/my-project-1#5',
|
|
|
|
webUrl: 'http://gdk.test:3000/gitlab-org/my-project-1/-/issues/5',
|
|
|
|
__typename: 'Issue',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockingIssue3 = {
|
|
|
|
id: 'gid://gitlab/Issue/523',
|
|
|
|
iid: '4',
|
|
|
|
title: 'blocking issue title 3',
|
|
|
|
reference: 'gitlab-org/my-project-1#4',
|
|
|
|
webUrl: 'http://gdk.test:3000/gitlab-org/my-project-1/-/issues/4',
|
|
|
|
__typename: 'Issue',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockingIssue4 = {
|
|
|
|
id: 'gid://gitlab/Issue/522',
|
|
|
|
iid: '3',
|
|
|
|
title: 'blocking issue title 4',
|
|
|
|
reference: 'gitlab-org/my-project-1#3',
|
|
|
|
webUrl: 'http://gdk.test:3000/gitlab-org/my-project-1/-/issues/3',
|
|
|
|
__typename: 'Issue',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockingIssuablesResponse1 = {
|
|
|
|
data: {
|
|
|
|
issuable: {
|
|
|
|
__typename: 'Issue',
|
|
|
|
id: 'gid://gitlab/Issue/527',
|
|
|
|
blockingIssuables: {
|
|
|
|
__typename: 'IssueConnection',
|
|
|
|
nodes: [mockBlockingIssue1],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockingIssuablesResponse2 = {
|
|
|
|
data: {
|
|
|
|
issuable: {
|
|
|
|
__typename: 'Issue',
|
|
|
|
id: 'gid://gitlab/Issue/527',
|
|
|
|
blockingIssuables: {
|
|
|
|
__typename: 'IssueConnection',
|
|
|
|
nodes: [mockBlockingIssue2],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockingIssuablesResponse3 = {
|
|
|
|
data: {
|
|
|
|
issuable: {
|
|
|
|
__typename: 'Issue',
|
|
|
|
id: 'gid://gitlab/Issue/527',
|
|
|
|
blockingIssuables: {
|
|
|
|
__typename: 'IssueConnection',
|
|
|
|
nodes: [mockBlockingIssue1, mockBlockingIssue2, mockBlockingIssue3, mockBlockingIssue4],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockedIssue1 = {
|
|
|
|
id: '527',
|
|
|
|
blockedByCount: 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockBlockedIssue2 = {
|
|
|
|
id: '527',
|
|
|
|
blockedByCount: 4,
|
|
|
|
webUrl: 'http://gdk.test:3000/gitlab-org/my-project-1/-/issues/0',
|
|
|
|
};
|
2021-04-13 20:10:39 -04:00
|
|
|
|
|
|
|
export const mockMoveIssueParams = {
|
|
|
|
itemId: 1,
|
|
|
|
fromListId: 'gid://gitlab/List/1',
|
|
|
|
toListId: 'gid://gitlab/List/2',
|
|
|
|
moveBeforeId: undefined,
|
|
|
|
moveAfterId: undefined,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockMoveState = {
|
|
|
|
boardLists: {
|
|
|
|
'gid://gitlab/List/1': {
|
|
|
|
listType: ListType.backlog,
|
|
|
|
},
|
|
|
|
'gid://gitlab/List/2': {
|
|
|
|
listType: ListType.closed,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
boardItems: {
|
|
|
|
[mockMoveIssueParams.itemId]: { foo: 'bar' },
|
|
|
|
},
|
|
|
|
boardItemsByListId: {
|
|
|
|
[mockMoveIssueParams.fromListId]: [mockMoveIssueParams.itemId],
|
|
|
|
[mockMoveIssueParams.toListId]: [],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mockMoveData = {
|
|
|
|
reordering: false,
|
|
|
|
shouldClone: false,
|
|
|
|
itemNotInToList: true,
|
|
|
|
originalIndex: 0,
|
|
|
|
originalIssue: { foo: 'bar' },
|
|
|
|
...mockMoveIssueParams,
|
|
|
|
};
|
2021-07-13 23:08:27 -04:00
|
|
|
|
2021-08-06 02:10:16 -04:00
|
|
|
export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [
|
2021-07-13 23:08:27 -04:00
|
|
|
{
|
|
|
|
icon: 'labels',
|
|
|
|
title: __('Label'),
|
|
|
|
type: 'label_name',
|
|
|
|
operators: [
|
|
|
|
{ value: '=', description: 'is' },
|
|
|
|
{ value: '!=', description: 'is not' },
|
|
|
|
],
|
|
|
|
token: LabelToken,
|
|
|
|
unique: false,
|
|
|
|
symbol: '~',
|
|
|
|
fetchLabels,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'pencil',
|
|
|
|
title: __('Author'),
|
|
|
|
type: 'author_username',
|
|
|
|
operators: [
|
|
|
|
{ value: '=', description: 'is' },
|
|
|
|
{ value: '!=', description: 'is not' },
|
|
|
|
],
|
|
|
|
symbol: '@',
|
|
|
|
token: AuthorToken,
|
|
|
|
unique: true,
|
|
|
|
fetchAuthors,
|
2021-08-06 02:10:16 -04:00
|
|
|
preloadedAuthors: [],
|
2021-07-13 23:08:27 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'user',
|
|
|
|
title: __('Assignee'),
|
|
|
|
type: 'assignee_username',
|
|
|
|
operators: [
|
|
|
|
{ value: '=', description: 'is' },
|
|
|
|
{ value: '!=', description: 'is not' },
|
|
|
|
],
|
|
|
|
token: AuthorToken,
|
|
|
|
unique: true,
|
|
|
|
fetchAuthors,
|
2021-08-06 02:10:16 -04:00
|
|
|
preloadedAuthors: [],
|
|
|
|
},
|
2021-08-06 23:08:35 -04:00
|
|
|
{
|
|
|
|
icon: 'issues',
|
|
|
|
title: __('Type'),
|
|
|
|
type: 'types',
|
|
|
|
operators: [{ value: '=', description: 'is' }],
|
|
|
|
token: GlFilteredSearchToken,
|
|
|
|
unique: true,
|
|
|
|
options: [
|
|
|
|
{ icon: 'issue-type-issue', value: 'ISSUE', title: 'Issue' },
|
|
|
|
{ icon: 'issue-type-incident', value: 'INCIDENT', title: 'Incident' },
|
|
|
|
],
|
|
|
|
},
|
2021-08-06 02:10:16 -04:00
|
|
|
{
|
|
|
|
icon: 'clock',
|
|
|
|
title: __('Milestone'),
|
|
|
|
symbol: '%',
|
|
|
|
type: 'milestone_title',
|
|
|
|
token: MilestoneToken,
|
|
|
|
unique: true,
|
|
|
|
defaultMilestones: [],
|
|
|
|
fetchMilestones,
|
2021-07-13 23:08:27 -04:00
|
|
|
},
|
|
|
|
];
|