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 {
return {
multiProjectSelect: true,
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: {
......@@ -130,6 +122,14 @@ export default {
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>
......@@ -144,7 +144,7 @@ export default {
>
<groups-dropdown-filter
class="js-groups-dropdown-filter dropdown-select"
:query-params="groupsQueryParams"
:query-params="$options.groupsQueryParams"
@selected="onGroupSelect"
/>
<projects-dropdown-filter
......@@ -152,7 +152,7 @@ export default {
:key="selectedGroup.id"
class="js-projects-dropdown-filter ml-md-1 mt-1 mt-md-0 dropdown-select"
:group-id="selectedGroup.id"
:query-params="projectsQueryParams"
:query-params="$options.projectsQueryParams"
:multi-select="multiProjectSelect"
@selected="onProjectsSelect"
/>
......
......@@ -120,7 +120,7 @@ describe('Cycle Analytics component', () => {
it('displays the groups filter', () => {
expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(true);
expect(wrapper.find(GroupsDropdownFilter).props('queryParams')).toEqual(
wrapper.vm.groupsQueryParams,
wrapper.vm.$options.groupsQueryParams,
);
});
......@@ -156,7 +156,7 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(ProjectsDropdownFilter).props()).toEqual(
expect.objectContaining({
queryParams: wrapper.vm.projectsQueryParams,
queryParams: wrapper.vm.$options.projectsQueryParams,
groupId: mockData.group.id,
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