Commit 12b16992 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo Committed by Martin Wortschack

Replace hardcoded projects query param with constant

parent fc576350
...@@ -7,6 +7,7 @@ import FileQuantityDropdown from './file_quantity_dropdown.vue'; ...@@ -7,6 +7,7 @@ import FileQuantityDropdown from './file_quantity_dropdown.vue';
import { featureAccessLevel } from '~/pages/projects/shared/permissions/constants'; import { featureAccessLevel } from '~/pages/projects/shared/permissions/constants';
import { PROJECTS_PER_PAGE, DEFAULT_FILE_QUANTITY } from '../constants'; import { PROJECTS_PER_PAGE, DEFAULT_FILE_QUANTITY } from '../constants';
import createStore from '../store'; import createStore from '../store';
import { LAST_ACTIVITY_AT } from '../../shared/constants';
export default { export default {
name: 'CodeAnalytics', name: 'CodeAnalytics',
...@@ -56,7 +57,7 @@ export default { ...@@ -56,7 +57,7 @@ export default {
projectsQueryParams: { projectsQueryParams: {
per_page: PROJECTS_PER_PAGE, per_page: PROJECTS_PER_PAGE,
with_shared: false, with_shared: false,
order_by: 'last_activity_at', order_by: LAST_ACTIVITY_AT,
}, },
}; };
</script> </script>
......
...@@ -9,6 +9,7 @@ import GroupsDropdownFilter from '../../shared/components/groups_dropdown_filter ...@@ -9,6 +9,7 @@ import GroupsDropdownFilter from '../../shared/components/groups_dropdown_filter
import ProjectsDropdownFilter from '../../shared/components/projects_dropdown_filter.vue'; import ProjectsDropdownFilter from '../../shared/components/projects_dropdown_filter.vue';
import SummaryTable from './summary_table.vue'; import SummaryTable from './summary_table.vue';
import StageTable from './stage_table.vue'; import StageTable from './stage_table.vue';
import { LAST_ACTIVITY_AT } from '../../shared/constants';
export default { export default {
name: 'CycleAnalytics', name: 'CycleAnalytics',
...@@ -135,7 +136,7 @@ export default { ...@@ -135,7 +136,7 @@ export default {
projectsQueryParams: { projectsQueryParams: {
per_page: PROJECTS_PER_PAGE, per_page: PROJECTS_PER_PAGE,
with_shared: false, with_shared: false,
order_by: 'last_activity_at', order_by: LAST_ACTIVITY_AT,
}, },
}; };
</script> </script>
......
...@@ -3,6 +3,7 @@ import { mapState, mapActions } from 'vuex'; ...@@ -3,6 +3,7 @@ import { mapState, mapActions } from 'vuex';
import GroupsDropdownFilter from '../../shared/components/groups_dropdown_filter.vue'; import GroupsDropdownFilter from '../../shared/components/groups_dropdown_filter.vue';
import ProjectsDropdownFilter from '../../shared/components/projects_dropdown_filter.vue'; import ProjectsDropdownFilter from '../../shared/components/projects_dropdown_filter.vue';
import { accessLevelReporter, projectsPerPage } from '../constants'; import { accessLevelReporter, projectsPerPage } from '../constants';
import { LAST_ACTIVITY_AT } from '../../shared/constants';
export default { export default {
components: { components: {
...@@ -51,7 +52,7 @@ export default { ...@@ -51,7 +52,7 @@ export default {
projectsQueryParams: { projectsQueryParams: {
per_page: projectsPerPage, per_page: projectsPerPage,
with_shared: false, // exclude forks with_shared: false, // exclude forks
order_by: 'last_activity_at', order_by: LAST_ACTIVITY_AT,
}, },
}; };
</script> </script>
......
...@@ -13,3 +13,5 @@ export const scatterChartLineProps = { ...@@ -13,3 +13,5 @@ export const scatterChartLineProps = {
zlevel: 3, zlevel: 3,
}, },
}; };
export const LAST_ACTIVITY_AT = 'last_activity_at';
...@@ -3,6 +3,7 @@ import $ from 'jquery'; ...@@ -3,6 +3,7 @@ import $ from 'jquery';
import 'bootstrap'; import 'bootstrap';
import '~/gl_dropdown'; import '~/gl_dropdown';
import ProjectsDropdownFilter from 'ee/analytics/shared/components/projects_dropdown_filter.vue'; import ProjectsDropdownFilter from 'ee/analytics/shared/components/projects_dropdown_filter.vue';
import { LAST_ACTIVITY_AT } from 'ee/analytics/shared/constants';
import Api from '~/api'; import Api from '~/api';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
...@@ -67,7 +68,7 @@ describe('ProjectsDropdownFilter component', () => { ...@@ -67,7 +68,7 @@ describe('ProjectsDropdownFilter component', () => {
queryParams: { queryParams: {
per_page: 50, per_page: 50,
with_shared: false, with_shared: false,
order_by: 'last_activity_at', order_by: LAST_ACTIVITY_AT,
}, },
}); });
...@@ -80,7 +81,7 @@ describe('ProjectsDropdownFilter component', () => { ...@@ -80,7 +81,7 @@ describe('ProjectsDropdownFilter component', () => {
expect(Api.groupProjects).toHaveBeenCalledWith( expect(Api.groupProjects).toHaveBeenCalledWith(
expect.any(Number), expect.any(Number),
expect.any(String), expect.any(String),
expect.objectContaining({ per_page: 50, with_shared: false, order_by: 'last_activity_at' }), expect.objectContaining({ per_page: 50, with_shared: false, order_by: LAST_ACTIVITY_AT }),
expect.any(Function), expect.any(Function),
); );
}); });
......
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