diff --git a/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js b/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js index 4fa88279fe0cc962353fb72f31076bb54967029a..d1c8d2c24e72bf651f74a90f17a81d6a93e22e10 100644 --- a/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js +++ b/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { formatMedianValues } from '../utils'; -import { PAGINATION_SORT_FIELD_END_EVENT, PAGINATION_SORT_DIRECTION_DESC } from '../constants'; +import { PAGINATION_SORT_DIRECTION_DESC, PAGINATION_SORT_FIELD_DURATION } from '../constants'; import * as types from './mutation_types'; export default { @@ -41,7 +41,7 @@ export default { Vue.set(state, 'pagination', { page, hasNextPage, - sort: sort || PAGINATION_SORT_FIELD_END_EVENT, + sort: sort || PAGINATION_SORT_FIELD_DURATION, direction: direction || PAGINATION_SORT_DIRECTION_DESC, }); }, diff --git a/app/assets/javascripts/analytics/cycle_analytics/store/state.js b/app/assets/javascripts/analytics/cycle_analytics/store/state.js index 3d9b56b043d2954dc9a8234ec125ae6a2c5e2e18..f387bf65093ef10caae21089dd1407aa80991997 100644 --- a/app/assets/javascripts/analytics/cycle_analytics/store/state.js +++ b/app/assets/javascripts/analytics/cycle_analytics/store/state.js @@ -1,5 +1,5 @@ import { - PAGINATION_SORT_FIELD_END_EVENT, + PAGINATION_SORT_FIELD_DURATION, PAGINATION_SORT_DIRECTION_DESC, } from '~/analytics/cycle_analytics/constants'; @@ -29,7 +29,7 @@ export default () => ({ pagination: { page: null, hasNextPage: false, - sort: PAGINATION_SORT_FIELD_END_EVENT, + sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC, }, predefinedDateRange: null, diff --git a/ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js b/ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js index 0363305a33baa1d8a712141b5e18a27f5d03092f..e194c78450acc7c25de45bca7d2058bb737e218e 100644 --- a/ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js +++ b/ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import { - PAGINATION_SORT_FIELD_END_EVENT, + PAGINATION_SORT_FIELD_DURATION, PAGINATION_SORT_DIRECTION_DESC, } from '~/analytics/cycle_analytics/constants'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; @@ -212,7 +212,7 @@ export default { Vue.set(state, 'pagination', { page, hasNextPage, - sort: sort || PAGINATION_SORT_FIELD_END_EVENT, + sort: sort || PAGINATION_SORT_FIELD_DURATION, direction: direction || PAGINATION_SORT_DIRECTION_DESC, }); }, diff --git a/ee/app/assets/javascripts/analytics/cycle_analytics/store/state.js b/ee/app/assets/javascripts/analytics/cycle_analytics/store/state.js index 228f337bf3b73ca9cbf609cd88a42d939ffac713..585bac441badf72a5cf8bffeaf68fb9fb89cebf2 100644 --- a/ee/app/assets/javascripts/analytics/cycle_analytics/store/state.js +++ b/ee/app/assets/javascripts/analytics/cycle_analytics/store/state.js @@ -1,5 +1,5 @@ import { - PAGINATION_SORT_FIELD_END_EVENT, + PAGINATION_SORT_FIELD_DURATION, PAGINATION_SORT_DIRECTION_DESC, } from '~/analytics/cycle_analytics/constants'; @@ -45,7 +45,7 @@ export default () => ({ pagination: { page: null, hasNextPage: false, - sort: PAGINATION_SORT_FIELD_END_EVENT, + sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC, }, stageCounts: {}, diff --git a/ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js b/ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js index a4364d00f1ef480cc7f449df98c1474a5f3a21d3..1261a4f69a4e6494826cabfaf7da3c3a68c03554 100644 --- a/ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js +++ b/ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js @@ -9,7 +9,7 @@ import { } from 'jest/analytics/cycle_analytics/mock_data'; import { PAGINATION_SORT_DIRECTION_DESC, - PAGINATION_SORT_FIELD_END_EVENT, + PAGINATION_SORT_FIELD_DURATION, } from '~/analytics/cycle_analytics/constants'; import { issueStage, @@ -107,7 +107,7 @@ describe('Value Stream Analytics mutations', () => { ${types.RECEIVE_CREATE_VALUE_STREAM_SUCCESS} | ${valueStreams[1]} | ${{ selectedValueStream: valueStreams[1] }} ${types.RECEIVE_UPDATE_VALUE_STREAM_SUCCESS} | ${valueStreams[1]} | ${{ selectedValueStream: valueStreams[1] }} ${types.RECEIVE_GROUP_LABELS_SUCCESS} | ${groupLabels} | ${{ defaultGroupLabels: groupLabels }} - ${types.SET_PAGINATION} | ${pagination} | ${{ pagination: { ...pagination, sort: PAGINATION_SORT_FIELD_END_EVENT, direction: PAGINATION_SORT_DIRECTION_DESC } }} + ${types.SET_PAGINATION} | ${pagination} | ${{ pagination: { ...pagination, sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC } }} ${types.SET_PAGINATION} | ${{ ...pagination, sort: 'duration', direction: 'asc' }} | ${{ pagination: { ...pagination, sort: 'duration', direction: 'asc' } }} ${types.SET_STAGE_EVENTS} | ${rawCustomStageEvents} | ${{ formEvents: camelCasedStageEvents }} `( @@ -233,7 +233,7 @@ describe('Value Stream Analytics mutations', () => { createdBefore: '2020-01-01', pagination: { page: 1, - sort: PAGINATION_SORT_FIELD_END_EVENT, + sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC, }, }; @@ -254,7 +254,7 @@ describe('Value Stream Analytics mutations', () => { it.each` stateKey | expectedState ${'page'} | ${1} - ${'sort'} | ${PAGINATION_SORT_FIELD_END_EVENT} + ${'sort'} | ${PAGINATION_SORT_FIELD_DURATION} ${'direction'} | ${PAGINATION_SORT_DIRECTION_DESC} `('$stateKey will be set to $expectedState', ({ stateKey, expectedState }) => { state = {}; diff --git a/spec/frontend/analytics/cycle_analytics/mock_data.js b/spec/frontend/analytics/cycle_analytics/mock_data.js index 7ad95cab9adb397b55bc6879729a876d12d6a205..e0b6f4aa8c4ffcf0b6e10b2f8c6f321a16140c62 100644 --- a/spec/frontend/analytics/cycle_analytics/mock_data.js +++ b/spec/frontend/analytics/cycle_analytics/mock_data.js @@ -11,7 +11,7 @@ import { DEFAULT_VALUE_STREAM, PAGINATION_TYPE, PAGINATION_SORT_DIRECTION_DESC, - PAGINATION_SORT_FIELD_END_EVENT, + PAGINATION_SORT_FIELD_DURATION, } from '~/analytics/cycle_analytics/constants'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { getDateInPast } from '~/lib/utils/datetime_utility'; @@ -245,7 +245,7 @@ export const valueStreamStages = rawValueStreamStages.map((s) => export const initialPaginationQuery = { page: 15, - sort: PAGINATION_SORT_FIELD_END_EVENT, + sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC, }; @@ -257,7 +257,7 @@ export const initialPaginationState = { export const basePaginationResult = { pagination: PAGINATION_TYPE, - sort: PAGINATION_SORT_FIELD_END_EVENT, + sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC, page: null, }; diff --git a/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js b/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js index 25fed2b17146da9c423acd885a78fe8b666af6a9..a37f37aaaf4554073092b5b9753e600e06e1674d 100644 --- a/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js +++ b/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js @@ -2,7 +2,7 @@ import { useFakeDate } from 'helpers/fake_date'; import * as types from '~/analytics/cycle_analytics/store/mutation_types'; import mutations from '~/analytics/cycle_analytics/store/mutations'; import { - PAGINATION_SORT_FIELD_END_EVENT, + PAGINATION_SORT_FIELD_DURATION, PAGINATION_SORT_DIRECTION_DESC, } from '~/analytics/cycle_analytics/constants'; import { @@ -99,7 +99,7 @@ describe('Project Value Stream Analytics mutations', () => { ${types.SET_LOADING} | ${true} | ${'isLoading'} | ${true} ${types.SET_LOADING} | ${false} | ${'isLoading'} | ${false} ${types.SET_SELECTED_VALUE_STREAM} | ${selectedValueStream} | ${'selectedValueStream'} | ${selectedValueStream} - ${types.SET_PAGINATION} | ${pagination} | ${'pagination'} | ${{ ...pagination, sort: PAGINATION_SORT_FIELD_END_EVENT, direction: PAGINATION_SORT_DIRECTION_DESC }} + ${types.SET_PAGINATION} | ${pagination} | ${'pagination'} | ${{ ...pagination, sort: PAGINATION_SORT_FIELD_DURATION, direction: PAGINATION_SORT_DIRECTION_DESC }} ${types.SET_PAGINATION} | ${{ ...pagination, sort: 'duration', direction: 'asc' }} | ${'pagination'} | ${{ ...pagination, sort: 'duration', direction: 'asc' }} ${types.SET_SELECTED_STAGE} | ${selectedStage} | ${'selectedStage'} | ${selectedStage} ${types.RECEIVE_VALUE_STREAMS_SUCCESS} | ${[selectedValueStream]} | ${'valueStreams'} | ${[selectedValueStream]}