2021-12-11 22:18:48 +05:30
import valueStreamAnalyticsStages from 'test_fixtures/projects/analytics/value_stream_analytics/stages.json' ;
import issueStageFixtures from 'test_fixtures/projects/analytics/value_stream_analytics/events/issue.json' ;
import planStageFixtures from 'test_fixtures/projects/analytics/value_stream_analytics/events/plan.json' ;
import reviewStageFixtures from 'test_fixtures/projects/analytics/value_stream_analytics/events/review.json' ;
import codeStageFixtures from 'test_fixtures/projects/analytics/value_stream_analytics/events/code.json' ;
import testStageFixtures from 'test_fixtures/projects/analytics/value_stream_analytics/events/test.json' ;
import stagingStageFixtures from 'test_fixtures/projects/analytics/value_stream_analytics/events/staging.json' ;
2021-11-18 22:05:49 +05:30
2021-09-30 23:02:18 +05:30
import { TEST _HOST } from 'helpers/test_constants' ;
2021-11-18 22:05:49 +05:30
import {
DEFAULT _VALUE _STREAM ,
PAGINATION _TYPE ,
PAGINATION _SORT _DIRECTION _DESC ,
PAGINATION _SORT _FIELD _END _EVENT ,
2023-03-04 22:38:38 +05:30
} from '~/analytics/cycle_analytics/constants' ;
2021-06-08 01:23:25 +05:30
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils' ;
2021-09-30 23:02:18 +05:30
import { getDateInPast } from '~/lib/utils/datetime_utility' ;
2021-12-11 22:18:48 +05:30
const DEFAULT _DAYS _IN _PAST = 30 ;
2021-09-30 23:02:18 +05:30
export const createdBefore = new Date ( 2019 , 0 , 14 ) ;
export const createdAfter = getDateInPast ( createdBefore , DEFAULT _DAYS _IN _PAST ) ;
2021-06-08 01:23:25 +05:30
2021-10-27 15:23:28 +05:30
export const deepCamelCase = ( obj ) => convertObjectPropsToCamelCase ( obj , { deep : true } ) ;
2021-09-04 01:27:46 +05:30
export const getStageByTitle = ( stages , title ) =>
stages . find ( ( stage ) => stage . title && stage . title . toLowerCase ( ) . trim ( ) === title ) || { } ;
export const defaultStages = [ 'issue' , 'plan' , 'review' , 'code' , 'test' , 'staging' ] ;
2021-12-11 22:18:48 +05:30
const stageFixtures = {
issue : issueStageFixtures ,
plan : planStageFixtures ,
review : reviewStageFixtures ,
code : codeStageFixtures ,
test : testStageFixtures ,
staging : stagingStageFixtures ,
} ;
2021-10-27 15:23:28 +05:30
2021-06-08 01:23:25 +05:30
export const summary = [
{ value : '20' , title : 'New Issues' } ,
{ value : null , title : 'Commits' } ,
{ value : null , title : 'Deploys' } ,
2022-07-16 23:28:13 +05:30
{ value : null , title : 'Deployment Frequency' , unit : '/day' } ,
2021-06-08 01:23:25 +05:30
] ;
2021-10-27 15:23:28 +05:30
export const issueStage = {
2021-09-04 01:27:46 +05:30
id : 'issue' ,
2021-06-08 01:23:25 +05:30
title : 'Issue' ,
name : 'issue' ,
legend : '' ,
description : 'Time before an issue gets scheduled' ,
value : null ,
} ;
2021-10-27 15:23:28 +05:30
export const planStage = {
2021-09-04 01:27:46 +05:30
id : 'plan' ,
2021-06-08 01:23:25 +05:30
title : 'Plan' ,
name : 'plan' ,
legend : '' ,
description : 'Time before an issue starts implementation' ,
2021-09-04 01:27:46 +05:30
value : 75600 ,
2021-06-08 01:23:25 +05:30
} ;
2021-10-27 15:23:28 +05:30
export const codeStage = {
2021-09-04 01:27:46 +05:30
id : 'code' ,
2021-06-08 01:23:25 +05:30
title : 'Code' ,
name : 'code' ,
legend : '' ,
description : 'Time until first merge request' ,
2021-09-04 01:27:46 +05:30
value : 172800 ,
2021-06-08 01:23:25 +05:30
} ;
2021-10-27 15:23:28 +05:30
export const testStage = {
2021-09-04 01:27:46 +05:30
id : 'test' ,
2021-06-08 01:23:25 +05:30
title : 'Test' ,
name : 'test' ,
legend : '' ,
description : 'Total test time for all commits/merges' ,
2021-09-04 01:27:46 +05:30
value : 17550 ,
2021-06-08 01:23:25 +05:30
} ;
2021-10-27 15:23:28 +05:30
export const reviewStage = {
2021-09-04 01:27:46 +05:30
id : 'review' ,
2021-06-08 01:23:25 +05:30
title : 'Review' ,
name : 'review' ,
legend : '' ,
description : 'Time between merge request creation and merge/close' ,
value : null ,
} ;
2021-10-27 15:23:28 +05:30
export const stagingStage = {
2021-09-04 01:27:46 +05:30
id : 'staging' ,
2021-06-08 01:23:25 +05:30
title : 'Staging' ,
name : 'staging' ,
legend : '' ,
description : 'From merge request merge until deploy to production' ,
2021-09-04 01:27:46 +05:30
value : 172800 ,
2021-06-08 01:23:25 +05:30
} ;
export const selectedStage = {
... issueStage ,
value : null ,
active : false ,
emptyStageText :
'The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.' ,
2021-10-27 15:23:28 +05:30
2021-06-08 01:23:25 +05:30
slug : 'issue' ,
} ;
export const convertedData = {
summary : [
{ value : '20' , title : 'New Issues' } ,
{ value : '-' , title : 'Commits' } ,
{ value : '-' , title : 'Deploys' } ,
2022-07-16 23:28:13 +05:30
{ value : '-' , title : 'Deployment Frequency' , unit : '/day' } ,
2021-06-08 01:23:25 +05:30
] ,
} ;
2021-10-27 15:23:28 +05:30
export const rawIssueEvents = stageFixtures . issue ;
export const issueEvents = deepCamelCase ( rawIssueEvents ) ;
export const reviewEvents = deepCamelCase ( stageFixtures . review ) ;
2021-09-04 01:27:46 +05:30
export const pathNavIssueMetric = 172800 ;
2021-10-27 15:23:28 +05:30
export const rawStageCounts = [
{ id : 'issue' , count : 6 } ,
{ id : 'plan' , count : 6 } ,
{ id : 'code' , count : 1 } ,
{ id : 'test' , count : 5 } ,
{ id : 'review' , count : 12 } ,
{ id : 'staging' , count : 3 } ,
] ;
export const stageCounts = {
code : 1 ,
issue : 6 ,
plan : 6 ,
review : 12 ,
staging : 3 ,
test : 5 ,
} ;
2021-09-04 01:27:46 +05:30
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 ,
} ;
2021-09-30 23:02:18 +05:30
export const formattedStageMedians = {
issue : '2d' ,
plan : '1d' ,
review : '1w' ,
code : '1d' ,
test : '3d' ,
staging : '4d' ,
} ;
2021-09-04 01:27:46 +05:30
export const allowedStages = [ issueStage , planStage , codeStage ] ;
export const transformedProjectStagePathData = [
{
metric : 172800 ,
selected : true ,
2021-10-27 15:23:28 +05:30
stageCount : 6 ,
2021-09-04 01:27:46 +05:30
icon : null ,
id : 'issue' ,
title : 'Issue' ,
name : 'issue' ,
legend : '' ,
description : 'Time before an issue gets scheduled' ,
value : null ,
} ,
{
metric : 86400 ,
selected : false ,
2021-10-27 15:23:28 +05:30
stageCount : 6 ,
2021-09-04 01:27:46 +05:30
icon : null ,
id : 'plan' ,
title : 'Plan' ,
name : 'plan' ,
legend : '' ,
description : 'Time before an issue starts implementation' ,
value : 75600 ,
} ,
{
metric : 129600 ,
selected : false ,
2021-10-27 15:23:28 +05:30
stageCount : 1 ,
2021-09-04 01:27:46 +05:30
icon : null ,
id : 'code' ,
title : 'Code' ,
name : 'code' ,
legend : '' ,
description : 'Time until first merge request' ,
value : 172800 ,
} ,
] ;
export const selectedValueStream = DEFAULT _VALUE _STREAM ;
2021-09-30 23:02:18 +05:30
export const group = {
id : 1 ,
name : 'foo' ,
path : 'foo' ,
2023-06-20 00:43:36 +05:30
full _path : 'groups/foo' ,
2021-09-30 23:02:18 +05:30
avatar _url : ` ${ TEST _HOST } /images/home/nasa.svg ` ,
} ;
export const currentGroup = convertObjectPropsToCamelCase ( group , { deep : true } ) ;
2023-05-27 22:25:52 +05:30
export const groupNamespace = { id : currentGroup . id , fullPath : ` groups/ ${ currentGroup . path } ` } ;
export const projectNamespace = { fullPath : 'some/cool/path' } ;
2021-09-30 23:02:18 +05:30
export const selectedProjects = [
{
id : 'gid://gitlab/Project/1' ,
name : 'cool project' ,
pathWithNamespace : 'group/cool-project' ,
avatarUrl : null ,
} ,
{
id : 'gid://gitlab/Project/2' ,
name : 'another cool project' ,
pathWithNamespace : 'group/another-cool-project' ,
avatarUrl : null ,
} ,
] ;
2021-12-11 22:18:48 +05:30
export const rawValueStreamStages = valueStreamAnalyticsStages . stages ;
2021-09-04 01:27:46 +05:30
2021-10-27 15:23:28 +05:30
export const valueStreamStages = rawValueStreamStages . map ( ( s ) =>
convertObjectPropsToCamelCase ( s , { deep : true } ) ,
) ;
2021-11-18 22:05:49 +05:30
export const initialPaginationQuery = {
page : 15 ,
sort : PAGINATION _SORT _FIELD _END _EVENT ,
direction : PAGINATION _SORT _DIRECTION _DESC ,
} ;
export const initialPaginationState = {
... initialPaginationQuery ,
page : null ,
hasNextPage : false ,
} ;
export const basePaginationResult = {
pagination : PAGINATION _TYPE ,
sort : PAGINATION _SORT _FIELD _END _EVENT ,
direction : PAGINATION _SORT _DIRECTION _DESC ,
page : null ,
} ;