Commit 3df8ae12 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Persist the `page` parameter for VSA pagination

Adds support for persisting the VSA `page` parameter
in the url to provide deep linking into VSA stages

Changelog: added
EE: true
parent 9728d78a
......@@ -94,6 +94,17 @@ export default {
},
query() {
const selectedProjectIds = this.selectedProjectIds?.length ? this.selectedProjectIds : null;
const paginationUrlParams = !this.isOverviewStageSelected
? {
sort: this.pagination?.sort || null,
direction: this.pagination?.direction || null,
page: this.pagination?.page || null,
}
: {
sort: null,
direction: null,
page: null,
};
return {
value_stream_id: this.selectedValueStream?.id || null,
......@@ -101,8 +112,7 @@ export default {
created_after: toYmd(this.startDate),
created_before: toYmd(this.endDate),
stage_id: (!this.isOverviewStageSelected && this.selectedStage?.id) || null, // the `overview` stage is always the default, so dont persist the id if its selected
sort: (!this.isOverviewStageSelected && this.pagination?.sort) || null,
direction: (!this.isOverviewStageSelected && this.pagination?.direction) || null,
...paginationUrlParams,
};
},
stageCount() {
......
......@@ -28,6 +28,7 @@ export default () => {
label_name = [],
sort,
direction,
page,
} = urlQueryToFilter(window.location.search);
store.dispatch('initializeCycleAnalytics', {
......@@ -37,7 +38,11 @@ export default () => {
selectedAssigneeList: assignee_username,
selectedLabelList: label_name,
featureFlags: { hasDurationChart },
pagination: { sort: sort?.value || null, direction: direction?.value || null },
pagination: {
sort: sort?.value || null,
direction: direction?.value || null,
page: page?.value || null,
},
});
return new Vue({
......
......@@ -32,7 +32,7 @@ export const setSelectedProjects = ({ commit }, projects) =>
export const setSelectedStage = ({ commit, getters: { paginationParams } }, stage) => {
commit(types.SET_SELECTED_STAGE, stage);
commit(types.SET_PAGINATION, { ...paginationParams, page: 1, hasNextPage: null });
commit(types.SET_PAGINATION, { ...paginationParams, hasNextPage: null });
};
export const setDateRange = (
......
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