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
3f47b691
Commit
3f47b691
authored
Sep 23, 2019
by
Martin Wortschack
Committed by
Mike Greiling
Sep 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce fetchSecondaryChartData action
- This fetches data for all charts except for the main chart
parent
bb31fea5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
55 deletions
+27
-55
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/actions.js
...cs/productivity_analytics/store/modules/charts/actions.js
+7
-6
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/filters/actions.js
...s/productivity_analytics/store/modules/filters/actions.js
+4
-8
ee/spec/frontend/analytics/productivity_analytics/store/modules/charts/actions_spec.js
...oductivity_analytics/store/modules/charts/actions_spec.js
+4
-5
ee/spec/frontend/analytics/productivity_analytics/store/modules/filters/actions_spec.js
...ductivity_analytics/store/modules/filters/actions_spec.js
+12
-36
No files found.
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/actions.js
View file @
3f47b691
...
...
@@ -2,13 +2,14 @@ import axios from '~/lib/utils/axios_utils';
import
*
as
types
from
'
./mutation_types
'
;
import
{
chartKeys
}
from
'
../../../constants
'
;
export
const
fetchAllChartData
=
({
commit
,
state
,
dispatch
})
=>
{
// let's reset any data on the main chart first
// since any selected items will be used as query params for other charts)
commit
(
types
.
RESET_CHART_DATA
,
chartKeys
.
main
);
/**
* Fetches data for all charts except for the main chart
*/
export
const
fetchSecondaryChartData
=
({
state
,
dispatch
})
=>
{
Object
.
keys
(
state
.
charts
).
forEach
(
chartKey
=>
{
dispatch
(
'
fetchChartData
'
,
chartKey
);
if
(
chartKey
!==
chartKeys
.
main
)
{
dispatch
(
'
fetchChartData
'
,
chartKey
);
}
});
};
...
...
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/filters/actions.js
View file @
3f47b691
...
...
@@ -7,8 +7,7 @@ export const setGroupNamespace = ({ commit, dispatch }, groupNamespace) => {
// let's fetch the main chart data first to see if the user has access to the selected group
// if there's no 403, then we fetch all remaining chart data and table data
return
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
main
,
{
root
:
true
}).
then
(()
=>
{
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchSecondaryChartData
'
,
null
,
{
root
:
true
});
dispatch
(
'
table/fetchMergeRequests
'
,
null
,
{
root
:
true
});
});
};
...
...
@@ -17,8 +16,7 @@ export const setProjectPath = ({ commit, dispatch }, projectPath) => {
commit
(
types
.
SET_PROJECT_PATH
,
projectPath
);
return
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
main
,
{
root
:
true
}).
then
(()
=>
{
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchSecondaryChartData
'
,
null
,
{
root
:
true
});
dispatch
(
'
table/fetchMergeRequests
'
,
null
,
{
root
:
true
});
});
};
...
...
@@ -27,8 +25,7 @@ export const setPath = ({ commit, dispatch }, path) => {
commit
(
types
.
SET_PATH
,
path
);
return
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
main
,
{
root
:
true
}).
then
(()
=>
{
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchSecondaryChartData
'
,
null
,
{
root
:
true
});
dispatch
(
'
table/fetchMergeRequests
'
,
null
,
{
root
:
true
});
});
};
...
...
@@ -37,8 +34,7 @@ export const setDaysInPast = ({ commit, dispatch }, days) => {
commit
(
types
.
SET_DAYS_IN_PAST
,
days
);
return
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
main
,
{
root
:
true
}).
then
(()
=>
{
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
});
dispatch
(
'
charts/fetchSecondaryChartData
'
,
null
,
{
root
:
true
});
dispatch
(
'
table/fetchMergeRequests
'
,
null
,
{
root
:
true
});
});
};
...
...
ee/spec/frontend/analytics/productivity_analytics/store/modules/charts/actions_spec.js
View file @
3f47b691
...
...
@@ -160,15 +160,14 @@ describe('Productivity analytics chart actions', () => {
});
});
describe
(
'
fetch
All
ChartData
'
,
()
=>
{
it
(
'
commits reset for the main chart and dispatches fetchChartData for all chart types
'
,
done
=>
{
describe
(
'
fetch
Secondary
ChartData
'
,
()
=>
{
it
(
'
dispatches fetchChartData for all chart types except for the main chart
'
,
done
=>
{
testAction
(
actions
.
fetch
All
ChartData
,
actions
.
fetch
Secondary
ChartData
,
null
,
mockedContext
.
state
,
[
{
type
:
types
.
RESET_CHART_DATA
,
payload
:
chartKeys
.
main
}
],
[],
[
{
type
:
'
fetchChartData
'
,
payload
:
chartKeys
.
main
},
{
type
:
'
fetchChartData
'
,
payload
:
chartKeys
.
timeBasedHistogram
},
{
type
:
'
fetchChartData
'
,
payload
:
chartKeys
.
commitBasedHistogram
},
{
type
:
'
fetchChartData
'
,
payload
:
chartKeys
.
scatterplot
},
...
...
ee/spec/frontend/analytics/productivity_analytics/store/modules/filters/actions_spec.js
View file @
3f47b691
...
...
@@ -27,20 +27,14 @@ describe('Productivity analytics filter actions', () => {
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
1
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
'
charts/fetch
Secondary
ChartData
'
,
null
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
2
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
3
]).
toEqual
([
'
table/fetchMergeRequests
'
,
jasmine
.
any
(
Object
)
,
null
,
{
root
:
true
},
]);
})
...
...
@@ -68,20 +62,14 @@ describe('Productivity analytics filter actions', () => {
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
1
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
'
charts/fetch
Secondary
ChartData
'
,
null
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
2
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
3
]).
toEqual
([
'
table/fetchMergeRequests
'
,
jasmine
.
any
(
Object
)
,
null
,
{
root
:
true
},
]);
})
...
...
@@ -109,20 +97,14 @@ describe('Productivity analytics filter actions', () => {
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
1
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
'
charts/fetch
Secondary
ChartData
'
,
null
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
2
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
3
]).
toEqual
([
'
table/fetchMergeRequests
'
,
jasmine
.
any
(
Object
)
,
null
,
{
root
:
true
},
]);
})
...
...
@@ -150,20 +132,14 @@ describe('Productivity analytics filter actions', () => {
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
1
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
timeBasedHistogram
,
'
charts/fetch
Secondary
ChartData
'
,
null
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
2
]).
toEqual
([
'
charts/fetchChartData
'
,
chartKeys
.
commitBasedHistogram
,
{
root
:
true
},
]);
expect
(
store
.
dispatch
.
mock
.
calls
[
3
]).
toEqual
([
'
table/fetchMergeRequests
'
,
jasmine
.
any
(
Object
)
,
null
,
{
root
:
true
},
]);
})
...
...
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