debian-mirror-gitlab/spec/frontend/issues/show/components/incidents/mock_data.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

201 lines
4.4 KiB
JavaScript
Raw Normal View History

2023-04-23 21:23:45 +05:30
export const mockTimelineEventTags = {
nodes: [
{
id: 'gid://gitlab/IncidentManagement::TimelineEvent/132',
name: 'Start time',
},
{
id: 'gid://gitlab/IncidentManagement::TimelineEvent/132',
name: 'End time',
},
],
};
2022-07-23 23:45:48 +05:30
export const mockEvents = [
{
action: 'comment',
author: {
__typename: 'UserCore',
id: 'gid://gitlab/User/1',
name: 'Administrator',
username: 'root',
},
createdAt: '2022-03-22T15:59:08Z',
id: 'gid://gitlab/IncidentManagement::TimelineEvent/132',
note: 'Dummy event 1',
noteHtml: '<p>Dummy event 1</p>',
occurredAt: '2022-03-22T15:59:00Z',
updatedAt: '2022-03-22T15:59:08Z',
2023-03-04 22:38:38 +05:30
timelineEventTags: {
nodes: [],
},
2022-07-23 23:45:48 +05:30
__typename: 'TimelineEventType',
},
{
action: 'comment',
author: {
__typename: 'UserCore',
id: 'gid://gitlab/User/1',
name: 'Administrator',
username: 'root',
},
createdAt: '2022-03-23T14:57:08Z',
id: 'gid://gitlab/IncidentManagement::TimelineEvent/131',
note: 'Dummy event 2',
noteHtml: '<p>Dummy event 2</p>',
occurredAt: '2022-03-23T14:57:00Z',
updatedAt: '2022-03-23T14:57:08Z',
2023-04-23 21:23:45 +05:30
timelineEventTags: mockTimelineEventTags,
2022-07-23 23:45:48 +05:30
__typename: 'TimelineEventType',
},
{
action: 'comment',
author: {
__typename: 'UserCore',
id: 'gid://gitlab/User/1',
name: 'Administrator',
username: 'root',
},
createdAt: '2022-03-23T15:59:08Z',
id: 'gid://gitlab/IncidentManagement::TimelineEvent/132',
note: 'Dummy event 3',
noteHtml: '<p>Dummy event 3</p>',
occurredAt: '2022-03-23T15:59:00Z',
updatedAt: '2022-03-23T15:59:08Z',
2023-03-04 22:38:38 +05:30
timelineEventTags: {
nodes: [],
},
2022-07-23 23:45:48 +05:30
__typename: 'TimelineEventType',
},
];
2022-10-11 01:57:18 +05:30
const mockUpdatedEvent = {
id: 'gid://gitlab/IncidentManagement::TimelineEvent/8',
note: 'another one23',
noteHtml: '<p>another one23</p>',
action: 'comment',
occurredAt: '2022-07-01T12:47:00Z',
createdAt: '2022-07-20T12:47:40Z',
2023-03-17 16:20:25 +05:30
timelineEventTags: [],
2022-10-11 01:57:18 +05:30
};
2022-07-23 23:45:48 +05:30
export const timelineEventsQueryListResponse = {
data: {
project: {
id: 'gid://gitlab/Project/8',
incidentManagementTimelineEvents: {
nodes: mockEvents,
},
},
},
};
export const timelineEventsQueryEmptyResponse = {
data: {
project: {
id: 'gid://gitlab/Project/8',
incidentManagementTimelineEvents: {
nodes: [],
},
},
},
};
2022-08-13 15:12:31 +05:30
export const timelineEventsCreateEventResponse = {
2022-08-27 11:52:29 +05:30
data: {
timelineEventCreate: {
timelineEvent: {
...mockEvents[0],
},
errors: [],
},
2022-08-13 15:12:31 +05:30
},
};
export const timelineEventsCreateEventError = {
data: {
timelineEventCreate: {
timelineEvent: {
...mockEvents[0],
},
errors: ['Create error'],
},
},
};
2022-10-11 01:57:18 +05:30
export const timelineEventsEditEventResponse = {
data: {
timelineEventUpdate: {
timelineEvent: {
...mockUpdatedEvent,
},
errors: [],
__typename: 'TimelineEventUpdatePayload',
},
},
};
export const timelineEventsEditEventError = {
data: {
timelineEventUpdate: {
timelineEvent: {
...mockUpdatedEvent,
},
errors: ['Create error'],
},
},
};
2022-08-13 15:12:31 +05:30
const timelineEventDeleteData = (errors = []) => {
return {
data: {
timelineEventDestroy: {
timelineEvent: { ...mockEvents[0] },
errors,
},
},
};
};
export const timelineEventsDeleteEventResponse = timelineEventDeleteData();
export const timelineEventsDeleteEventError = timelineEventDeleteData(['Item does not exist']);
2022-08-27 11:52:29 +05:30
export const mockGetTimelineData = {
project: {
id: 'gid://gitlab/Project/19',
incidentManagementTimelineEvents: {
nodes: [
{
id: 'gid://gitlab/IncidentManagement::TimelineEvent/8',
note: 'another one2',
noteHtml: '<p>another one2</p>',
action: 'comment',
occurredAt: '2022-07-01T12:47:00Z',
createdAt: '2022-07-20T12:47:40Z',
2023-03-04 22:38:38 +05:30
timelineEventTags: {
nodes: [],
},
2022-08-27 11:52:29 +05:30
},
],
},
},
};
2022-10-11 01:57:18 +05:30
export const fakeDate = '2020-07-08T00:00:00.000Z';
export const mockInputData = {
note: 'test',
occurredAt: '2020-08-10T02:30:00.000Z',
};
2023-04-23 21:23:45 +05:30
const { id, note, occurredAt, timelineEventTags } = mockEvents[0];
export const fakeEventData = { id, note, occurredAt, timelineEventTags };
export const fakeEventSaveData = {
id,
note,
occurredAt,
timelineEventTagNames: timelineEventTags,
...mockInputData,
};