mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 13:41:28 -03:30
add missing pagination folder
This commit is contained in:
parent
c6f9dc90fb
commit
6a8955b817
11
awx/ui/client/src/shared/pagination/main.js
Normal file
11
awx/ui/client/src/shared/pagination/main.js
Normal file
@ -0,0 +1,11 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import pagination from './pagination.service';
|
||||
|
||||
export default
|
||||
angular.module('pagination', [])
|
||||
.factory('pagination', pagination);
|
||||
26
awx/ui/client/src/shared/pagination/pagination.service.js
Normal file
26
awx/ui/client/src/shared/pagination/pagination.service.js
Normal file
@ -0,0 +1,26 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
export default ['$q', '$http', function($q, $http) {
|
||||
return {
|
||||
getInitialPageForList: function(id, url, pageSize) {
|
||||
// get the name of the object
|
||||
return $http.get(url + "?id=" + id)
|
||||
.then(function (data) {
|
||||
var name = data.data.results[0].name;
|
||||
// get how many results are less than or equal to
|
||||
// the name
|
||||
return $http.get(url + "?name__lte=" + name)
|
||||
.then(function (data) {
|
||||
// divide by the page size to get what
|
||||
// page the data should be on
|
||||
var count = data.data.count;
|
||||
return Math.ceil(count/pageSize);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}];
|
||||
Loading…
x
Reference in New Issue
Block a user