Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
97dad2e3
Commit
97dad2e3
authored
Oct 18, 2021
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import JSON fixtures in cycle_analytics mock_data
parent
5d85c6d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
53 deletions
+76
-53
ee/spec/frontend/analytics/cycle_analytics/mock_data.js
ee/spec/frontend/analytics/cycle_analytics/mock_data.js
+58
-33
spec/frontend/cycle_analytics/mock_data.js
spec/frontend/cycle_analytics/mock_data.js
+18
-20
No files found.
ee/spec/frontend/analytics/cycle_analytics/mock_data.js
View file @
97dad2e3
/* eslint-disable import/no-deprecated */
import
{
uniq
}
from
'
lodash
'
;
import
valueStreamAnalyticsStages
from
'
test_fixtures/analytics/value_stream_analytics/stages.json
'
;
import
valueStreamAnalyticsSummary
from
'
test_fixtures/analytics/metrics/value_stream_analytics/summary.json
'
;
import
valueStreamAnalyticsTimeSummary
from
'
test_fixtures/analytics/metrics/value_stream_analytics/time_summary.json
'
;
import
tasksByType
from
'
test_fixtures/analytics/charts/type_of_work/tasks_by_type.json
'
;
import
apiGroupLabels
from
'
test_fixtures/api/group_labels.json
'
;
import
issueStageFixtures
from
'
test_fixtures/analytics/value_stream_analytics/stages/issue/records.json
'
;
import
planStageFixtures
from
'
test_fixtures/analytics/value_stream_analytics/stages/plan/records.json
'
;
import
reviewStageFixtures
from
'
test_fixtures/analytics/value_stream_analytics/stages/review/records.json
'
;
import
codeStageFixtures
from
'
test_fixtures/analytics/value_stream_analytics/stages/code/records.json
'
;
import
testStageFixtures
from
'
test_fixtures/analytics/value_stream_analytics/stages/test/records.json
'
;
import
stagingStageFixtures
from
'
test_fixtures/analytics/value_stream_analytics/stages/staging/records.json
'
;
import
issueCountFixture
from
'
test_fixtures/analytics/value_stream_analytics/stages/issue/count.json
'
;
import
planCountFixture
from
'
test_fixtures/analytics/value_stream_analytics/stages/plan/count.json
'
;
import
reviewCountFixture
from
'
test_fixtures/analytics/value_stream_analytics/stages/review/count.json
'
;
import
codeCountFixture
from
'
test_fixtures/analytics/value_stream_analytics/stages/code/count.json
'
;
import
testCountFixture
from
'
test_fixtures/analytics/value_stream_analytics/stages/test/count.json
'
;
import
stagingCountFixture
from
'
test_fixtures/analytics/value_stream_analytics/stages/staging/count.json
'
;
import
{
TASKS_BY_TYPE_SUBJECT_ISSUE
,
OVERVIEW_STAGE_CONFIG
,
...
...
@@ -12,10 +29,8 @@ import {
getTasksByTypeData
,
transformRawTasksByTypeData
,
}
from
'
ee/analytics/cycle_analytics/utils
'
;
import
{
getJSONFixture
}
from
'
helpers/fixtures
'
;
import
{
getStageByTitle
,
defaultStages
,
rawStageMedians
,
createdBefore
,
createdAfter
,
...
...
@@ -26,16 +41,6 @@ import { transformStagesForPathNavigation, formatMedianValues } from '~/cycle_an
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
getDatesInRange
}
from
'
~/lib/utils/datetime_utility
'
;
const
fixtureEndpoints
=
{
customizableCycleAnalyticsStagesAndEvents
:
'
analytics/value_stream_analytics/stages.json
'
,
// customizable stages and events endpoint
stageEvents
:
(
stage
)
=>
`analytics/value_stream_analytics/stages/
${
stage
}
/records.json`
,
stageMedian
:
(
stage
)
=>
`analytics/value_stream_analytics/stages/
${
stage
}
/median.json`
,
stageCount
:
(
stage
)
=>
`analytics/value_stream_analytics/stages/
${
stage
}
/count.json`
,
recentActivityData
:
'
analytics/metrics/value_stream_analytics/summary.json
'
,
timeMetricsData
:
'
analytics/metrics/value_stream_analytics/time_summary.json
'
,
groupLabels
:
'
api/group_labels.json
'
,
};
export
const
endpoints
=
{
groupLabels
:
/groups
\/[
A-Z|a-z|
\d
|
\-
|_
]
+
\/
-
\/
labels.json/
,
recentActivityData
:
/analytics
\/
value_stream_analytics
\/
summary/
,
...
...
@@ -55,16 +60,13 @@ export const valueStreams = [
{
id
:
2
,
name
:
'
Value stream 2
'
},
];
export
const
groupLabels
=
getJSONFixture
(
fixtureEndpoints
.
groupLabels
).
map
(
convertObjectPropsToCamelCase
,
);
export
const
groupLabels
=
apiGroupLabels
.
map
(
convertObjectPropsToCamelCase
);
export
const
recentActivityData
=
getJSONFixture
(
fixtureEndpoints
.
recentActivityData
);
export
const
timeMetricsData
=
getJSONFixture
(
fixtureEndpoints
.
timeMetricsData
);
export
const
recentActivityData
=
valueStreamAnalyticsSummary
;
export
const
customizableStagesAndEvents
=
getJSONFixture
(
fixtureEndpoints
.
customizableCycleAnalyticsStagesAndEvents
,
)
;
export
const
timeMetricsData
=
valueStreamAnalyticsTimeSummary
;
export
const
customizableStagesAndEvents
=
valueStreamAnalyticsStages
;
const
dummyState
=
{};
...
...
@@ -104,13 +106,14 @@ export const stagingStage = getStageByTitle(dummyState.stages, 'staging');
export
const
allowedStages
=
[
issueStage
,
planStage
,
codeStage
];
const
stageFixtures
=
defaultStages
.
reduce
((
acc
,
stage
)
=>
{
const
events
=
getJSONFixture
(
fixtureEndpoints
.
stageEvents
(
stage
));
return
{
...
acc
,
[
stage
]:
events
,
};
},
{});
const
stageFixtures
=
{
issue
:
issueStageFixtures
,
plan
:
planStageFixtures
,
review
:
reviewStageFixtures
,
code
:
codeStageFixtures
,
test
:
testStageFixtures
,
staging
:
stagingStageFixtures
,
};
const
getStageId
=
(
name
)
=>
{
const
{
id
}
=
getStageByTitle
(
dummyState
.
stages
,
name
);
...
...
@@ -124,10 +127,32 @@ export const stageMediansWithNumericIds = formatMedianValues(
}),
);
export
const
rawStageCounts
=
defaultStages
.
map
((
id
)
=>
({
id
,
...
getJSONFixture
(
fixtureEndpoints
.
stageCount
(
id
)),
}));
export
const
rawStageCounts
=
[
{
id
:
'
issue
'
,
...
issueCountFixture
,
},
{
id
:
'
plan
'
,
...
planCountFixture
,
},
{
id
:
'
review
'
,
...
reviewCountFixture
,
},
{
id
:
'
code
'
,
...
codeCountFixture
,
},
{
id
:
'
test
'
,
...
testCountFixture
,
},
{
id
:
'
staging
'
,
...
stagingCountFixture
,
},
];
export
const
stageCounts
=
rawStageCounts
.
reduce
((
acc
,
{
id
:
name
,
count
})
=>
{
const
id
=
getStageId
(
name
);
...
...
spec/frontend/cycle_analytics/mock_data.js
View file @
97dad2e3
/* eslint-disable import/no-deprecated */
import
valueStreamAnalyticsStages
from
'
test_fixtures/projects/analytics/value_stream_analytics/stages.json
'
;
import
valueStreamAnalyticsSummary
from
'
test_fixtures/projects/analytics/value_stream_analytics/summary.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
'
;
import
{
getJSONFixture
}
from
'
helpers/fixtures
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
DEFAULT_VALUE_STREAM
,
...
...
@@ -20,28 +26,20 @@ export const deepCamelCase = (obj) => convertObjectPropsToCamelCase(obj, { deep:
export
const
getStageByTitle
=
(
stages
,
title
)
=>
stages
.
find
((
stage
)
=>
stage
.
title
&&
stage
.
title
.
toLowerCase
().
trim
()
===
title
)
||
{};
const
fixtureEndpoints
=
{
customizableCycleAnalyticsStagesAndEvents
:
'
projects/analytics/value_stream_analytics/stages.json
'
,
stageEvents
:
(
stage
)
=>
`projects/analytics/value_stream_analytics/events/
${
stage
}
.json`
,
metricsData
:
'
projects/analytics/value_stream_analytics/summary.json
'
,
};
export
const
metricsData
=
getJSONFixture
(
fixtureEndpoints
.
metricsData
);
export
const
metricsData
=
valueStreamAnalyticsSummary
;
export
const
customizableStagesAndEvents
=
getJSONFixture
(
fixtureEndpoints
.
customizableCycleAnalyticsStagesAndEvents
,
);
export
const
customizableStagesAndEvents
=
valueStreamAnalyticsStages
;
export
const
defaultStages
=
[
'
issue
'
,
'
plan
'
,
'
review
'
,
'
code
'
,
'
test
'
,
'
staging
'
];
const
stageFixtures
=
defaultStages
.
reduce
((
acc
,
stage
)
=>
{
const
events
=
getJSONFixture
(
fixtureEndpoints
.
stageEvents
(
stage
));
return
{
...
acc
,
[
stage
]:
events
,
};
},
{});
const
stageFixtures
=
{
issue
:
issueStageFixtures
,
plan
:
planStageFixtures
,
review
:
reviewStageFixtures
,
code
:
codeStageFixtures
,
test
:
testStageFixtures
,
staging
:
stagingStageFixtures
,
};
export
const
summary
=
[
{
value
:
'
20
'
,
title
:
'
New Issues
'
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment