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
652867ef
Commit
652867ef
authored
Sep 03, 2020
by
Ezekiel Kigbo
Committed by
Simon Knox
Sep 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cycle analytics method parameters
Updates method calls with 3+ params to take an object
parent
742ce87c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
47 deletions
+67
-47
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
...ts/javascripts/analytics/cycle_analytics/store/actions.js
+39
-23
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/actions.js
...cs/cycle_analytics/store/modules/custom_stages/actions.js
+5
-1
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart/actions.js
...s/cycle_analytics/store/modules/duration_chart/actions.js
+5
-5
ee/app/assets/javascripts/api.js
ee/app/assets/javascripts/api.js
+11
-11
ee/spec/frontend/api_spec.js
ee/spec/frontend/api_spec.js
+7
-7
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
View file @
652867ef
...
...
@@ -53,16 +53,16 @@ export const receiveStageDataError = ({ commit }) => {
createFlash
(
__
(
'
There was an error fetching data for the selected stage
'
));
};
export
const
fetchStageData
=
({
dispatch
,
getters
},
s
lug
)
=>
{
export
const
fetchStageData
=
({
dispatch
,
getters
},
s
tageId
)
=>
{
const
{
cycleAnalyticsRequestParams
=
{},
currentValueStreamId
,
currentGroupPath
}
=
getters
;
dispatch
(
'
requestStageData
'
);
return
Api
.
cycleAnalyticsStageEvents
(
currentGroupPath
,
currentValueStreamId
,
s
lug
,
return
Api
.
cycleAnalyticsStageEvents
(
{
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
s
tageId
,
cycleAnalyticsRequestParams
,
)
}
)
.
then
(({
data
})
=>
dispatch
(
'
receiveStageDataSuccess
'
,
data
))
.
catch
(
error
=>
dispatch
(
'
receiveStageDataError
'
,
error
));
};
...
...
@@ -77,13 +77,11 @@ export const receiveStageMedianValuesError = ({ commit }) => {
createFlash
(
__
(
'
There was an error fetching median data for stages
'
));
};
const
fetchStageMedian
=
(
currentGroupPath
,
currentValueStreamId
,
stageId
,
params
)
=>
Api
.
cycleAnalyticsStageMedian
(
currentGroupPath
,
currentValueStreamId
,
stageId
,
params
).
then
(
({
data
})
=>
({
id
:
stageId
,
...
data
,
}),
);
const
fetchStageMedian
=
({
groupId
,
valueStreamId
,
stageId
,
params
})
=>
Api
.
cycleAnalyticsStageMedian
({
groupId
,
valueStreamId
,
stageId
,
params
}).
then
(({
data
})
=>
({
id
:
stageId
,
...
data
,
}));
export
const
fetchStageMedianValues
=
({
dispatch
,
getters
})
=>
{
const
{
...
...
@@ -97,12 +95,12 @@ export const fetchStageMedianValues = ({ dispatch, getters }) => {
dispatch
(
'
requestStageMedianValues
'
);
return
Promise
.
all
(
stageIds
.
map
(
stageId
=>
fetchStageMedian
(
currentGroupPath
,
currentValueStreamId
,
fetchStageMedian
(
{
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
stageId
,
cycleAnalyticsRequestParams
,
),
}
),
),
)
.
then
(
data
=>
dispatch
(
'
receiveStageMedianValuesSuccess
'
,
data
))
...
...
@@ -182,9 +180,13 @@ export const fetchGroupStagesAndEvents = ({ dispatch, getters }) => {
dispatch
(
'
requestGroupStages
'
);
dispatch
(
'
customStages/setStageEvents
'
,
[]);
return
Api
.
cycleAnalyticsGroupStagesAndEvents
(
groupId
,
valueStreamId
,
{
start_date
:
created_after
,
project_ids
,
return
Api
.
cycleAnalyticsGroupStagesAndEvents
({
groupId
,
valueStreamId
,
data
:
{
start_date
:
created_after
,
project_ids
,
},
})
.
then
(({
data
:
{
stages
=
[],
events
=
[]
}
})
=>
{
dispatch
(
'
receiveGroupStagesSuccess
'
,
stages
);
...
...
@@ -232,7 +234,12 @@ export const updateStage = ({ dispatch, getters }, { id, ...params }) => {
dispatch
(
'
requestUpdateStage
'
);
dispatch
(
'
customStages/setSavingCustomStage
'
);
return
Api
.
cycleAnalyticsUpdateStage
(
currentGroupPath
,
currentValueStreamId
,
id
,
params
)
return
Api
.
cycleAnalyticsUpdateStage
({
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
stageId
:
id
,
data
:
params
,
})
.
then
(({
data
})
=>
dispatch
(
'
receiveUpdateStageSuccess
'
,
data
))
.
catch
(({
response
:
{
status
=
httpStatus
.
BAD_REQUEST
,
data
:
responseData
}
=
{}
})
=>
dispatch
(
'
receiveUpdateStageError
'
,
{
status
,
responseData
,
data
:
{
id
,
...
params
}
}),
...
...
@@ -255,7 +262,11 @@ export const removeStage = ({ dispatch, getters }, stageId) => {
const
{
currentGroupPath
,
currentValueStreamId
}
=
getters
;
dispatch
(
'
requestRemoveStage
'
);
return
Api
.
cycleAnalyticsRemoveStage
(
currentGroupPath
,
currentValueStreamId
,
stageId
)
return
Api
.
cycleAnalyticsRemoveStage
({
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
stageId
,
})
.
then
(()
=>
dispatch
(
'
receiveRemoveStageSuccess
'
))
.
catch
(
error
=>
dispatch
(
'
receiveRemoveStageError
'
,
error
));
};
...
...
@@ -312,7 +323,12 @@ export const reorderStage = ({ dispatch, getters }, initialData) => {
const
params
=
moveAfterId
?
{
move_after_id
:
moveAfterId
}
:
{
move_before_id
:
moveBeforeId
};
return
Api
.
cycleAnalyticsUpdateStage
(
currentGroupPath
,
currentValueStreamId
,
id
,
params
)
return
Api
.
cycleAnalyticsUpdateStage
({
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
stageId
:
id
,
data
:
params
,
})
.
then
(({
data
})
=>
dispatch
(
'
receiveReorderStageSuccess
'
,
data
))
.
catch
(({
response
:
{
status
=
httpStatus
.
BAD_REQUEST
,
data
:
responseData
}
=
{}
})
=>
dispatch
(
'
receiveReorderStageError
'
,
{
status
,
responseData
}),
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/actions.js
View file @
652867ef
...
...
@@ -71,7 +71,11 @@ export const createStage = ({ dispatch, rootGetters }, data) => {
dispatch
(
'
clearFormErrors
'
);
dispatch
(
'
setSavingCustomStage
'
);
return
Api
.
cycleAnalyticsCreateStage
(
currentGroupPath
,
currentValueStreamId
,
data
)
return
Api
.
cycleAnalyticsCreateStage
({
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
data
,
})
.
then
(
response
=>
{
const
{
status
,
data
:
responseData
}
=
response
;
return
dispatch
(
'
receiveCreateStageSuccess
'
,
{
status
,
data
:
responseData
});
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart/actions.js
View file @
652867ef
...
...
@@ -24,12 +24,12 @@ export const fetchDurationData = ({ dispatch, commit, rootGetters }) => {
activeStages
.
map
(
stage
=>
{
const
{
slug
}
=
stage
;
return
Api
.
cycleAnalyticsDurationChart
(
currentGroupPath
,
currentValueStreamId
,
slug
,
return
Api
.
cycleAnalyticsDurationChart
(
{
groupId
:
currentGroupPath
,
valueStreamId
:
currentValueStreamId
,
s
tageId
:
s
lug
,
cycleAnalyticsRequestParams
,
).
then
(({
data
})
=>
({
}
).
then
(({
data
})
=>
({
slug
,
selected
:
true
,
data
,
...
...
ee/app/assets/javascripts/api.js
View file @
652867ef
...
...
@@ -138,7 +138,7 @@ export default {
return
axios
.
get
(
url
,
{
params
});
},
cycleAnalyticsGroupStagesAndEvents
(
groupId
,
valueStreamId
,
params
=
{
})
{
cycleAnalyticsGroupStagesAndEvents
(
{
groupId
,
valueStreamId
,
params
=
{}
})
{
const
url
=
Api
.
buildUrl
(
this
.
cycleAnalyticsGroupStagesAndEventsPath
)
.
replace
(
'
:id
'
,
groupId
)
.
replace
(
'
:value_stream_id
'
,
valueStreamId
);
...
...
@@ -146,7 +146,7 @@ export default {
return
axios
.
get
(
url
,
{
params
});
},
cycleAnalyticsStageEvents
(
groupId
,
valueStreamId
,
stageId
,
params
=
{
})
{
cycleAnalyticsStageEvents
(
{
groupId
,
valueStreamId
,
stageId
,
params
=
{}
})
{
const
url
=
Api
.
buildUrl
(
this
.
cycleAnalyticsStageEventsPath
)
.
replace
(
'
:id
'
,
groupId
)
.
replace
(
'
:value_stream_id
'
,
valueStreamId
)
...
...
@@ -155,7 +155,7 @@ export default {
return
axios
.
get
(
url
,
{
params
});
},
cycleAnalyticsStageMedian
(
groupId
,
valueStreamId
,
stageId
,
params
=
{
})
{
cycleAnalyticsStageMedian
(
{
groupId
,
valueStreamId
,
stageId
,
params
=
{}
})
{
const
url
=
Api
.
buildUrl
(
this
.
cycleAnalyticsStageMedianPath
)
.
replace
(
'
:id
'
,
groupId
)
.
replace
(
'
:value_stream_id
'
,
valueStreamId
)
...
...
@@ -164,7 +164,7 @@ export default {
return
axios
.
get
(
url
,
{
params
:
{
...
params
}
});
},
cycleAnalyticsCreateStage
(
groupId
,
valueStreamId
,
data
)
{
cycleAnalyticsCreateStage
(
{
groupId
,
valueStreamId
,
data
}
)
{
const
url
=
Api
.
buildUrl
(
this
.
cycleAnalyticsGroupStagesAndEventsPath
)
.
replace
(
'
:id
'
,
groupId
)
.
replace
(
'
:value_stream_id
'
,
valueStreamId
);
...
...
@@ -182,30 +182,30 @@ export default {
return
axios
.
get
(
url
,
data
);
},
cycleAnalyticsStageUrl
(
groupId
,
valueStreamId
,
stageId
)
{
cycleAnalyticsStageUrl
(
{
groupId
,
valueStreamId
,
stageId
}
)
{
return
Api
.
buildUrl
(
this
.
cycleAnalyticsStagePath
)
.
replace
(
'
:id
'
,
groupId
)
.
replace
(
'
:value_stream_id
'
,
valueStreamId
)
.
replace
(
'
:stage_id
'
,
stageId
);
},
cycleAnalyticsUpdateStage
(
groupId
,
valueStreamId
,
stageId
,
data
)
{
const
url
=
this
.
cycleAnalyticsStageUrl
(
groupId
,
valueStreamId
,
stageId
);
cycleAnalyticsUpdateStage
(
{
groupId
,
valueStreamId
,
stageId
,
data
}
)
{
const
url
=
this
.
cycleAnalyticsStageUrl
(
{
groupId
,
valueStreamId
,
stageId
}
);
return
axios
.
put
(
url
,
data
);
},
cycleAnalyticsRemoveStage
(
groupId
,
valueStreamId
,
stageId
)
{
const
url
=
this
.
cycleAnalyticsStageUrl
(
groupId
,
valueStreamId
,
stageId
);
cycleAnalyticsRemoveStage
(
{
groupId
,
valueStreamId
,
stageId
}
)
{
const
url
=
this
.
cycleAnalyticsStageUrl
(
{
groupId
,
valueStreamId
,
stageId
}
);
return
axios
.
delete
(
url
);
},
cycleAnalyticsDurationChart
(
groupId
,
valueStreamId
,
stageSlug
,
params
=
{
})
{
cycleAnalyticsDurationChart
(
{
groupId
,
valueStreamId
,
stageId
,
params
=
{}
})
{
const
url
=
Api
.
buildUrl
(
this
.
cycleAnalyticsDurationChartPath
)
.
replace
(
'
:id
'
,
groupId
)
.
replace
(
'
:value_stream_id
'
,
valueStreamId
)
.
replace
(
'
:stage_id
'
,
stage
Slug
);
.
replace
(
'
:stage_id
'
,
stage
Id
);
return
axios
.
get
(
url
,
{
params
,
...
...
ee/spec/frontend/api_spec.js
View file @
652867ef
...
...
@@ -381,7 +381,7 @@ describe('Api', () => {
const
expectedUrl
=
valueStreamBaseUrl
({
id
:
valueStreamId
,
resource
:
'
stages
'
});
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsGroupStagesAndEvents
(
groupId
,
valueStreamId
,
params
)
Api
.
cycleAnalyticsGroupStagesAndEvents
(
{
groupId
,
valueStreamId
,
params
}
)
.
then
(
responseObj
=>
expectRequestWithCorrectParameters
(
responseObj
,
{
response
,
...
...
@@ -404,7 +404,7 @@ describe('Api', () => {
});
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsStageEvents
(
groupId
,
valueStreamId
,
stageId
,
params
)
Api
.
cycleAnalyticsStageEvents
(
{
groupId
,
valueStreamId
,
stageId
,
params
}
)
.
then
(
responseObj
=>
expectRequestWithCorrectParameters
(
responseObj
,
{
response
,
...
...
@@ -427,7 +427,7 @@ describe('Api', () => {
});
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsStageMedian
(
groupId
,
valueStreamId
,
stageId
,
params
)
Api
.
cycleAnalyticsStageMedian
(
{
groupId
,
valueStreamId
,
stageId
,
params
}
)
.
then
(
responseObj
=>
expectRequestWithCorrectParameters
(
responseObj
,
{
response
,
...
...
@@ -456,7 +456,7 @@ describe('Api', () => {
});
mock
.
onPost
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsCreateStage
(
groupId
,
valueStreamId
,
customStage
)
Api
.
cycleAnalyticsCreateStage
(
{
groupId
,
valueStreamId
,
data
:
customStage
}
)
.
then
(({
data
,
config
:
{
data
:
reqData
,
url
}
})
=>
{
expect
(
data
).
toEqual
(
response
);
expect
(
JSON
.
parse
(
reqData
)).
toMatchObject
(
customStage
);
...
...
@@ -478,7 +478,7 @@ describe('Api', () => {
});
mock
.
onPut
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsUpdateStage
(
groupId
,
valueStreamId
,
stageId
,
stageData
)
Api
.
cycleAnalyticsUpdateStage
(
{
groupId
,
valueStreamId
,
stageId
,
data
:
stageData
}
)
.
then
(({
data
,
config
:
{
data
:
reqData
,
url
}
})
=>
{
expect
(
data
).
toEqual
(
response
);
expect
(
JSON
.
parse
(
reqData
)).
toMatchObject
(
stageData
);
...
...
@@ -498,7 +498,7 @@ describe('Api', () => {
});
mock
.
onDelete
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsRemoveStage
(
groupId
,
valueStreamId
,
stageId
)
Api
.
cycleAnalyticsRemoveStage
(
{
groupId
,
valueStreamId
,
stageId
}
)
.
then
(({
data
,
config
:
{
url
}
})
=>
{
expect
(
data
).
toEqual
(
response
);
...
...
@@ -519,7 +519,7 @@ describe('Api', () => {
});
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
response
);
Api
.
cycleAnalyticsDurationChart
(
groupId
,
valueStreamId
,
stageId
,
params
)
Api
.
cycleAnalyticsDurationChart
(
{
groupId
,
valueStreamId
,
stageId
,
params
}
)
.
then
(
responseObj
=>
expectRequestWithCorrectParameters
(
responseObj
,
{
response
,
...
...
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