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
101c9b24
Commit
101c9b24
authored
Nov 04, 2019
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mutation specs for chart data requests
Regenerate gitlab pot file and minor lints
parent
747dbd8b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
8 deletions
+45
-8
ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue
...javascripts/analytics/cycle_analytics/components/base.vue
+4
-1
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
...ts/javascripts/analytics/cycle_analytics/store/actions.js
+0
-1
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutation_types.js
...scripts/analytics/cycle_analytics/store/mutation_types.js
+0
-2
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
.../javascripts/analytics/cycle_analytics/store/mutations.js
+5
-1
ee/app/assets/javascripts/analytics/cycle_analytics/store/state.js
...sets/javascripts/analytics/cycle_analytics/store/state.js
+1
-2
ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js
...rontend/analytics/cycle_analytics/store/mutations_spec.js
+31
-0
ee/spec/frontend/fixtures/analytics.rb
ee/spec/frontend/fixtures/analytics.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue
View file @
101c9b24
...
@@ -117,7 +117,10 @@ export default {
...
@@ -117,7 +117,10 @@ export default {
// https://gitlab.com/gitlab-org/gitlab/merge_requests/18514
// https://gitlab.com/gitlab-org/gitlab/merge_requests/18514
this
.
fetchTasksByTypeData
();
this
.
fetchTasksByTypeData
();
})
})
.
catch
(()
=>
createFlash
(
__
(
'
There was an error fetching data for the chart
'
)));
.
catch
(
err
=>
{
createFlash
(
__
(
'
There was an error fetching data for the chart
'
));
throw
err
;
});
},
},
onProjectsSelect
(
projects
)
{
onProjectsSelect
(
projects
)
{
const
projectIds
=
projects
.
map
(
value
=>
value
.
id
);
const
projectIds
=
projects
.
map
(
value
=>
value
.
id
);
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
View file @
101c9b24
...
@@ -234,7 +234,6 @@ export const fetchTasksByTypeData = ({ dispatch, state, getters }) => {
...
@@ -234,7 +234,6 @@ export const fetchTasksByTypeData = ({ dispatch, state, getters }) => {
dispatch
(
'
requestTasksByTypeData
'
);
dispatch
(
'
requestTasksByTypeData
'
);
// TODO: move to service / api
return
axios
return
axios
.
get
(
endpoint
,
{
params
})
.
get
(
endpoint
,
{
params
})
.
then
(
data
=>
dispatch
(
'
receiveTasksByTypeDataSuccess
'
,
data
))
.
then
(
data
=>
dispatch
(
'
receiveTasksByTypeDataSuccess
'
,
data
))
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutation_types.js
View file @
101c9b24
...
@@ -39,5 +39,3 @@ export const SET_TASKS_BY_TYPE_LABELS = 'SET_TASKS_BY_TYPE_LABELS';
...
@@ -39,5 +39,3 @@ export const SET_TASKS_BY_TYPE_LABELS = 'SET_TASKS_BY_TYPE_LABELS';
export
const
REQUEST_TASKS_BY_TYPE_DATA
=
'
REQUEST_TASKS_BY_TYPE_DATA
'
;
export
const
REQUEST_TASKS_BY_TYPE_DATA
=
'
REQUEST_TASKS_BY_TYPE_DATA
'
;
export
const
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
=
'
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
'
;
export
const
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
=
'
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
'
;
export
const
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
=
'
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
'
;
export
const
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
=
'
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
'
;
export
const
SET_TIMEFRAME_START_AND_END
=
'
SET_TIMEFRAME_START_AND_END
'
;
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
View file @
101c9b24
...
@@ -146,7 +146,11 @@ export default {
...
@@ -146,7 +146,11 @@ export default {
[
types
.
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
](
state
)
{
[
types
.
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
](
state
)
{
state
.
isLoadingChartData
=
false
;
state
.
isLoadingChartData
=
false
;
},
},
[
types
.
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
](
state
)
{
[
types
.
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
](
state
,
data
)
{
state
.
isLoadingChartData
=
false
;
state
.
isLoadingChartData
=
false
;
state
.
tasksByType
=
{
...
state
.
tasksByType
,
data
,
};
},
},
};
};
ee/app/assets/javascripts/analytics/cycle_analytics/store/state.js
View file @
101c9b24
...
@@ -33,8 +33,7 @@ export default () => ({
...
@@ -33,8 +33,7 @@ export default () => ({
customStageFormEvents
:
[],
customStageFormEvents
:
[],
tasksByType
:
{
tasksByType
:
{
subject
:
TASKS_BY_TYPE_SUBJECT_ISSUE
,
// issues | merge_requests, defaults to issues
subject
:
TASKS_BY_TYPE_SUBJECT_ISSUE
,
// list of selected labels for the tasks by type chart
labelIds
:
[],
labelIds
:
[],
data
:
[],
data
:
[],
},
},
...
...
ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js
View file @
101c9b24
...
@@ -16,6 +16,7 @@ import {
...
@@ -16,6 +16,7 @@ import {
startDate
,
startDate
,
endDate
,
endDate
,
customizableStagesAndEvents
,
customizableStagesAndEvents
,
tasksByTypeData
,
}
from
'
../mock_data
'
;
}
from
'
../mock_data
'
;
let
state
=
null
;
let
state
=
null
;
...
@@ -47,6 +48,8 @@ describe('Cycle analytics mutations', () => {
...
@@ -47,6 +48,8 @@ describe('Cycle analytics mutations', () => {
${
types
.
REQUEST_GROUP_STAGES_AND_EVENTS
}
|
${
'
customStageFormEvents
'
}
|
${[]}
${
types
.
REQUEST_GROUP_STAGES_AND_EVENTS
}
|
${
'
customStageFormEvents
'
}
|
${[]}
${
types
.
REQUEST_CREATE_CUSTOM_STAGE
}
|
${
'
isSavingCustomStage
'
}
|
${
true
}
${
types
.
REQUEST_CREATE_CUSTOM_STAGE
}
|
${
'
isSavingCustomStage
'
}
|
${
true
}
${
types
.
RECEIVE_CREATE_CUSTOM_STAGE_RESPONSE
}
|
${
'
isSavingCustomStage
'
}
|
${
false
}
${
types
.
RECEIVE_CREATE_CUSTOM_STAGE_RESPONSE
}
|
${
'
isSavingCustomStage
'
}
|
${
false
}
${
types
.
REQUEST_TASKS_BY_TYPE_DATA
}
|
${
'
isLoadingChartData
'
}
|
${
true
}
${
types
.
RECEIVE_TASKS_BY_TYPE_DATA_ERROR
}
|
${
'
isLoadingChartData
'
}
|
${
false
}
`
(
'
$mutation will set $stateKey=$value
'
,
({
mutation
,
stateKey
,
value
})
=>
{
`
(
'
$mutation will set $stateKey=$value
'
,
({
mutation
,
stateKey
,
value
})
=>
{
mutations
[
mutation
](
state
);
mutations
[
mutation
](
state
);
...
@@ -100,6 +103,19 @@ describe('Cycle analytics mutations', () => {
...
@@ -100,6 +103,19 @@ describe('Cycle analytics mutations', () => {
});
});
});
});
describe
.
each
`
mutation | value
${
types
.
REQUEST_GROUP_LABELS
}
|
${[]}
${
types
.
RECEIVE_GROUP_LABELS_ERROR
}
|
${[]}
`
(
'
$mutation
'
,
({
mutation
,
value
})
=>
{
it
(
`will set tasksByType.labelIds to
${
value
}
`
,
()
=>
{
state
=
{
tasksByType
:
{}
};
mutations
[
mutation
](
state
);
expect
(
state
.
tasksByType
.
labelIds
).
toEqual
(
value
);
});
});
describe
(
`
${
types
.
RECEIVE_GROUP_LABELS_SUCCESS
}
`
,
()
=>
{
describe
(
`
${
types
.
RECEIVE_GROUP_LABELS_SUCCESS
}
`
,
()
=>
{
it
(
'
will set the labels state item with the camelCased group labels
'
,
()
=>
{
it
(
'
will set the labels state item with the camelCased group labels
'
,
()
=>
{
mutations
[
types
.
RECEIVE_GROUP_LABELS_SUCCESS
](
state
,
groupLabels
);
mutations
[
types
.
RECEIVE_GROUP_LABELS_SUCCESS
](
state
,
groupLabels
);
...
@@ -193,4 +209,19 @@ describe('Cycle analytics mutations', () => {
...
@@ -193,4 +209,19 @@ describe('Cycle analytics mutations', () => {
expect
(
state
.
errorCode
).
toBe
(
errorCode
);
expect
(
state
.
errorCode
).
toBe
(
errorCode
);
});
});
});
});
describe
(
`
${
types
.
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
}
`
,
()
=>
{
it
(
'
sets isLoadingChartData to false
'
,
()
=>
{
mutations
[
types
.
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
](
state
,
{});
expect
(
state
.
isLoadingChartData
).
toEqual
(
false
);
});
it
(
'
sets tasksByType.data to the raw returned chart data
'
,
()
=>
{
state
=
{
tasksByType
:
{
data
:
null
}
};
mutations
[
types
.
RECEIVE_TASKS_BY_TYPE_DATA_SUCCESS
](
state
,
tasksByTypeData
);
expect
(
state
.
tasksByType
.
data
).
toEqual
(
tasksByTypeData
);
});
});
});
});
ee/spec/frontend/fixtures/analytics.rb
View file @
101c9b24
...
@@ -134,4 +134,4 @@ describe 'Analytics (JavaScript fixtures)', :sidekiq_inline do
...
@@ -134,4 +134,4 @@ describe 'Analytics (JavaScript fixtures)', :sidekiq_inline do
expect
(
response
).
to
be_successful
expect
(
response
).
to
be_successful
end
end
end
end
end
end
\ No newline at end of file
locale/gitlab.pot
View file @
101c9b24
...
@@ -17422,6 +17422,9 @@ msgstr ""
...
@@ -17422,6 +17422,9 @@ msgstr ""
msgid "There was an error fetching data for the selected stage"
msgid "There was an error fetching data for the selected stage"
msgstr ""
msgstr ""
msgid "There was an error fetching data for the chart"
msgstr ""
msgid "There was an error fetching label data for the selected group"
msgid "There was an error fetching label data for the selected group"
msgstr ""
msgstr ""
...
...
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