Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
automatic project update
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubois committed Jun 19, 2016
1 parent e515395 commit 449b39e
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"en"
],
"serverPort": 8080,
"jhipsterVersion": "3.4.1",
"jhipsterVersion": "3.4.2",
"enableSocialSignIn": false,
"jwtSecretKey": "042e7d536354d3cdfab490925c55022efcb42bae",
"useSass": false,
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated on 2016-06-13 using generator-jhipster 3.4.1
// Generated on 2016-06-19 using generator-jhipster 3.4.2
'use strict';

var gulp = require('gulp'),
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "1.0.1",
"event-stream": "3.3.2",
"generator-jhipster": "3.4.1",
"generator-jhipster": "3.4.2",
"gulp": "3.9.1",
"gulp-angular-filesort": "1.1.1",
"gulp-angular-templatecache": "1.8.0",
"gulp-angular-templatecache": "1.9.0",
"gulp-autoprefixer": "3.1.0",
"gulp-changed": "1.3.0",
"gulp-cssnano": "2.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,36 @@
.module('jhipsterJwtSampleApplicationApp')
.controller('UserManagementController', UserManagementController);

UserManagementController.$inject = ['Principal', 'User', 'ParseLinks', 'paginationConstants', 'JhiLanguageService'];
UserManagementController.$inject = ['Principal', 'User', 'ParseLinks', '$state', 'pagingParams', 'paginationConstants', 'JhiLanguageService'];

function UserManagementController(Principal, User, ParseLinks, paginationConstants, JhiLanguageService) {
function UserManagementController(Principal, User, ParseLinks, $state, pagingParams, paginationConstants, JhiLanguageService) {
var vm = this;

vm.authorities = ['ROLE_USER', 'ROLE_ADMIN'];
vm.clear = clear;
vm.currentAccount = null;
vm.languages = null;
vm.links = null;
vm.loadAll = loadAll;
vm.loadPage = loadPage;
vm.page = 1;
vm.setActive = setActive;
vm.totalItems = null;
vm.users = [];

vm.page = 1;
vm.totalItems = null;
vm.clear = clear;
vm.links = null;
vm.loadPage = loadPage;
vm.predicate = pagingParams.predicate;
vm.reverse = pagingParams.ascending;
vm.itemsPerPage = paginationConstants.itemsPerPage;
vm.transition = transition;

vm.loadAll();


JhiLanguageService.getAll().then(function (languages) {
vm.languages = languages;
});

Principal.identity().then(function(account) {
vm.currentAccount = account;
});


function loadAll () {
User.query({page: vm.page - 1, size: paginationConstants.itemsPerPage}, function (result, headers) {
vm.links = ParseLinks.parse(headers('link'));
vm.totalItems = headers('X-Total-Count');

//hide anonymous user from user management: it's a required user for Spring Security
for(var i in result) {
if(result[i]['login'] === 'anonymoususer') {
result.splice(i,1);
}
}
vm.users = result;
});
}

function loadPage (page) {
vm.page = page;
vm.loadAll();
}

function setActive (user, isActivated) {
user.activated = isActivated;
User.update(user, function () {
Expand All @@ -63,15 +43,56 @@
});
}

function loadAll () {
User.query({
page: pagingParams.page - 1,
size: vm.itemsPerPage,
sort: sort()
}, onSuccess, onError);
}
function onSuccess (data, headers) {
//hide anonymous user from user management: it's a required user for Spring Security
for (var i in data) {
if (data[i]['login'] === 'anonymoususer') {
data.splice(i, 1);
}
}
vm.links = ParseLinks.parse(headers('link'));
vm.totalItems = headers('X-Total-Count');
vm.queryCount = vm.totalItems;
vm.page = pagingParams.page;
vm.users = data;
}
function onError (error) {
AlertService.error(error.data.message);
}
function clear () {
vm.user = {
id: null, login: null, firstName: null, lastName: null, email: null,
activated: null, langKey: null, createdBy: null, createdDate: null,
lastModifiedBy: null, lastModifiedDate: null, resetDate: null,
resetKey: null, authorities: null
};
vm.editForm.$setPristine();
vm.editForm.$setUntouched();
}
function sort () {
var result = [vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc')];
if (vm.predicate !== 'id') {
result.push('id');
}
return result;
}

function loadPage (page) {
vm.page = page;
vm.transition();
}

function transition () {
$state.transitionTo($state.$current, {
page: vm.page,
sort: vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc'),
search: vm.currentSearch
});
}
}
})();
19 changes: 9 additions & 10 deletions src/main/webapp/app/admin/user-management/user-management.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ <h2 translate="userManagement.home.title">Users</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th translate="global.field.id">ID</th>
<th translate="userManagement.login">Login</th>
<th translate="userManagement.email">Email</th>
<tr jh-sort="vm.predicate" ascending="vm.reverse" callback="vm.transition()">
<th jh-sort-by="id"><span translate="global.field.id">ID</span><span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="login"><span translate="userManagement.login">Login</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="email"><span translate="userManagement.email">Email</span> <span class="glyphicon glyphicon-sort"></span></th>
<th></th>
<th translate="userManagement.langKey">Lang Key</th>
<th translate="userManagement.profiles">Profiles</th>
<th translate="userManagement.createdDate">Created Date</th>
<th translate="userManagement.lastModifiedBy">Last Modified By</th>
<th translate="userManagement.lastModifiedDate">Last Modified Date</th>
<th jh-sort-by="langKey"> <span translate="userManagement.langKey">Lang Key</span> <span class="glyphicon glyphicon-sort"></span></th> <th><span translate="userManagement.profiles">Profiles</span></th> <th jh-sort-by="createdDate"><span translate="userManagement.createdDate">Created Date</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="lastModifiedBy"><span translate="userManagement.lastModifiedBy">Last Modified By</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="lastModifiedDate"><span translate="userManagement.lastModifiedDate">Last Modified Date</span> <span class="glyphicon glyphicon-sort"></span></th>
<th></th>
</tr>
</thead>
Expand Down Expand Up @@ -71,6 +69,7 @@ <h2 translate="userManagement.home.title">Users</h2>
</table>
</div>
<div class="text-center">
<uib-pagination class="pagination-sm" total-items="vm.totalItems" ng-model="vm.page" ng-change="vm.loadAll()"></uib-pagination>
<jhi-item-count page="vm.page" total="vm.queryCount" items-per-page="vm.itemsPerPage"></jhi-item-count>
<uib-pagination class="pagination-sm" total-items="vm.totalItems" ng-model="vm.page" ng-change="vm.transition()"></uib-pagination>
</div>
</div>
23 changes: 20 additions & 3 deletions src/main/webapp/app/admin/user-management/user-management.state.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$stateProvider
.state('user-management', {
parent: 'admin',
url: '/user-management',
url: '/user-management?page&sort',
data: {
authorities: ['ROLE_ADMIN'],
pageTitle: 'user-management.home.title'
Expand All @@ -22,14 +22,31 @@
controller: 'UserManagementController',
controllerAs: 'vm'
}
}, params: {
page: {
value: '1',
squash: true
},
sort: {
value: 'id,asc',
squash: true
}
},
resolve: {
pagingParams: ['$stateParams', 'PaginationUtil', function ($stateParams, PaginationUtil) {
return {
page: PaginationUtil.parsePage($stateParams.page),
sort: $stateParams.sort,
predicate: PaginationUtil.parsePredicate($stateParams.sort),
ascending: PaginationUtil.parseAscending($stateParams.sort)
};
}],
translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
$translatePartialLoader.addPart('user-management');
return $translate.refresh();
}]
}
})

} })
.state('user-management-detail', {
parent: 'admin',
url: '/user/:login',
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/layouts/navbar/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</li>
<li ui-sref-active="active" ng-switch-when="true">
<a ui-sref="password" ng-click="vm.collapseNavbar()">
<span class="glyphicon glyphicon-lock"></span>
<span class="glyphicon glyphicon-lock"></span>&nbsp;
<span translate="global.menu.account.password">Password</span>
</a>
</li>
Expand Down

0 comments on commit 449b39e

Please sign in to comment.