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