Commit 51f3b21d authored by Brian Kabiro's avatar Brian Kabiro Committed by Martin Wortschack

Use options for stateless data in cycle_analytics component

- move `groupsQueryParams` and `projectsQueryParams` to options
- update specs to use $options
parent c6ea3624
...@@ -39,14 +39,6 @@ export default { ...@@ -39,14 +39,6 @@ export default {
return { return {
multiProjectSelect: true, multiProjectSelect: true,
dateOptions: [7, 30, 90], dateOptions: [7, 30, 90],
groupsQueryParams: {
min_access_level: featureAccessLevel.EVERYONE,
},
projectsQueryParams: {
per_page: PROJECTS_PER_PAGE,
with_shared: false,
order_by: 'last_activity_at',
},
}; };
}, },
computed: { computed: {
...@@ -130,6 +122,14 @@ export default { ...@@ -130,6 +122,14 @@ export default {
this.setDateRange({ skipFetch: true, startDate, endDate }); this.setDateRange({ skipFetch: true, startDate, endDate });
}, },
}, },
groupsQueryParams: {
min_access_level: featureAccessLevel.EVERYONE,
},
projectsQueryParams: {
per_page: PROJECTS_PER_PAGE,
with_shared: false,
order_by: 'last_activity_at',
},
}; };
</script> </script>
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
> >
<groups-dropdown-filter <groups-dropdown-filter
class="js-groups-dropdown-filter dropdown-select" class="js-groups-dropdown-filter dropdown-select"
:query-params="groupsQueryParams" :query-params="$options.groupsQueryParams"
@selected="onGroupSelect" @selected="onGroupSelect"
/> />
<projects-dropdown-filter <projects-dropdown-filter
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
:key="selectedGroup.id" :key="selectedGroup.id"
class="js-projects-dropdown-filter ml-md-1 mt-1 mt-md-0 dropdown-select" class="js-projects-dropdown-filter ml-md-1 mt-1 mt-md-0 dropdown-select"
:group-id="selectedGroup.id" :group-id="selectedGroup.id"
:query-params="projectsQueryParams" :query-params="$options.projectsQueryParams"
:multi-select="multiProjectSelect" :multi-select="multiProjectSelect"
@selected="onProjectsSelect" @selected="onProjectsSelect"
/> />
......
...@@ -120,7 +120,7 @@ describe('Cycle Analytics component', () => { ...@@ -120,7 +120,7 @@ describe('Cycle Analytics component', () => {
it('displays the groups filter', () => { it('displays the groups filter', () => {
expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(true); expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(true);
expect(wrapper.find(GroupsDropdownFilter).props('queryParams')).toEqual( expect(wrapper.find(GroupsDropdownFilter).props('queryParams')).toEqual(
wrapper.vm.groupsQueryParams, wrapper.vm.$options.groupsQueryParams,
); );
}); });
...@@ -156,7 +156,7 @@ describe('Cycle Analytics component', () => { ...@@ -156,7 +156,7 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(ProjectsDropdownFilter).props()).toEqual( expect(wrapper.find(ProjectsDropdownFilter).props()).toEqual(
expect.objectContaining({ expect.objectContaining({
queryParams: wrapper.vm.projectsQueryParams, queryParams: wrapper.vm.$options.projectsQueryParams,
groupId: mockData.group.id, groupId: mockData.group.id,
multiSelect: wrapper.vm.multiProjectSelect, multiSelect: wrapper.vm.multiProjectSelect,
}), }),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment