debian-mirror-gitlab/spec/frontend/pipelines/graph/mock_data.js

693 lines
25 KiB
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import { unwrapPipelineData } from '~/pipelines/components/graph/utils';
export const mockPipelineResponse = {
data: {
project: {
__typename: 'Project',
pipeline: {
__typename: 'Pipeline',
id: 163,
iid: '22',
2021-06-08 01:23:25 +05:30
complete: true,
2021-04-29 21:17:54 +05:30
usesNeeds: true,
2021-02-22 17:27:13 +05:30
downstream: null,
upstream: null,
stages: {
__typename: 'CiStageConnection',
nodes: [
{
__typename: 'CiStage',
name: 'build',
status: {
__typename: 'DetailedStatus',
action: null,
2018-05-09 12:01:36 +05:30
},
2021-02-22 17:27:13 +05:30
groups: {
__typename: 'CiGroupConnection',
nodes: [
{
__typename: 'CiGroup',
name: 'build_a_nlfjkdnlvskfnksvjknlfdjvlvnjdkjdf_nvjkenjkrlngjeknjkl',
size: 1,
status: {
__typename: 'DetailedStatus',
label: 'passed',
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'build_a_nlfjkdnlvskfnksvjknlfdjvlvnjdkjdf_nvjkenjkrlngjeknjkl',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1482',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1482/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
},
],
},
2018-05-09 12:01:36 +05:30
},
2021-02-22 17:27:13 +05:30
{
__typename: 'CiGroup',
name: 'build_b',
size: 1,
status: {
__typename: 'DetailedStatus',
label: 'passed',
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'build_b',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1515',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1515/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
},
],
},
2018-05-09 12:01:36 +05:30
},
2021-02-22 17:27:13 +05:30
{
__typename: 'CiGroup',
name: 'build_c',
size: 1,
status: {
__typename: 'DetailedStatus',
label: 'passed',
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'build_c',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1484',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1484/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
},
],
},
},
{
__typename: 'CiGroup',
name: 'build_d',
size: 3,
status: {
__typename: 'DetailedStatus',
label: 'passed',
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'build_d 1/3',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1485',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1485/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
},
{
__typename: 'CiJob',
name: 'build_d 2/3',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1486',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1486/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
},
{
__typename: 'CiJob',
name: 'build_d 3/3',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1487',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1487/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
},
],
},
},
],
2018-05-09 12:01:36 +05:30
},
},
2021-02-22 17:27:13 +05:30
{
__typename: 'CiStage',
name: 'test',
status: {
__typename: 'DetailedStatus',
action: null,
},
groups: {
__typename: 'CiGroupConnection',
nodes: [
{
__typename: 'CiGroup',
name: 'test_a',
size: 1,
status: {
__typename: 'DetailedStatus',
label: 'passed',
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'test_a',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1514',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1514/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_c',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_b',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name:
'build_a_nlfjkdnlvskfnksvjknlfdjvlvnjdkjdf_nvjkenjkrlngjeknjkl',
},
],
},
},
],
},
},
{
__typename: 'CiGroup',
name: 'test_b',
size: 2,
status: {
__typename: 'DetailedStatus',
label: 'passed',
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'test_b 1/2',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1489',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1489/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_d 3/3',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_d 2/3',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_d 1/3',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_b',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name:
'build_a_nlfjkdnlvskfnksvjknlfdjvlvnjdkjdf_nvjkenjkrlngjeknjkl',
},
],
},
},
{
__typename: 'CiJob',
name: 'test_b 2/2',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/abcd-dag/-/jobs/1490',
group: 'success',
action: {
__typename: 'StatusAction',
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/abcd-dag/-/jobs/1490/retry',
title: 'Retry',
},
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_d 3/3',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_d 2/3',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_d 1/3',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_b',
},
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name:
'build_a_nlfjkdnlvskfnksvjknlfdjvlvnjdkjdf_nvjkenjkrlngjeknjkl',
},
],
},
},
],
},
},
{
__typename: 'CiGroup',
name: 'test_c',
size: 1,
status: {
__typename: 'DetailedStatus',
label: null,
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'test_c',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: null,
hasDetails: true,
detailsPath: '/root/kinder-pipe/-/pipelines/154',
group: 'success',
action: null,
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-04-29 21:17:54 +05:30
nodes: [],
2021-02-22 17:27:13 +05:30
},
},
],
},
},
{
__typename: 'CiGroup',
name: 'test_d',
size: 1,
status: {
__typename: 'DetailedStatus',
label: null,
group: 'success',
icon: 'status_success',
},
jobs: {
__typename: 'CiJobConnection',
nodes: [
{
__typename: 'CiJob',
name: 'test_d',
scheduledAt: null,
status: {
__typename: 'DetailedStatus',
icon: 'status_success',
tooltip: null,
hasDetails: true,
detailsPath: '/root/abcd-dag/-/pipelines/153',
group: 'success',
action: null,
},
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeed',
2021-02-22 17:27:13 +05:30
name: 'build_b',
},
],
},
},
],
},
2018-05-09 12:01:36 +05:30
},
2021-02-22 17:27:13 +05:30
],
2018-05-09 12:01:36 +05:30
},
2021-02-22 17:27:13 +05:30
},
],
2017-08-17 22:00:37 +05:30
},
},
2021-02-22 17:27:13 +05:30
},
2017-08-17 22:00:37 +05:30
},
2021-02-22 17:27:13 +05:30
};
export const downstream = {
nodes: [
{
id: 175,
iid: '31',
path: '/root/elemenohpee/-/pipelines/175',
status: {
group: 'success',
label: 'passed',
icon: 'status_success',
__typename: 'DetailedStatus',
},
sourceJob: {
name: 'test_c',
__typename: 'CiJob',
},
project: {
id: 'gid://gitlab/Project/25',
name: 'elemenohpee',
fullPath: 'root/elemenohpee',
__typename: 'Project',
},
__typename: 'Pipeline',
multiproject: true,
},
{
id: 181,
iid: '27',
path: '/root/abcd-dag/-/pipelines/181',
status: {
group: 'success',
label: 'passed',
icon: 'status_success',
__typename: 'DetailedStatus',
},
sourceJob: {
name: 'test_d',
__typename: 'CiJob',
},
project: {
id: 'gid://gitlab/Project/23',
name: 'abcd-dag',
fullPath: 'root/abcd-dag',
__typename: 'Project',
},
__typename: 'Pipeline',
multiproject: false,
},
],
};
export const upstream = {
id: 161,
iid: '24',
path: '/root/abcd-dag/-/pipelines/161',
status: {
group: 'success',
label: 'passed',
icon: 'status_success',
__typename: 'DetailedStatus',
2017-08-17 22:00:37 +05:30
},
2021-02-22 17:27:13 +05:30
sourceJob: null,
project: {
id: 'gid://gitlab/Project/23',
name: 'abcd-dag',
fullPath: 'root/abcd-dag',
__typename: 'Project',
2017-08-17 22:00:37 +05:30
},
2021-02-22 17:27:13 +05:30
__typename: 'Pipeline',
multiproject: true,
};
export const wrappedPipelineReturn = {
data: {
project: {
2021-03-08 18:12:59 +05:30
__typename: 'Project',
2021-02-22 17:27:13 +05:30
pipeline: {
2021-03-08 18:12:59 +05:30
__typename: 'Pipeline',
2021-02-22 17:27:13 +05:30
id: 'gid://gitlab/Ci::Pipeline/175',
iid: '38',
2021-06-08 01:23:25 +05:30
complete: true,
2021-04-29 21:17:54 +05:30
usesNeeds: true,
2021-02-22 17:27:13 +05:30
downstream: {
2021-03-08 18:12:59 +05:30
__typename: 'PipelineConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
upstream: {
id: 'gid://gitlab/Ci::Pipeline/174',
iid: '37',
path: '/root/elemenohpee/-/pipelines/174',
2021-03-08 18:12:59 +05:30
__typename: 'Pipeline',
2021-02-22 17:27:13 +05:30
status: {
2021-03-08 18:12:59 +05:30
__typename: 'DetailedStatus',
2021-02-22 17:27:13 +05:30
group: 'success',
label: 'passed',
icon: 'status_success',
},
sourceJob: {
name: 'test_c',
2021-03-08 18:12:59 +05:30
__typename: 'CiJob',
2021-02-22 17:27:13 +05:30
},
project: {
id: 'gid://gitlab/Project/25',
name: 'elemenohpee',
fullPath: 'root/elemenohpee',
2021-03-08 18:12:59 +05:30
__typename: 'Project',
2021-02-22 17:27:13 +05:30
},
},
stages: {
2021-03-08 18:12:59 +05:30
__typename: 'CiStageConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
name: 'build',
2021-03-08 18:12:59 +05:30
__typename: 'CiStage',
2021-02-22 17:27:13 +05:30
status: {
action: null,
2021-03-08 18:12:59 +05:30
__typename: 'DetailedStatus',
2021-02-22 17:27:13 +05:30
},
groups: {
2021-03-08 18:12:59 +05:30
__typename: 'CiGroupConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
2021-03-08 18:12:59 +05:30
__typename: 'CiGroup',
2021-02-22 17:27:13 +05:30
status: {
2021-03-08 18:12:59 +05:30
__typename: 'DetailedStatus',
2021-02-22 17:27:13 +05:30
label: 'passed',
group: 'success',
icon: 'status_success',
},
name: 'build_n',
size: 1,
jobs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiJobConnection',
2021-02-22 17:27:13 +05:30
nodes: [
{
2021-03-08 18:12:59 +05:30
__typename: 'CiJob',
2021-02-22 17:27:13 +05:30
name: 'build_n',
scheduledAt: null,
needs: {
2021-03-08 18:12:59 +05:30
__typename: 'CiBuildNeedConnection',
2021-02-22 17:27:13 +05:30
nodes: [],
},
status: {
2021-03-08 18:12:59 +05:30
__typename: 'DetailedStatus',
2021-02-22 17:27:13 +05:30
icon: 'status_success',
tooltip: 'passed',
hasDetails: true,
detailsPath: '/root/elemenohpee/-/jobs/1662',
group: 'success',
action: {
2021-03-08 18:12:59 +05:30
__typename: 'StatusAction',
2021-02-22 17:27:13 +05:30
buttonTitle: 'Retry this job',
icon: 'retry',
path: '/root/elemenohpee/-/jobs/1662/retry',
title: 'Retry',
},
},
},
],
},
},
],
},
},
],
},
},
2017-08-17 22:00:37 +05:30
},
},
2021-02-22 17:27:13 +05:30
};
export const generateResponse = (raw, mockPath) => unwrapPipelineData(mockPath, raw.data);
2021-03-08 18:12:59 +05:30
export const pipelineWithUpstreamDownstream = (base) => {
2021-02-22 17:27:13 +05:30
const pip = { ...base };
pip.data.project.pipeline.downstream = downstream;
pip.data.project.pipeline.upstream = upstream;
return generateResponse(pip, 'root/abcd-dag');
2017-08-17 22:00:37 +05:30
};
2021-06-08 01:23:25 +05:30
export const mapCallouts = (callouts) =>
callouts.map((callout) => {
return { featureName: callout, __typename: 'UserCallout' };
});
export const mockCalloutsResponse = (mappedCallouts) => ({
data: {
currentUser: {
id: 45,
__typename: 'User',
callouts: {
id: 5,
__typename: 'UserCalloutConnection',
nodes: mappedCallouts,
},
},
},
});