branch develop updated (8ccab65 -> 9934395)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git from 8ccab65 Add an Admin link in menu new 9934395 Add pagniation on users list \o/ The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 9934395e16cbdec310157a39f0ab41125df473b5 Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 2 16:25:06 2016 +0100 Add pagniation on users list \o/ Summary of changes: .../src/main/webapp/js/coselmar-constants.js | 2 +- .../persistence/entity/CoselmarUserTopiaDao.java | 5 +- .../coselmar/services/v1/UsersWebService.java | 32 ++++++++--- coselmar-rest/src/main/resources/mapping | 1 + coselmar-ui/src/main/webapp/i18n/en.js | 4 ++ coselmar-ui/src/main/webapp/i18n/fr.js | 4 ++ coselmar-ui/src/main/webapp/index.html | 1 + .../src/main/webapp/js/coselmar-admin-services.js | 2 +- .../src/main/webapp/js/coselmar-constants.js | 4 +- .../src/main/webapp/js/coselmar-controllers.js | 29 ++++++++-- .../main/webapp/js/coselmar-general-services.js | 2 +- coselmar-ui/src/main/webapp/js/coselmar-health.js | 2 +- .../main/webapp/js/coselmar-questions-services.js | 6 +- .../src/main/webapp/js/coselmar-services.js | 4 +- .../src/main/webapp/js/coselmar-user-services.js | 12 +++- coselmar-ui/src/main/webapp/js/paginationBinder.js | 67 ++++++++++++++++++++++ .../src/main/webapp/views/paginationTemplate.html | 16 ++++++ .../src/main/webapp/views/users/adminUsers.html | 3 +- .../main/webapp/views/users/supervisorUsers.html | 3 +- coselmar-ui/src/main/webapp/views/users/users.html | 4 +- 20 files changed, 172 insertions(+), 31 deletions(-) create mode 100644 coselmar-ui/src/main/webapp/js/paginationBinder.js create mode 100644 coselmar-ui/src/main/webapp/views/paginationTemplate.html -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 9934395e16cbdec310157a39f0ab41125df473b5 Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 2 16:25:06 2016 +0100 Add pagniation on users list \o/ --- .../src/main/webapp/js/coselmar-constants.js | 2 +- .../persistence/entity/CoselmarUserTopiaDao.java | 5 +- .../coselmar/services/v1/UsersWebService.java | 32 ++++++++--- coselmar-rest/src/main/resources/mapping | 1 + coselmar-ui/src/main/webapp/i18n/en.js | 4 ++ coselmar-ui/src/main/webapp/i18n/fr.js | 4 ++ coselmar-ui/src/main/webapp/index.html | 1 + .../src/main/webapp/js/coselmar-admin-services.js | 2 +- .../src/main/webapp/js/coselmar-constants.js | 4 +- .../src/main/webapp/js/coselmar-controllers.js | 29 ++++++++-- .../main/webapp/js/coselmar-general-services.js | 2 +- coselmar-ui/src/main/webapp/js/coselmar-health.js | 2 +- .../main/webapp/js/coselmar-questions-services.js | 6 +- .../src/main/webapp/js/coselmar-services.js | 4 +- .../src/main/webapp/js/coselmar-user-services.js | 12 +++- coselmar-ui/src/main/webapp/js/paginationBinder.js | 67 ++++++++++++++++++++++ .../src/main/webapp/views/paginationTemplate.html | 16 ++++++ .../src/main/webapp/views/users/adminUsers.html | 3 +- .../main/webapp/views/users/supervisorUsers.html | 3 +- coselmar-ui/src/main/webapp/views/users/users.html | 4 +- 20 files changed, 172 insertions(+), 31 deletions(-) diff --git a/coselmar-bundle/src/main/webapp/js/coselmar-constants.js b/coselmar-bundle/src/main/webapp/js/coselmar-constants.js index 97b7520..a268128 100644 --- a/coselmar-bundle/src/main/webapp/js/coselmar-constants.js +++ b/coselmar-bundle/src/main/webapp/js/coselmar-constants.js @@ -22,6 +22,6 @@ * #L% */ coselmarApp.constant('coselmarConfig', { - BASE_URL : "v1", + BASE_URL : "", SUPPORTED_LOCALE : ["en", "fr"] }); \ No newline at end of file diff --git a/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/CoselmarUserTopiaDao.java b/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/CoselmarUserTopiaDao.java index 45e81e1..8bc7df7 100644 --- a/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/CoselmarUserTopiaDao.java +++ b/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/CoselmarUserTopiaDao.java @@ -32,6 +32,7 @@ import fr.ifremer.coselmar.persistence.DaoUtils; import fr.ifremer.coselmar.persistence.SearchRequestBean; import org.apache.commons.lang3.StringUtils; import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; public class CoselmarUserTopiaDao extends AbstractCoselmarUserTopiaDao<CoselmarUser> { @@ -120,7 +121,7 @@ public class CoselmarUserTopiaDao extends AbstractCoselmarUserTopiaDao<CoselmarU * @return Users thats contains in a property at least all given keywords * */ - public List<CoselmarUser> findAllByExample(CoselmarUser example, boolean activeAndInactive, SearchRequestBean searchRequest) { + public PaginationResult<CoselmarUser> findAllByExample(CoselmarUser example, boolean activeAndInactive, SearchRequestBean searchRequest) { StringBuilder hqlBuilder = new StringBuilder("FROM " + CoselmarUser.class.getName() + " CU"); hqlBuilder.append(" WHERE 1=1 "); // Just because next clause will begin with operator @@ -207,7 +208,7 @@ public class CoselmarUserTopiaDao extends AbstractCoselmarUserTopiaDao<CoselmarU PaginationParameter paginationParameter = PaginationParameter.of(searchRequest.getPage(), searchRequest.getLimit(), CoselmarUser.PROPERTY_MAIL, false); - List<CoselmarUser> coselmarUsers = forHql(hqlBuilder.toString(), args).find(paginationParameter); + PaginationResult<CoselmarUser> coselmarUsers = forHql(hqlBuilder.toString(), args).findPage(paginationParameter); return coselmarUsers; } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java index e4c72e6..31c36df 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java @@ -40,6 +40,7 @@ import com.github.mustachejava.MustacheFactory; import com.google.common.base.Preconditions; import fr.ifremer.coselmar.beans.AbstractMail; import fr.ifremer.coselmar.beans.LostPasswordMail; +import fr.ifremer.coselmar.beans.SearchExample; import fr.ifremer.coselmar.beans.UserAccountCreatedMail; import fr.ifremer.coselmar.beans.UserBean; import fr.ifremer.coselmar.beans.UserExportModel; @@ -67,6 +68,8 @@ import org.debux.webmotion.server.render.Render; import org.nuiton.csv.Export; import org.nuiton.topia.persistence.TopiaNoResultException; import org.nuiton.util.StringUtil; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; import static org.apache.commons.logging.LogFactory.getLog; @@ -115,6 +118,14 @@ public class UsersWebService extends CoselmarWebServiceSupport { public List<UserBean> getUsers(UserSearchBean search) throws InvalidCredentialException, UnauthorizedException { + PaginationResult<UserBean> paginatedUsers = getPaginatedUsers(search); + List<UserBean> result = paginatedUsers.getElements(); + + return result; + } + + public PaginationResult<UserBean> getPaginatedUsers(UserSearchBean search) throws InvalidCredentialException, UnauthorizedException { + // Check authentication String authorization = getContext().getHeader("Authorization"); UserWebToken userWebToken = checkAuthentication(authorization); @@ -129,7 +140,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { throw new UnauthorizedException("Not allowed to see users"); } - List<CoselmarUser> userList; + PaginationResult<CoselmarUser> usersPage; if (search != null) { // Search default parameter if not given SearchRequestBean requestBean = new SearchRequestBean(); @@ -139,22 +150,25 @@ public class UsersWebService extends CoselmarWebServiceSupport { CoselmarUser example = BeanEntityConverter.fromBean(search); - userList = getCoselmarUserDao().findAllByExample(example, search.isActiveAndInactive(), requestBean); + usersPage = getCoselmarUserDao().findAllByExample(example, search.isActiveAndInactive(), requestBean); } else { - userList = getCoselmarUserDao().findAll(); + PaginationParameter paginationParameter = PaginationParameter.of(0, -1); + usersPage = getCoselmarUserDao().forAll().findPage(paginationParameter); } - List<UserBean> result = new ArrayList<>(userList.size()); + List<UserBean> result = new ArrayList<>(usersPage.getElements().size()); - for (CoselmarUser user : userList) { + for (CoselmarUser user : usersPage.getElements()) { String userLightId = getPersistenceContext().getTopiaIdFactory().getRandomPart(user.getTopiaId()); UserBean userBean = BeanEntityConverter.toBean(userLightId, user); result.add(userBean); } - return result; + PaginationResult paginationResult = PaginationResult.of(result, usersPage.getCount(), usersPage.getCurrentPage()); + + return paginationResult; } public List<UserBean> getExperts(UserSearchBean search) throws InvalidCredentialException, UnauthorizedException { @@ -185,7 +199,8 @@ public class UsersWebService extends CoselmarWebServiceSupport { CoselmarUser example = BeanEntityConverter.fromBean(search); example.setRole(CoselmarUserRole.EXPERT);// we search experts here, force it ! - userList = getCoselmarUserDao().findAllByExample(example, search.isActiveAndInactive(), requestBean); + PaginationResult<CoselmarUser> userPaginationResult = getCoselmarUserDao().findAllByExample(example, search.isActiveAndInactive(), requestBean); + userList = userPaginationResult.getElements(); } else { userList = getCoselmarUserDao().forRoleEquals(CoselmarUserRole.EXPERT).findAll(); @@ -474,7 +489,8 @@ public class UsersWebService extends CoselmarWebServiceSupport { CoselmarUser example = BeanEntityConverter.fromBean(searchOption); - userList = getCoselmarUserDao().findAllByExample(example, searchOption.isActiveAndInactive(), requestBean); + PaginationResult<CoselmarUser> userPaginationResult = getCoselmarUserDao().findAllByExample(example, searchOption.isActiveAndInactive(), requestBean); + userList = userPaginationResult.getElements(); } else { userList = getCoselmarUserDao().findAll(); diff --git a/coselmar-rest/src/main/resources/mapping b/coselmar-rest/src/main/resources/mapping index c001b21..f7d274b 100644 --- a/coselmar-rest/src/main/resources/mapping +++ b/coselmar-rest/src/main/resources/mapping @@ -44,6 +44,7 @@ DELETE /v1/documents/{documentId} DocumentsWebService.deleteDocume # Users Api GET /v1/users UsersWebService.getUsers +GET /v2/users UsersWebService.getPaginatedUsers GET /v1/users/experts UsersWebService.getExperts GET /v1/users/{userId} UsersWebService.getUser POST /v1/users/login UsersWebService.login diff --git a/coselmar-ui/src/main/webapp/i18n/en.js b/coselmar-ui/src/main/webapp/i18n/en.js index 45f7a3b..ccea16d 100644 --- a/coselmar-ui/src/main/webapp/i18n/en.js +++ b/coselmar-ui/src/main/webapp/i18n/en.js @@ -364,4 +364,8 @@ var translateEN = { "common.message.info.searchKeywords" : "You can use several keywords separating them by coma. Search will match all given keywords", +"pagination.results.perPage" : "Number of results per page", +"pagination.results.page" : "Page", +"pagination.results.of" : "of", + } \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/i18n/fr.js b/coselmar-ui/src/main/webapp/i18n/fr.js index 03ebe5a..baac462 100644 --- a/coselmar-ui/src/main/webapp/i18n/fr.js +++ b/coselmar-ui/src/main/webapp/i18n/fr.js @@ -365,4 +365,8 @@ var translateFR = { "common.message.info.searchKeywords" : "Vous pouvez utiliser plusieurs mots-clefs en les séparant par une virgule. La recherche sera faite avec tous les mots-clefs.", +"pagination.results.perPage" : "Nombre de résultats par page", +"pagination.results.page" : "Page", +"pagination.results.of" : "sur", + } \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/index.html b/coselmar-ui/src/main/webapp/index.html index d939a8b..061ea42 100644 --- a/coselmar-ui/src/main/webapp/index.html +++ b/coselmar-ui/src/main/webapp/index.html @@ -69,6 +69,7 @@ <script src="js/coselmar-questions-services.js"></script> <script src="js/coselmar-admin-services.js"></script> <script src="js/coselmar-error-services.js"></script> + <script src="js/paginationBinder.js"></script> <script src="js/d3-2waytree-graph.js"></script> <script src="js/d3.layout.js"></script> </head> diff --git a/coselmar-ui/src/main/webapp/js/coselmar-admin-services.js b/coselmar-ui/src/main/webapp/js/coselmar-admin-services.js index 5f152a1..9a2da38 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-admin-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-admin-services.js @@ -30,7 +30,7 @@ function Admin(resource, config){ this.resource = resource; - var baseURL = config.BASE_URL + "/admin"; + var baseURL = config.BASE_URL + "v1/admin"; this.refreshIndex = function(successFunction, failFunction){ diff --git a/coselmar-ui/src/main/webapp/js/coselmar-constants.js b/coselmar-ui/src/main/webapp/js/coselmar-constants.js index a8386c2..f6f0e2f 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-constants.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-constants.js @@ -24,7 +24,7 @@ // DON'T FORGET TO EDIT ONE IN BUNDLE MODULE \\ coselmarApp.constant('coselmarConfig', { - BASE_URL : "http://localhost:8081/services/v1", + BASE_URL : "http://localhost:8081/services/", SUPPORTED_LOCALE : ["en", "fr"] }); @@ -33,7 +33,7 @@ coselmarApp.config(function($sceDelegateProvider, coselmarConfig) { // Allow same origin resource loads. 'self', // Allow loading from our assets domain. Notice the difference between * and **. - coselmarConfig.BASE_URL+'/**' + coselmarConfig.BASE_URL+'**' ]); }); \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 5e97aef..39dd801 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -601,7 +601,7 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.$emit('dataLoading'); //manage keywords if given - $scope.example = { fullTextSearch : [], active : "true", role : ''}; + $scope.example = { fullTextSearch : [], active : "true", role : '', page: 0, limit: 25}; var keywords = $routeParams.keywords; if (Array.isArray(keywords)) { @@ -623,8 +623,9 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.advanced = false; } - userService.getUsers($scope.example.fullTextSearch, $scope.example.showDisable, function(users) { - $scope.users = users; + userService.getPaginatedUsers($scope.example, function(paginatedUsers) { + $scope.paginationData = paginatedUsers; + $scope.$broadcast('pageLoaded', $scope.paginationData.currentPage, paginatedUsers.count) }, errorService.defaultFailOnCall, function() { $scope.$emit('dataLoaded'); }); @@ -714,7 +715,19 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.getToken = function() { return localStorage.getItem('coselmar-jwt'); - } + }; + + $scope.$on('loadPage', function(event, pageNumber, pageSize) { + $scope.example.page = pageNumber; + $scope.example.limit = pageSize; + userService.getPaginatedUsers($scope.example, function(paginatedUsers) { + $scope.paginationData = paginatedUsers; + }, errorService.defaultFailOnCall, function() { + $scope.$broadcast('pageLoaded', $scope.paginationData.currentPage, $scope.paginationData.count); + $scope.$emit('dataLoaded'); + }); + }); + }]); // Controller for new user View @@ -2085,4 +2098,12 @@ coselmarControllers.directive('datepickerPopup', function (){ controller.$formatters.shift(); } } +}); + + +coselmarControllers.directive('paginationTool', function() { + return { +// restrict: 'E', + templateUrl: 'views/paginationTemplate.html' + }; }); \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/js/coselmar-general-services.js b/coselmar-ui/src/main/webapp/js/coselmar-general-services.js index c8b0f64..461c262 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-general-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-general-services.js @@ -30,7 +30,7 @@ function GeneralService(http, config){ this.http = http; - var baseURL = config.BASE_URL + "/general"; + var baseURL = config.BASE_URL + "v1/general"; this.getTopWords = function(successFunction, failFunction) { diff --git a/coselmar-ui/src/main/webapp/js/coselmar-health.js b/coselmar-ui/src/main/webapp/js/coselmar-health.js index 38abd75..02b73c1 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-health.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-health.js @@ -26,7 +26,7 @@ coselmarApp.controller("HealthCtrl", ['$scope', '$http', 'coselmar-config', func $scope.health = {"dbUp": false, "version": "unknown", "indexationUp": false, "devMode": false}; - var healthUrl = coselmarConfig.BASE_URL + "/health"; + var healthUrl = coselmarConfig.BASE_URL + "v1/health"; $http.get(healthUrl).then(function(result) { console.log(result); diff --git a/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js b/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js index 5f1217f..7c6701d 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-questions-services.js @@ -30,9 +30,9 @@ function Question(resource, http, config){ this.resource = resource; - var baseURL = config.BASE_URL + "/questions"; - var exportURL = config.BASE_URL + "/export/questions"; - var usersURL = config.BASE_URL + "/users"; + var baseURL = config.BASE_URL + "v1/questions"; + var exportURL = config.BASE_URL + "v1/export/questions"; + var usersURL = config.BASE_URL + "v1/users"; this.saveQuestion = function(question, successFunction, failFunction, finallyFunction){ diff --git a/coselmar-ui/src/main/webapp/js/coselmar-services.js b/coselmar-ui/src/main/webapp/js/coselmar-services.js index 09d5438..2129d30 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-services.js @@ -31,8 +31,8 @@ function Document(resource, config){ this.resource = resource; - var baseURL = config.BASE_URL + "/documents"; - var usersURL = config.BASE_URL + "/users"; + var baseURL = config.BASE_URL + "v1/documents"; + var usersURL = config.BASE_URL + "v1/users"; this.saveDocument = function(document, successFunction, failFunction, finallyFunction) { diff --git a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js index 8af4222..439a679 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js @@ -30,8 +30,9 @@ function User(resource, config){ this.resource = resource; - var baseURL = config.BASE_URL + "/users"; - var exportURL = config.BASE_URL + "/export/users"; + var baseURL = config.BASE_URL + "v1/users"; + var baseV2URL = config.BASE_URL + "v2/users"; + var exportURL = config.BASE_URL + "v1/export/users"; this.saveUser = function(user, successFunction, failFunction, finallyFunction){ @@ -68,6 +69,13 @@ function User(resource, config){ userResource.query(successFunction, failFunction).$promise.finally(finallyFunction); }; + this.getPaginatedUsers = function(searchBean, successFunction, failFunction, finallyFunction){ + // Load all users + searchBean.active = true; + var userResource = resource(baseV2URL, {'search' : searchBean}); + userResource.get(successFunction, failFunction).$promise.finally(finallyFunction); + }; + this.getAdvancedUsers = function(searchExample, successFunction, failFunction, finallyFunction){ // Load all users var userResource = resource(baseURL, {'search' : searchExample}); diff --git a/coselmar-ui/src/main/webapp/js/paginationBinder.js b/coselmar-ui/src/main/webapp/js/paginationBinder.js new file mode 100644 index 0000000..a9b8fab --- /dev/null +++ b/coselmar-ui/src/main/webapp/js/paginationBinder.js @@ -0,0 +1,67 @@ +var paginationBinder = angular.module('coselmarApp'); + +paginationBinder.controller('paginationController', function($scope) { + $scope.pageSizes = [10, 25, 50, 100]; + + $scope.pageContext = { + pageNumber : 0, + pageSize : 25, + nbPages : 0, + firstPage : false, + lastPage : false, + }; + + $scope._loadPage = function(pageNumber, pageSize) { + $scope.$emit('loadPage', pageNumber, pageSize); + }; + + $scope.updatePageSize = function() { + $scope._loadPage(0, $scope.pageContext.pageSize); + }; + + $scope.toPage = function(pageNumber) { + $scope._loadPage(pageNumber, $scope.pageContext.pageSize); + }; + + $scope.toFirstPage = function() { + $scope._loadPage(0, $scope.pageContext.pageSize); + }; + + $scope.toLastPage = function() { + $scope._loadPage($scope.pageContext.nbPages, $scope.pageContext.pageSize); + }; + + $scope.toNextPage = function() { + $scope._loadPage($scope.pageContext.pageNumber + 1, $scope.pageContext.pageSize); + }; + + $scope.toPreviousPage = function() { + $scope._loadPage($scope.pageContext.pageNumber - 1, $scope.pageContext.pageSize); + }; + + $scope._updateContext = function(paginationParameter, nbElements) { + $scope.pageContext.pageNumber = paginationParameter.pageNumber; + $scope.pageContext.pageSize = paginationParameter.pageSize; + + if (paginationParameter.pageSize <= 0) { + $scope.pageContext.nbPages = 0; + } else { + $scope.pageContext.nbPages = Math.ceil(nbElements / paginationParameter.pageSize) - 1; + } + + $scope.pageContext.firstPage = $scope.pageContext.pageNumber == 0; + $scope.pageContext.lastPage = $scope.pageContext.pageNumber == $scope.pageContext.nbPages; + + }; + + /* On reçoit une notification de chargement de la page (du scope parent normalement) */ + $scope.$on('pageLoaded', function(event, paginationParameter, elementsCount) { + $scope._updateContext(paginationParameter, elementsCount); + }); + + // Chargement initial + if ($scope.paginationData && $scope.paginationData.currentPage) { + $scope._updateContext($scope.paginationData.currentPage, $scope.paginationData.count); + } + +}); \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/views/paginationTemplate.html b/coselmar-ui/src/main/webapp/views/paginationTemplate.html new file mode 100644 index 0000000..2486c96 --- /dev/null +++ b/coselmar-ui/src/main/webapp/views/paginationTemplate.html @@ -0,0 +1,16 @@ +<div ng-controller="paginationController"> + <div class="pager"> + <span ng-if="pageContext.firstPage === false"> + <i class="fa fa-chevron-circle-left" ng-click="toPreviousPage()"></i> + </span> + {{ 'pagination.results.page' | translate }} {{pageContext.pageNumber + 1}} {{ 'pagination.results.of' | translate }} {{pageContext.nbPages + 1}} + <span ng-if="pageContext.lastPage === false"> + <i class="fa fa-chevron-circle-right" ng-click="toNextPage()"></i> + </span> + </div> + <div class="pager-configuration"> + {{ 'pagination.results.perPage' | translate }} : <select ng-options="n for n in pageSizes" + ng-model="pageContext.pageSize" + ng-change="updatePageSize()"></select> + </div> +</div> diff --git a/coselmar-ui/src/main/webapp/views/users/adminUsers.html b/coselmar-ui/src/main/webapp/views/users/adminUsers.html index 19152b4..7fb0cb5 100644 --- a/coselmar-ui/src/main/webapp/views/users/adminUsers.html +++ b/coselmar-ui/src/main/webapp/views/users/adminUsers.html @@ -39,7 +39,7 @@ </tr> </thead> <tbody> - <tr ng-repeat="user in users"> + <tr ng-repeat="user in paginationData.elements"> <td><a href="#/users/{{user.id}}">{{user.firstName}} {{user.name}}</a></td> <td>{{user.mail}}</td> <td>{{user.qualification}}</td> @@ -70,4 +70,5 @@ </tr> </tbody> </table> + <pagination-tool></pagination-tool> </div> \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/views/users/supervisorUsers.html b/coselmar-ui/src/main/webapp/views/users/supervisorUsers.html index ab95f0f..8c3a458 100644 --- a/coselmar-ui/src/main/webapp/views/users/supervisorUsers.html +++ b/coselmar-ui/src/main/webapp/views/users/supervisorUsers.html @@ -39,7 +39,7 @@ </tr> </thead> <tbody> - <tr ng-repeat="user in users"> + <tr ng-repeat="user in paginationData.elements"> <td><a href="#/users/{{user.id}}">{{user.firstName}} {{user.name}}</a></td> <td>{{user.mail}}</td> <td>{{user.qualification}}</td> @@ -73,4 +73,5 @@ </tr> </tbody> </table> + <pagination-tool></pagination-tool> </div> \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/views/users/users.html b/coselmar-ui/src/main/webapp/views/users/users.html index 2642793..5042441 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -31,8 +31,8 @@ <div ng-include="src='views/users/adminUsers.html'" ng-if="context.currentUser.role == 'ADMIN'"></div> <div ng-include="src='views/users/supervisorUsers.html'" ng-if="context.currentUser.role == 'SUPERVISOR'"></div> - <p ng-if="users && users.length == 0" translate="common.search.noResult" class="info"/> - <div ng-if="users && users.length > 0" > + <p ng-if="!paginationData || !paginationData.elements || paginationData.elements.length == 0" translate="common.search.noResult" class="info"/> + <div ng-if="paginationData && paginationData.elements && paginationData.elements.length > 0" > <form action="{{getExportUsersUrl()}}" method="post" target="_blank"> <input type="hidden" name="searchOption" value="{{example}}" /> <input type="hidden" name="token" value="{{getToken()}}" /> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm