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
ab819597
Commit
ab819597
authored
Oct 27, 2020
by
Ezekiel Kigbo
Committed by
Kushal Pandya
Oct 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the selected value stream after create
Ensure we set the newly created value stream when the request succeeds
parent
2329d705
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
18 deletions
+28
-18
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
...ts/javascripts/analytics/cycle_analytics/store/actions.js
+5
-5
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
.../javascripts/analytics/cycle_analytics/store/mutations.js
+4
-2
ee/changelogs/unreleased/263392-update-selected-value-stream-after-deletion.yml
...ed/263392-update-selected-value-stream-after-deletion.yml
+5
-0
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
.../frontend/analytics/cycle_analytics/store/actions_spec.js
+3
-2
ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js
...rontend/analytics/cycle_analytics/store/mutations_spec.js
+11
-9
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
View file @
ab819597
...
...
@@ -336,8 +336,8 @@ export const reorderStage = ({ dispatch, getters }, initialData) => {
);
};
export
const
receiveCreateValueStreamSuccess
=
({
commit
,
dispatch
})
=>
{
commit
(
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
);
export
const
receiveCreateValueStreamSuccess
=
({
commit
,
dispatch
}
,
valueStream
=
{}
)
=>
{
commit
(
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
,
valueStream
);
return
dispatch
(
'
fetchCycleAnalyticsData
'
);
};
...
...
@@ -346,7 +346,7 @@ export const createValueStream = ({ commit, dispatch, getters }, data) => {
commit
(
types
.
REQUEST_CREATE_VALUE_STREAM
);
return
Api
.
cycleAnalyticsCreateValueStream
(
currentGroupPath
,
data
)
.
then
((
)
=>
dispatch
(
'
receiveCreateValueStreamSuccess
'
))
.
then
((
{
data
:
newValueStream
})
=>
dispatch
(
'
receiveCreateValueStreamSuccess
'
,
newValueStream
))
.
catch
(({
response
}
=
{})
=>
{
const
{
data
:
{
message
,
payload
:
{
errors
}
}
=
null
}
=
response
;
commit
(
types
.
RECEIVE_CREATE_VALUE_STREAM_ERROR
,
{
message
,
errors
});
...
...
@@ -372,8 +372,8 @@ export const fetchValueStreamData = ({ dispatch }) =>
.
then
(()
=>
dispatch
(
'
fetchStageMedianValues
'
))
.
then
(()
=>
dispatch
(
'
durationChart/fetchDurationData
'
));
export
const
setSelectedValueStream
=
({
commit
,
dispatch
},
streamId
)
=>
{
commit
(
types
.
SET_SELECTED_VALUE_STREAM
,
streamId
);
export
const
setSelectedValueStream
=
({
commit
,
dispatch
},
valueStream
)
=>
{
commit
(
types
.
SET_SELECTED_VALUE_STREAM
,
valueStream
);
return
dispatch
(
FETCH_VALUE_STREAM_DATA
);
};
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
View file @
ab819597
...
...
@@ -124,9 +124,10 @@ export default {
state
.
isCreatingValueStream
=
false
;
state
.
createValueStreamErrors
=
errors
;
},
[
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
](
state
)
{
[
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
](
state
,
valueStream
)
{
state
.
isCreatingValueStream
=
false
;
state
.
createValueStreamErrors
=
{};
state
.
selectedValueStream
=
convertObjectPropsToCamelCase
(
valueStream
);
},
[
types
.
REQUEST_DELETE_VALUE_STREAM
](
state
)
{
state
.
isDeletingValueStream
=
true
;
...
...
@@ -139,9 +140,10 @@ export default {
[
types
.
RECEIVE_DELETE_VALUE_STREAM_SUCCESS
](
state
)
{
state
.
isDeletingValueStream
=
false
;
state
.
deleteValueStreamError
=
null
;
state
.
selectedValueStream
=
null
;
},
[
types
.
SET_SELECTED_VALUE_STREAM
](
state
,
valueStream
)
{
state
.
selectedValueStream
=
valueStream
;
state
.
selectedValueStream
=
convertObjectPropsToCamelCase
(
valueStream
)
;
},
[
types
.
REQUEST_VALUE_STREAMS
](
state
)
{
state
.
isLoadingValueStreams
=
true
;
...
...
ee/changelogs/unreleased/263392-update-selected-value-stream-after-deletion.yml
0 → 100644
View file @
ab819597
---
title
:
Set selected value stream after create and delete
merge_request
:
46100
author
:
type
:
fixed
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
ab819597
...
...
@@ -884,6 +884,7 @@ describe('Cycle analytics actions', () => {
describe
(
'
createValueStream
'
,
()
=>
{
const
payload
=
{
name
:
'
cool value stream
'
};
const
createResp
=
{
id
:
'
new value stream
'
,
is_custom
:
true
,
...
payload
};
beforeEach
(()
=>
{
state
=
{
currentGroup
};
...
...
@@ -891,7 +892,7 @@ describe('Cycle analytics actions', () => {
describe
(
'
with no errors
'
,
()
=>
{
beforeEach
(()
=>
{
mock
.
onPost
(
endpoints
.
valueStreamData
).
replyOnce
(
httpStatusCodes
.
OK
,
{}
);
mock
.
onPost
(
endpoints
.
valueStreamData
).
replyOnce
(
httpStatusCodes
.
OK
,
createResp
);
});
it
(
`commits the
${
types
.
REQUEST_CREATE_VALUE_STREAM
}
and
${
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
}
actions`
,
()
=>
{
...
...
@@ -904,7 +905,7 @@ describe('Cycle analytics actions', () => {
type
:
types
.
REQUEST_CREATE_VALUE_STREAM
,
},
],
[{
type
:
'
receiveCreateValueStreamSuccess
'
}],
[{
type
:
'
receiveCreateValueStreamSuccess
'
,
payload
:
createResp
}],
);
});
});
...
...
ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js
View file @
ab819597
...
...
@@ -52,6 +52,7 @@ describe('Cycle analytics mutations', () => {
${
types
.
RECEIVE_DELETE_VALUE_STREAM_SUCCESS
}
|
${
'
isDeletingValueStream
'
}
|
${
false
}
${
types
.
REQUEST_DELETE_VALUE_STREAM
}
|
${
'
deleteValueStreamError
'
}
|
${
null
}
${
types
.
RECEIVE_DELETE_VALUE_STREAM_SUCCESS
}
|
${
'
deleteValueStreamError
'
}
|
${
null
}
${
types
.
RECEIVE_DELETE_VALUE_STREAM_SUCCESS
}
|
${
'
selectedValueStream
'
}
|
${
null
}
${
types
.
INITIALIZE_CYCLE_ANALYTICS_SUCCESS
}
|
${
'
isLoading
'
}
|
${
false
}
`
(
'
$mutation will set $stateKey=$value
'
,
({
mutation
,
stateKey
,
value
})
=>
{
mutations
[
mutation
](
state
);
...
...
@@ -60,15 +61,16 @@ describe('Cycle analytics mutations', () => {
});
it
.
each
`
mutation | payload | expectedState
${
types
.
SET_FEATURE_FLAGS
}
|
${{
hasDurationChart
:
true
}
} |
${{
featureFlags
:
{
hasDurationChart
:
true
}
}}
${
types
.
SET_SELECTED_PROJECTS
}
|
${
selectedProjects
}
|
${{
selectedProjects
}
}
${
types
.
SET_DATE_RANGE
}
|
${{
startDate
,
endDate
}
} |
${{
startDate
,
endDate
}
}
${
types
.
SET_SELECTED_STAGE
}
|
${{
id
:
'
first-stage
'
}
} |
${{
selectedStage
:
{
id
:
'
first-stage
'
}
}}
${
types
.
RECEIVE_CREATE_VALUE_STREAM_ERROR
}
|
${{
errors
:
{
name
:
[
'
is required
'
]
}
}} |
${{
createValueStreamErrors
:
{
name
:
[
'
is required
'
]
}
, isCreatingValueStream: false }}
${
types
.
RECEIVE_DELETE_VALUE_STREAM_ERROR
}
|
${
'
Some error occurred
'
}
|
${{
deleteValueStreamError
:
'
Some error occurred
'
}
}
${
types
.
RECEIVE_VALUE_STREAMS_SUCCESS
}
|
${
valueStreams
}
|
${{
valueStreams
,
isLoadingValueStreams
:
false
}
}
${
types
.
SET_SELECTED_VALUE_STREAM
}
|
${
valueStreams
[
1
].
id
}
|
${{
selectedValueStream
:
{}
}}
mutation | payload | expectedState
${
types
.
SET_FEATURE_FLAGS
}
|
${{
hasDurationChart
:
true
}
} |
${{
featureFlags
:
{
hasDurationChart
:
true
}
}}
${
types
.
SET_SELECTED_PROJECTS
}
|
${
selectedProjects
}
|
${{
selectedProjects
}
}
${
types
.
SET_DATE_RANGE
}
|
${{
startDate
,
endDate
}
} |
${{
startDate
,
endDate
}
}
${
types
.
SET_SELECTED_STAGE
}
|
${{
id
:
'
first-stage
'
}
} |
${{
selectedStage
:
{
id
:
'
first-stage
'
}
}}
${
types
.
RECEIVE_CREATE_VALUE_STREAM_ERROR
}
|
${{
errors
:
{
name
:
[
'
is required
'
]
}
}} |
${{
createValueStreamErrors
:
{
name
:
[
'
is required
'
]
}
, isCreatingValueStream: false }}
${
types
.
RECEIVE_DELETE_VALUE_STREAM_ERROR
}
|
${
'
Some error occurred
'
}
|
${{
deleteValueStreamError
:
'
Some error occurred
'
}
}
${
types
.
RECEIVE_VALUE_STREAMS_SUCCESS
}
|
${
valueStreams
}
|
${{
valueStreams
,
isLoadingValueStreams
:
false
}
}
${
types
.
SET_SELECTED_VALUE_STREAM
}
|
${
valueStreams
[
1
].
id
}
|
${{
selectedValueStream
:
{}
}}
$
{
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
}
|
${
valueStreams
[
1
]}
|
${{
selectedValueStream
:
valueStreams
[
1
]
}
}
`
(
'
$mutation with payload $payload will update state with $expectedState
'
,
({
mutation
,
payload
,
expectedState
})
=>
{
...
...
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