diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-01 02:55:09 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-01 02:55:09 +0300 |
commit | c15028b1b87eafbb1cd9ed658e7ac8877ae4f67e (patch) | |
tree | 2b3cb2763c708c67491909c0acd163b8994557fe /app/assets | |
parent | b2d5869e08f9f4a790b61f53007b3ff0a467ebc9 (diff) | |
parent | 548a0b6a133e77995923c3c644328b42ec917ce9 (diff) |
Merge branch '28818-tech-debt-pipelines-pagination' into 'master'
Pagination only changes the page parameter.
Closes #28818
See merge request !9581
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 | 17 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/table_pagination.js.es6 | 16 |
2 files changed, 14 insertions, 19 deletions
diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 index 9d66d28cc62..9275cdf78f7 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 @@ -45,18 +45,15 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s methods: { /** - * Changes the URL according to the pagination component. + * Will change the page number and update the URL. * - * If no scope is provided, 'all' is assumed. - * - * Pagination component sends "null" when no scope is provided. - * - * @param {Number} pagenum - * @param {String} apiScope = 'all' + * @param {Number} pageNumber desired page to go to. */ - change(pagenum, apiScope) { - if (!apiScope) apiScope = 'all'; - gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`); + change(pageNumber) { + const param = gl.utils.setParamInURL('page', pageNumber); + + gl.utils.visitUrl(param); + return param; }, }, template: ` diff --git a/app/assets/javascripts/vue_shared/components/table_pagination.js.es6 b/app/assets/javascripts/vue_shared/components/table_pagination.js.es6 index d8042a9b7fc..dd046405575 100644 --- a/app/assets/javascripts/vue_shared/components/table_pagination.js.es6 +++ b/app/assets/javascripts/vue_shared/components/table_pagination.js.es6 @@ -23,8 +23,8 @@ window.Vue = require('vue'); Here is an example `change` method: - change(pagenum, apiScope) { - gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`); + change(pagenum) { + gl.utils.visitUrl(`?page=${pagenum}`); }, */ @@ -57,8 +57,6 @@ window.Vue = require('vue'); }, methods: { changePage(e) { - const apiScope = gl.utils.getParameterByName('scope'); - const text = e.target.innerText; const { totalPages, nextPage, previousPage } = this.pageInfo; @@ -66,19 +64,19 @@ window.Vue = require('vue'); case SPREAD: break; case LAST: - this.change(totalPages, apiScope); + this.change(totalPages); break; case NEXT: - this.change(nextPage, apiScope); + this.change(nextPage); break; case PREV: - this.change(previousPage, apiScope); + this.change(previousPage); break; case FIRST: - this.change(1, apiScope); + this.change(1); break; default: - this.change(+text, apiScope); + this.change(+text); break; } }, |