BigW Consortium Gitlab

Commit b29f6c51 by Filipa Lacerda

Use `page` query parameter instead of `p` to keep consistency with all URLs

Fix rubocop error
parent 87f4767e
...@@ -28,7 +28,7 @@ require('../vue_shared/components/pipelines_table'); ...@@ -28,7 +28,7 @@ require('../vue_shared/components/pipelines_table');
}, },
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;
...@@ -36,7 +36,7 @@ require('../vue_shared/components/pipelines_table'); ...@@ -36,7 +36,7 @@ require('../vue_shared/components/pipelines_table');
}, },
methods: { methods: {
change(pagenum, apiScope) { change(pagenum, apiScope) {
gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`); gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`);
}, },
}, },
template: ` template: `
......
...@@ -277,6 +277,28 @@ describe 'Pipelines', :feature, :js do ...@@ -277,6 +277,28 @@ describe 'Pipelines', :feature, :js do
end end
end end
end end
context 'with pagination' do
before do
create_list(:ci_empty_pipeline, 40, project: project)
end
it 'should render pagination' do
visit namespace_project_pipelines_path(project.namespace, project)
wait_for_vue_resource
expect(page).to have_css('.gl-pagination')
expect(page.find_all('tbody tr').length).to eq(20)
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_css('.gl-pagination')
expect(page.find_all('tbody tr').length).to eq(20)
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