summaryrefslogtreecommitdiff
path: root/spec/frontend/cycle_analytics/mock_data.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 18:25:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 18:25:58 +0000
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /spec/frontend/cycle_analytics/mock_data.js
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
downloadgitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/frontend/cycle_analytics/mock_data.js')
-rw-r--r--spec/frontend/cycle_analytics/mock_data.js175
1 files changed, 123 insertions, 52 deletions
diff --git a/spec/frontend/cycle_analytics/mock_data.js b/spec/frontend/cycle_analytics/mock_data.js
index 091b574821d..242ea1932fb 100644
--- a/spec/frontend/cycle_analytics/mock_data.js
+++ b/spec/frontend/cycle_analytics/mock_data.js
@@ -1,5 +1,11 @@
+import { DEFAULT_VALUE_STREAM } from '~/cycle_analytics/constants';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
+export const getStageByTitle = (stages, title) =>
+ stages.find((stage) => stage.title && stage.title.toLowerCase().trim() === title) || {};
+
+export const defaultStages = ['issue', 'plan', 'review', 'code', 'test', 'staging'];
+
export const summary = [
{ value: '20', title: 'New Issues' },
{ value: null, title: 'Commits' },
@@ -8,6 +14,7 @@ export const summary = [
];
const issueStage = {
+ id: 'issue',
title: 'Issue',
name: 'issue',
legend: '',
@@ -16,30 +23,34 @@ const issueStage = {
};
const planStage = {
+ id: 'plan',
title: 'Plan',
name: 'plan',
legend: '',
description: 'Time before an issue starts implementation',
- value: 'about 21 hours',
+ value: 75600,
};
const codeStage = {
+ id: 'code',
title: 'Code',
name: 'code',
legend: '',
description: 'Time until first merge request',
- value: '2 days',
+ value: 172800,
};
const testStage = {
+ id: 'test',
title: 'Test',
name: 'test',
legend: '',
description: 'Total test time for all commits/merges',
- value: 'about 5 hours',
+ value: 17550,
};
const reviewStage = {
+ id: 'review',
title: 'Review',
name: 'review',
legend: '',
@@ -48,11 +59,12 @@ const reviewStage = {
};
const stagingStage = {
+ id: 'staging',
title: 'Staging',
name: 'staging',
legend: '',
description: 'From merge request merge until deploy to production',
- value: '2 days',
+ value: 172800,
};
export const selectedStage = {
@@ -84,54 +96,6 @@ export const rawData = {
};
export const convertedData = {
- stages: [
- selectedStage,
- {
- ...planStage,
- active: false,
- isUserAllowed: true,
- emptyStageText:
- 'The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.',
- component: 'stage-plan-component',
- slug: 'plan',
- },
- {
- ...codeStage,
- active: false,
- isUserAllowed: true,
- emptyStageText:
- 'The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.',
- component: 'stage-code-component',
- slug: 'code',
- },
- {
- ...testStage,
- active: false,
- isUserAllowed: true,
- emptyStageText:
- 'The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.',
- component: 'stage-test-component',
- slug: 'test',
- },
- {
- ...reviewStage,
- active: false,
- isUserAllowed: true,
- emptyStageText:
- 'The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.',
- component: 'stage-review-component',
- slug: 'review',
- },
- {
- ...stagingStage,
- active: false,
- isUserAllowed: true,
- emptyStageText:
- 'The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.',
- component: 'stage-staging-component',
- slug: 'staging',
- },
- ],
summary: [
{ value: '20', title: 'New Issues' },
{ value: '-', title: 'Commits' },
@@ -184,3 +148,110 @@ export const rawEvents = [
export const convertedEvents = rawEvents.map((ev) =>
convertObjectPropsToCamelCase(ev, { deep: true }),
);
+
+export const pathNavIssueMetric = 172800;
+
+export const rawStageMedians = [
+ { id: 'issue', value: 172800 },
+ { id: 'plan', value: 86400 },
+ { id: 'review', value: 1036800 },
+ { id: 'code', value: 129600 },
+ { id: 'test', value: 259200 },
+ { id: 'staging', value: 388800 },
+];
+
+export const stageMedians = {
+ issue: 172800,
+ plan: 86400,
+ review: 1036800,
+ code: 129600,
+ test: 259200,
+ staging: 388800,
+};
+
+export const allowedStages = [issueStage, planStage, codeStage];
+
+export const transformedProjectStagePathData = [
+ {
+ metric: 172800,
+ selected: true,
+ stageCount: undefined,
+ icon: null,
+ id: 'issue',
+ title: 'Issue',
+ name: 'issue',
+ legend: '',
+ description: 'Time before an issue gets scheduled',
+ value: null,
+ },
+ {
+ metric: 86400,
+ selected: false,
+ stageCount: undefined,
+ icon: null,
+ id: 'plan',
+ title: 'Plan',
+ name: 'plan',
+ legend: '',
+ description: 'Time before an issue starts implementation',
+ value: 75600,
+ },
+ {
+ metric: 129600,
+ selected: false,
+ stageCount: undefined,
+ icon: null,
+ id: 'code',
+ title: 'Code',
+ name: 'code',
+ legend: '',
+ description: 'Time until first merge request',
+ value: 172800,
+ },
+];
+
+export const selectedValueStream = DEFAULT_VALUE_STREAM;
+
+export const rawValueStreamStages = [
+ {
+ title: 'Issue',
+ hidden: false,
+ legend: '',
+ description: 'Time before an issue gets scheduled',
+ id: 'issue',
+ custom: false,
+ start_event_html_description:
+ '\u003cp data-sourcepos="1:1-1:13" dir="auto"\u003eIssue created\u003c/p\u003e',
+ end_event_html_description:
+ '\u003cp data-sourcepos="1:1-1:71" dir="auto"\u003eIssue first associated with a milestone or issue first added to a board\u003c/p\u003e',
+ },
+ {
+ title: 'Plan',
+ hidden: false,
+ legend: '',
+ description: 'Time before an issue starts implementation',
+ id: 'plan',
+ custom: false,
+ start_event_html_description:
+ '\u003cp data-sourcepos="1:1-1:71" dir="auto"\u003eIssue first associated with a milestone or issue first added to a board\u003c/p\u003e',
+ end_event_html_description:
+ '\u003cp data-sourcepos="1:1-1:33" dir="auto"\u003eIssue first mentioned in a commit\u003c/p\u003e',
+ },
+ {
+ title: 'Code',
+ hidden: false,
+ legend: '',
+ description: 'Time until first merge request',
+ id: 'code',
+ custom: false,
+ start_event_html_description:
+ '\u003cp data-sourcepos="1:1-1:33" dir="auto"\u003eIssue first mentioned in a commit\u003c/p\u003e',
+ end_event_html_description:
+ '\u003cp data-sourcepos="1:1-1:21" dir="auto"\u003eMerge request created\u003c/p\u003e',
+ },
+];
+
+export const valueStreamStages = rawValueStreamStages.map((s) => ({
+ ...convertObjectPropsToCamelCase(s, { deep: true }),
+ component: `stage-${s.id}-component`,
+}));