BigW Consortium Gitlab

Commit 797fcd6b by Robert Speicher

Merge branch '28248-use-page' into 'master'

Use `page` query parameter instead of `p` to keep consistency with all URLs Closes #28248 See merge request !9268
parents 416b94f2 9f00c2b0
...@@ -29,7 +29,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s ...@@ -29,7 +29,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
}, },
props: ['scope', 'store', 'svgs'], props: ['scope', 'store', 'svgs'],
created() { created() {
const pagenum = gl.utils.getParameterByName('p'); const pagenum = gl.utils.getParameterByName('page');
const scope = gl.utils.getParameterByName('scope'); const scope = gl.utils.getParameterByName('scope');
if (pagenum) this.pagenum = pagenum; if (pagenum) this.pagenum = pagenum;
if (scope) this.apiScope = scope; if (scope) this.apiScope = scope;
...@@ -44,7 +44,6 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s ...@@ -44,7 +44,6 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
}, },
methods: { methods: {
/** /**
* Changes the URL according to the pagination component. * Changes the URL according to the pagination component.
* *
...@@ -57,7 +56,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s ...@@ -57,7 +56,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
*/ */
change(pagenum, apiScope) { change(pagenum, apiScope) {
if (!apiScope) apiScope = 'all'; if (!apiScope) apiScope = 'all';
gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`); gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`);
}, },
}, },
template: ` template: `
......
...@@ -285,6 +285,27 @@ describe 'Pipelines', :feature, :js do ...@@ -285,6 +285,27 @@ describe 'Pipelines', :feature, :js do
end end
end end
end end
context 'with pagination' do
before do
allow(Ci::Pipeline).to receive(:default_per_page).and_return(1)
create(:ci_empty_pipeline, project: project)
end
it 'should render pagination' do
visit namespace_project_pipelines_path(project.namespace, project)
wait_for_vue_resource
expect(page).to have_selector('.gl-pagination')
end
it 'should render second page of pipelines' do
visit namespace_project_pipelines_path(project.namespace, project, page: '2')
wait_for_vue_resource
expect(page).to have_selector('.gl-pagination .page', count: 2)
end
end
end end
describe 'POST /:project/pipelines' do describe 'POST /:project/pipelines' do
......
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