Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
548a0b6a
Commit
548a0b6a
authored
Feb 28, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pagination only changes the page parameter.
Fix broken test
parent
4830a8b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
28 deletions
+15
-28
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+7
-10
app/assets/javascripts/vue_shared/components/table_pagination.js.es6
...javascripts/vue_shared/components/table_pagination.js.es6
+7
-9
spec/javascripts/vue_shared/components/table_pagination_spec.js.es6
...cripts/vue_shared/components/table_pagination_spec.js.es6
+1
-9
No files found.
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
548a0b6a
...
@@ -45,18 +45,15 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -45,18 +45,15 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
methods: {
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.
* @param {Number} pageNumber desired page to go to.
*
* Pagination component sends "null" when no scope is provided.
*
* @param {Number} pagenum
* @param {String} apiScope = 'all'
*/
*/
change(pagenum, apiScope) {
change(pageNumber) {
if (!apiScope) apiScope = 'all';
const param = gl.utils.setParamInURL('page', pageNumber);
gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`);
gl.utils.visitUrl(param);
return param;
},
},
},
},
template: `
template: `
...
...
app/assets/javascripts/vue_shared/components/table_pagination.js.es6
View file @
548a0b6a
...
@@ -23,8 +23,8 @@ window.Vue = require('vue');
...
@@ -23,8 +23,8 @@ window.Vue = require('vue');
Here is an example `change` method:
Here is an example `change` method:
change(pagenum
, apiScope
) {
change(pagenum) {
gl.utils.visitUrl(`?
scope=${apiScope}&p
=${pagenum}`);
gl.utils.visitUrl(`?
page
=${pagenum}`);
},
},
*/
*/
...
@@ -57,8 +57,6 @@ window.Vue = require('vue');
...
@@ -57,8 +57,6 @@ window.Vue = require('vue');
},
},
methods: {
methods: {
changePage(e) {
changePage(e) {
const apiScope = gl.utils.getParameterByName('scope');
const text = e.target.innerText;
const text = e.target.innerText;
const { totalPages, nextPage, previousPage } = this.pageInfo;
const { totalPages, nextPage, previousPage } = this.pageInfo;
...
@@ -66,19 +64,19 @@ window.Vue = require('vue');
...
@@ -66,19 +64,19 @@ window.Vue = require('vue');
case SPREAD:
case SPREAD:
break;
break;
case LAST:
case LAST:
this.change(totalPages
, apiScope
);
this.change(totalPages);
break;
break;
case NEXT:
case NEXT:
this.change(nextPage
, apiScope
);
this.change(nextPage);
break;
break;
case PREV:
case PREV:
this.change(previousPage
, apiScope
);
this.change(previousPage);
break;
break;
case FIRST:
case FIRST:
this.change(1
, apiScope
);
this.change(1);
break;
break;
default:
default:
this.change(+text
, apiScope
);
this.change(+text);
break;
break;
}
}
},
},
...
...
spec/javascripts/vue_shared/components/table_pagination_spec.js.es6
View file @
548a0b6a
...
@@ -6,12 +6,10 @@ describe('Pagination component', () => {
...
@@ -6,12 +6,10 @@ describe('Pagination component', () => {
const changeChanges = {
const changeChanges = {
one: '',
one: '',
two: '',
};
};
const change = (one
, two
) => {
const change = (one) => {
changeChanges.one = one;
changeChanges.one = one;
changeChanges.two = two;
};
};
it('should render and start at page 1', () => {
it('should render and start at page 1', () => {
...
@@ -34,7 +32,6 @@ describe('Pagination component', () => {
...
@@ -34,7 +32,6 @@ describe('Pagination component', () => {
component.changePage({ target: { innerText: '1' } });
component.changePage({ target: { innerText: '1' } });
expect(changeChanges.one).toEqual(1);
expect(changeChanges.one).toEqual(1);
expect(changeChanges.two).toEqual(null);
});
});
it('should go to the previous page', () => {
it('should go to the previous page', () => {
...
@@ -55,7 +52,6 @@ describe('Pagination component', () => {
...
@@ -55,7 +52,6 @@ describe('Pagination component', () => {
component.changePage({ target: { innerText: 'Prev' } });
component.changePage({ target: { innerText: 'Prev' } });
expect(changeChanges.one).toEqual(1);
expect(changeChanges.one).toEqual(1);
expect(changeChanges.two).toEqual(null);
});
});
it('should go to the next page', () => {
it('should go to the next page', () => {
...
@@ -76,7 +72,6 @@ describe('Pagination component', () => {
...
@@ -76,7 +72,6 @@ describe('Pagination component', () => {
component.changePage({ target: { innerText: 'Next' } });
component.changePage({ target: { innerText: 'Next' } });
expect(changeChanges.one).toEqual(5);
expect(changeChanges.one).toEqual(5);
expect(changeChanges.two).toEqual(null);
});
});
it('should go to the last page', () => {
it('should go to the last page', () => {
...
@@ -97,7 +92,6 @@ describe('Pagination component', () => {
...
@@ -97,7 +92,6 @@ describe('Pagination component', () => {
component.changePage({ target: { innerText: 'Last >>' } });
component.changePage({ target: { innerText: 'Last >>' } });
expect(changeChanges.one).toEqual(10);
expect(changeChanges.one).toEqual(10);
expect(changeChanges.two).toEqual(null);
});
});
it('should go to the first page', () => {
it('should go to the first page', () => {
...
@@ -118,7 +112,6 @@ describe('Pagination component', () => {
...
@@ -118,7 +112,6 @@ describe('Pagination component', () => {
component.changePage({ target: { innerText: '<< First' } });
component.changePage({ target: { innerText: '<< First' } });
expect(changeChanges.one).toEqual(1);
expect(changeChanges.one).toEqual(1);
expect(changeChanges.two).toEqual(null);
});
});
it('should do nothing', () => {
it('should do nothing', () => {
...
@@ -139,7 +132,6 @@ describe('Pagination component', () => {
...
@@ -139,7 +132,6 @@ describe('Pagination component', () => {
component.changePage({ target: { innerText: '...' } });
component.changePage({ target: { innerText: '...' } });
expect(changeChanges.one).toEqual(1);
expect(changeChanges.one).toEqual(1);
expect(changeChanges.two).toEqual(null);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment