branch develop updated (fc0ae77 -> 6f93a2b)
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 fc0ae77 fixes #6434 add some placeholders new 97d27e1 start review of user search new 3055de4 prepare advanced search on users new 2f41890 can switch simple/advanced search on user new 6f93a2b fixes #6205 Merge branch 'feature/6205-improve-user-search' into develop The 4 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 6f93a2b8480a9614ca2869e6196ab761f22bfdaf Merge: fc0ae77 2f41890 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Jan 15 10:53:32 2015 +0100 fixes #6205 Merge branch 'feature/6205-improve-user-search' into develop commit 2f4189087c965985e62fed77bf2710953bc5af49 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Jan 15 10:53:20 2015 +0100 can switch simple/advanced search on user commit 3055de44bd3bf4373390f7b992ec56f20d2e0d74 Author: Yannick Martel <martel@©odelutin.com> Date: Wed Jan 14 18:32:13 2015 +0100 prepare advanced search on users commit 97d27e102407cb13f8debed51e0d626ff5db454e Author: Yannick Martel <martel@©odelutin.com> Date: Wed Jan 14 15:43:15 2015 +0100 start review of user search Summary of changes: .../persistence/entity/CoselmarUserTopiaDao.java | 8 +-- .../fr/ifremer/coselmar/beans/UserSearchBean.java | 10 ++-- .../coselmar/services/v1/UsersWebService.java | 17 ++---- coselmar-rest/src/main/resources/mapping | 2 +- .../src/main/webapp/js/coselmar-controllers.js | 21 +++++++- .../src/main/webapp/js/coselmar-user-services.js | 26 +++------ coselmar-ui/src/main/webapp/views/users/users.html | 63 ++++++++++++++++++---- 7 files changed, 92 insertions(+), 55 deletions(-) -- 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 97d27e102407cb13f8debed51e0d626ff5db454e Author: Yannick Martel <martel@©odelutin.com> Date: Wed Jan 14 15:43:15 2015 +0100 start review of user search --- .../persistence/entity/CoselmarUserTopiaDao.java | 8 ++------ .../java/fr/ifremer/coselmar/beans/UserSearchBean.java | 10 +++++----- .../ifremer/coselmar/services/v1/UsersWebService.java | 17 ++++------------- coselmar-rest/src/main/resources/mapping | 2 +- .../src/main/webapp/js/coselmar-user-services.js | 3 +-- 5 files changed, 13 insertions(+), 27 deletions(-) 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 ddf63ca..efa1174 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 @@ -119,7 +119,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 onlyActive, SearchRequestBean searchRequest) { + public List<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 @@ -127,14 +127,10 @@ public class CoselmarUserTopiaDao extends AbstractCoselmarUserTopiaDao<CoselmarU Map<String, Object> args = new HashMap<>(); // only active ? - if (onlyActive) { + if (!activeAndInactive) { String activeCondition = DaoUtils.andAttributeEquals("CU", CoselmarUser.PROPERTY_ACTIVE, args, true); hqlBuilder.append(activeCondition); - } else { - String activeCondition = DaoUtils.andAttributeEquals("CU", CoselmarUser.PROPERTY_ACTIVE, args, example.isActive()); - hqlBuilder.append(activeCondition); - } // Search on FirstName ? diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserSearchBean.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserSearchBean.java index 0c5026d..e4d1eb9 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserSearchBean.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserSearchBean.java @@ -36,7 +36,7 @@ public class UserSearchBean extends UserBean { protected Integer limit; protected Integer page; protected List<String> fullTextSearch; - protected boolean onlyActive; + protected boolean activeAndInactive; public UserSearchBean(String id, String firstName, String name, String mail, String phoneNumber, String role, String qualification, String organization, boolean active) { super(id, firstName, name, mail, phoneNumber, role, qualification, organization, active); @@ -66,11 +66,11 @@ public class UserSearchBean extends UserBean { this.fullTextSearch = fullTextSearch; } - public boolean isOnlyActive() { - return onlyActive; + public boolean isActiveAndInactive() { + return activeAndInactive; } - public void setOnlyActive(boolean onlyActive) { - this.onlyActive = onlyActive; + public void setActiveAndInactive(boolean activeAndInactive) { + this.activeAndInactive = activeAndInactive; } } 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 e95711e..dcfcdcf 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 @@ -27,7 +27,6 @@ package fr.ifremer.coselmar.services.v1; import java.io.StringWriter; import java.security.InvalidParameterException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Map; @@ -94,13 +93,10 @@ public class UsersWebService extends CoselmarWebServiceSupport { return userBean; } - public List<UserBean> getUsers(String searchKeyword, UserSearchBean search, boolean onlyActive) { + public List<UserBean> getUsers(UserSearchBean search) { List<CoselmarUser> userList; - if (StringUtils.isNotBlank(searchKeyword)) { - userList = getCoselmarUserDao().findAllLikeKeywords(Arrays.asList(searchKeyword), onlyActive); - - } else if (search != null) { + if (search != null) { // Search default parameter if not given SearchRequestBean requestBean = new SearchRequestBean(); requestBean.setLimit(search.getLimit()); @@ -109,15 +105,10 @@ public class UsersWebService extends CoselmarWebServiceSupport { CoselmarUser example = BeanEntityConverter.fromBean(search); - userList = getCoselmarUserDao().findAllByExample(example, search.isOnlyActive(), requestBean); + userList = getCoselmarUserDao().findAllByExample(example, search.isActiveAndInactive(), requestBean); } else { - if (onlyActive) { - userList = getCoselmarUserDao().forActiveEquals(true).findAll(); - - } else { - userList = getCoselmarUserDao().findAll(); - } + userList = getCoselmarUserDao().findAll(); } diff --git a/coselmar-rest/src/main/resources/mapping b/coselmar-rest/src/main/resources/mapping index b74e068..1a93585 100644 --- a/coselmar-rest/src/main/resources/mapping +++ b/coselmar-rest/src/main/resources/mapping @@ -41,7 +41,7 @@ DELETE /v1/documents/{documentId} DocumentsWebService.deleteDocume # Users Api -GET /v1/users UsersWebService.getUsers onlyActive=true +GET /v1/users UsersWebService.getUsers GET /v1/users/{userId} UsersWebService.getUser POST /v1/users/login UsersWebService.login POST /v1/users/{userId} UsersWebService.modifyUser 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 437bff1..b0b61fd 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js @@ -70,8 +70,7 @@ function User(resource, config){ this.getUsers = function(searchKeywords, showDisable, successFunction){ // Load all users - - var userResource = resource(baseURL, {'searchKeywords' : searchKeywords, 'onlyActive' : !showDisable}); + var userResource = resource(baseURL, {'search' : {'fullTextSearch' : searchKeywords, 'activeAndInactive': showDisable}}); userResource.query(successFunction); } -- 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 3055de44bd3bf4373390f7b992ec56f20d2e0d74 Author: Yannick Martel <martel@©odelutin.com> Date: Wed Jan 14 18:32:13 2015 +0100 prepare advanced search on users --- .../src/main/webapp/js/coselmar-controllers.js | 21 ++++++++- .../src/main/webapp/js/coselmar-user-services.js | 25 +++-------- coselmar-ui/src/main/webapp/views/users/users.html | 51 ++++++++++++++++++---- 3 files changed, 70 insertions(+), 27 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 1d0e8af..ddd2f53 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -206,6 +206,8 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', //manage keywords if given $scope.search = { searchKeyword : ''}; + $scope.example = {}; + var keywords = $routeParams.keywords; if (Array.isArray(keywords)) { $scope.search.searchKeyword = keywords[0]; @@ -255,7 +257,24 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.searchUsers = function(){ $location.search('keywords', $scope.search.searchKeyword); $location.search('showDisable', $scope.search.showDisable); - } + }; + + $scope.advancedSearchUsers = function() { + if ($scope.example.role && $scope.example.role == "ALL") { + delete $scope.example.role; + }; + if ($scope.example.active) { + if($scope.example.active == "true") { + $scope.example.active = true; + } else { + $scope.example.active = false; + }; + }; + console.log($scope.example); + userService.getAdvancedUsers($scope.example, function(users){ + $scope.users = users; + }); + }; }]); 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 b0b61fd..52a44e3 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js @@ -72,7 +72,13 @@ function User(resource, config){ // Load all users var userResource = resource(baseURL, {'search' : {'fullTextSearch' : searchKeywords, 'activeAndInactive': showDisable}}); userResource.query(successFunction); - } + }; + + this.getAdvancedUsers = function(searchExample, successFunction){ + // Load all users + var userResource = resource(baseURL, {'search' : searchExample}); + userResource.query(successFunction); + }; this.login = function(mail, password, successFunction, failFunction){ @@ -91,21 +97,4 @@ function User(resource, config){ userResource.post(credentials, successFunction, failFunction); } -// this.saveUser = function(user, successFunction, failFunction){ -// -// var formData = new FormData(); -// formData.append("user", JSON.stringify(user)); -// -// // Save the User -// var userResource = resource(baseURL + "/" + user.id, null, { -// 'save': { -// method: 'POST', -// transformRequest: angular.identity, -// headers:{ -// 'Content-Type': undefined -// } -// } -// }); -// userResource.save(null, formData, successFunction, failFunction); -// } }; \ 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 75fbc0a..db11036 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -34,7 +34,7 @@ <div class="form-group"> <a href="#/users/new" class="form-inline navbar-left btn btn-primary">Add an user</a> </div> - <form class="form-inline pull-right" role="userOptions" ng-submit="searchUsers()"> + <form class="form-inline pull-right" name="userOptions" role="userOptions" ng-submit="searchUsers()"> <div class="form-group"> <input type="checkbox" class="form-control" ng-model="search.showDisable" /> <span>Show Disable</span> @@ -51,13 +51,48 @@ <br/> <table class="table"> <tr> - <th>Name</th> - <th>Mail</th> - <th>Qualification</th> - <th>Organization</th> - <th>Role</th> - <th>Status</th> - <th></th> + <form class="form-inline" name="userFullOption" role="userFullOptions" ng-submit="advancedSearchUsers()"> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Name" ng-model="example.name" /> + </td> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Mail" ng-model="example.mail" /> + </td> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Qualification" ng-model="example.qualification" /> + </td> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Organization" ng-model="example.organization" /> + </td> + <td class="form-group"> + <select class="form-control" name="role" ng-model="example.role" title="role" > + <option value="ALL">All</option> + <option value="ADMIN">Admin</option> + <option value="SUPERVISOR">Supervisor</option> + <option value="EXPERT">Expert</option> + <option value="MEMBER">Member</option> + <option value="CLIENT">Client</option> + </select> + </td> + <td class="form-group"> + <select class="form-control" name="active" ng-model="example.active" title="active" > + <option value="true">Active</option> + <option value="false">Inactive</option> + </select> + </td> + <td class="form-group text-center"> + <button type="submit" class="btn btn-default fa fa-search"></button> + </td> + </form> + </tr> + <tr> + <th class="col-md-1">Name</th> + <th class="col-md-2">Mail</th> + <th class="col-md-2">Qualification</th> + <th class="col-md-2">Organization</th> + <th class="col-md-1">Role</th> + <th class="col-md-1">Status</th> + <th class="col-md-1"></th> </tr> <tr ng-repeat="user in users"> <td><a href="#/users/{{user.id}}">{{user.firstname}} {{user.name}}</a></td> -- 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 2f4189087c965985e62fed77bf2710953bc5af49 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Jan 15 10:53:20 2015 +0100 can switch simple/advanced search on user --- coselmar-ui/src/main/webapp/views/users/users.html | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/coselmar-ui/src/main/webapp/views/users/users.html b/coselmar-ui/src/main/webapp/views/users/users.html index db11036..765d71a 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -30,11 +30,11 @@ </div> <div class="table-responsive"> - <div> - <div class="form-group"> + <div class="row"> + <div class="form-group col-md-5"> <a href="#/users/new" class="form-inline navbar-left btn btn-primary">Add an user</a> </div> - <form class="form-inline pull-right" name="userOptions" role="userOptions" ng-submit="searchUsers()"> + <form class="form-inline cold-md-7" name="userOptions" role="userOptions" ng-submit="searchUsers()" ng-if="!advanced"> <div class="form-group"> <input type="checkbox" class="form-control" ng-model="search.showDisable" /> <span>Show Disable</span> @@ -47,10 +47,18 @@ </div> </form> </div> + <div class="row"> + <div class="form-group col-md-5" ng-show="!advanced"> + <a ng-click="advanced=true" class="fa fa-sort-down">Advanced Search</a> + </div> + <div class="form-group col-md-5" ng-show="advanced"> + <a ng-click="advanced=false" class="fa fa-sort-up">Simple Search</a> + </div> + </div> <br/> <table class="table"> - <tr> + <tr ng-if="advanced"> <form class="form-inline" name="userFullOption" role="userFullOptions" ng-submit="advancedSearchUsers()"> <td class="form-group"> <input type="search" class="form-control" placeholder="Name" ng-model="example.name" /> @@ -81,16 +89,16 @@ </select> </td> <td class="form-group text-center"> - <button type="submit" class="btn btn-default fa fa-search"></button> + <button type="submit" class="btn btn-default fa fa-search" ng-click="advancedSearchUsers()">Search</button> </td> </form> </tr> <tr> - <th class="col-md-1">Name</th> + <th class="col-md-2">Name</th> <th class="col-md-2">Mail</th> <th class="col-md-2">Qualification</th> <th class="col-md-2">Organization</th> - <th class="col-md-1">Role</th> + <th class="col-md-2">Role</th> <th class="col-md-1">Status</th> <th class="col-md-1"></th> </tr> -- 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 6f93a2b8480a9614ca2869e6196ab761f22bfdaf Merge: fc0ae77 2f41890 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Jan 15 10:53:32 2015 +0100 fixes #6205 Merge branch 'feature/6205-improve-user-search' into develop .../persistence/entity/CoselmarUserTopiaDao.java | 8 +-- .../fr/ifremer/coselmar/beans/UserSearchBean.java | 10 ++-- .../coselmar/services/v1/UsersWebService.java | 17 ++---- coselmar-rest/src/main/resources/mapping | 2 +- .../src/main/webapp/js/coselmar-controllers.js | 21 +++++++- .../src/main/webapp/js/coselmar-user-services.js | 26 +++------ coselmar-ui/src/main/webapp/views/users/users.html | 63 ++++++++++++++++++---- 7 files changed, 92 insertions(+), 55 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm