diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-21 03:07:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-21 03:07:40 +0300 |
commit | bb348db4c22bf58ac685fcd66445ac172491b302 (patch) | |
tree | aca3fcf2e361989744ddaee559b51761100472ed /app/assets/javascripts/error_tracking | |
parent | be59dd1d43332496def276c8d3e78fc82e94273a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/error_tracking')
5 files changed, 19 insertions, 2 deletions
diff --git a/app/assets/javascripts/error_tracking/components/error_tracking_list.vue b/app/assets/javascripts/error_tracking/components/error_tracking_list.vue index 1042029b6db..aa275d63c3f 100644 --- a/app/assets/javascripts/error_tracking/components/error_tracking_list.vue +++ b/app/assets/javascripts/error_tracking/components/error_tracking_list.vue @@ -113,6 +113,7 @@ export default { 'sortField', 'recentSearches', 'pagination', + 'cursor', ]), paginationRequired() { return !_.isEmpty(this.pagination); @@ -142,6 +143,7 @@ export default { 'clearRecentSearches', 'loadRecentSearches', 'setIndexPath', + 'fetchPaginatedResults', ]), setSearchText(text) { this.errorSearchQuery = text; @@ -152,10 +154,10 @@ export default { }, goToNextPage() { this.pageValue = this.$options.NEXT_PAGE; - this.startPolling(`${this.indexPath}?cursor=${this.pagination.next.cursor}`); + this.fetchPaginatedResults(this.pagination.next.cursor); }, goToPrevPage() { - this.startPolling(`${this.indexPath}?cursor=${this.pagination.previous.cursor}`); + this.fetchPaginatedResults(this.pagination.previous.cursor); }, goToPage(page) { window.scrollTo(0, 0); diff --git a/app/assets/javascripts/error_tracking/store/list/actions.js b/app/assets/javascripts/error_tracking/store/list/actions.js index c9e882c4ed2..d96ac7f524e 100644 --- a/app/assets/javascripts/error_tracking/store/list/actions.js +++ b/app/assets/javascripts/error_tracking/store/list/actions.js @@ -17,12 +17,14 @@ export function startPolling({ state, commit, dispatch }) { params: { search_term: state.searchQuery, sort: state.sortField, + cursor: state.cursor, }, }, successCallback: ({ data }) => { if (!data) { return; } + commit(types.SET_PAGINATION, data.pagination); commit(types.SET_ERRORS, data.errors); commit(types.SET_LOADING, false); @@ -74,6 +76,7 @@ export function clearRecentSearches({ commit }) { export const searchByQuery = ({ commit, dispatch }, query) => { const searchQuery = query.trim(); + commit(types.SET_CURSOR, null); commit(types.SET_SEARCH_QUERY, searchQuery); commit(types.ADD_RECENT_SEARCH, searchQuery); dispatch('stopPolling'); @@ -81,6 +84,7 @@ export const searchByQuery = ({ commit, dispatch }, query) => { }; export const sortByField = ({ commit, dispatch }, field) => { + commit(types.SET_CURSOR, null); commit(types.SET_SORT_FIELD, field); dispatch('stopPolling'); dispatch('startPolling'); @@ -90,4 +94,10 @@ export const setEndpoint = ({ commit }, endpoint) => { commit(types.SET_ENDPOINT, endpoint); }; +export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => { + commit(types.SET_CURSOR, cursor); + dispatch('stopPolling'); + dispatch('startPolling'); +}; + export default () => {}; diff --git a/app/assets/javascripts/error_tracking/store/list/mutation_types.js b/app/assets/javascripts/error_tracking/store/list/mutation_types.js index 301984a1ee0..c3468b7eabd 100644 --- a/app/assets/javascripts/error_tracking/store/list/mutation_types.js +++ b/app/assets/javascripts/error_tracking/store/list/mutation_types.js @@ -8,3 +8,4 @@ export const SET_PAGINATION = 'SET_PAGINATION'; export const SET_ENDPOINT = 'SET_ENDPOINT'; export const SET_SORT_FIELD = 'SET_SORT_FIELD'; export const SET_SEARCH_QUERY = 'SET_SEARCH_QUERY'; +export const SET_CURSOR = 'SET_CURSOR'; diff --git a/app/assets/javascripts/error_tracking/store/list/mutations.js b/app/assets/javascripts/error_tracking/store/list/mutations.js index 5648013bb89..dd5cde0576a 100644 --- a/app/assets/javascripts/error_tracking/store/list/mutations.js +++ b/app/assets/javascripts/error_tracking/store/list/mutations.js @@ -47,6 +47,9 @@ export default { [types.SET_PAGINATION](state, pagination) { state.pagination = pagination; }, + [types.SET_CURSOR](state, cursor) { + state.cursor = cursor; + }, [types.SET_SORT_FIELD](state, field) { state.sortField = field; }, diff --git a/app/assets/javascripts/error_tracking/store/list/state.js b/app/assets/javascripts/error_tracking/store/list/state.js index 93dc1040fde..225a805e709 100644 --- a/app/assets/javascripts/error_tracking/store/list/state.js +++ b/app/assets/javascripts/error_tracking/store/list/state.js @@ -7,4 +7,5 @@ export default () => ({ indexPath: '', recentSearches: [], pagination: {}, + cursor: null, }); |