Details
diff --git a/themes/src/main/resources/theme/base/admin/resources/js/app.js b/themes/src/main/resources/theme/base/admin/resources/js/app.js
index c3b25ec..eeae412 100755
--- a/themes/src/main/resources/theme/base/admin/resources/js/app.js
+++ b/themes/src/main/resources/theme/base/admin/resources/js/app.js
@@ -2678,3 +2678,44 @@ module.directive('kcOnReadFile', function ($parse) {
}
};
});
+
+module.controller('PagingCtrl', function ($scope) {
+ $scope.isLastPage = function()
+ {
+ if ($scope.currentPage === $scope.numberOfPages) {
+ return true;
+ }
+ return false;
+ };
+
+ $scope.isFirstPage = function()
+ {
+ if ($scope.currentPage === 1) {
+ return true;
+ }
+ return false;
+ };
+});
+
+module.directive('kcPaging', function () {
+ return {
+ scope: {
+ currentPage: '=',
+ numberOfPages: '='
+ },
+ restrict: 'A',
+ replace: true,
+ controller: 'PagingCtrl',
+ templateUrl: resourceUrl + '/templates/kc-paging.html'
+ }
+});
+
+module.filter('startFrom', function () {
+ return function (input, start) {
+ if (input) {
+ start = +start;
+ return input.slice(start);
+ }
+ return [];
+ };
+});
\ No newline at end of file
diff --git a/themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js b/themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js
index 4b33b14..d81882d 100755
--- a/themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js
+++ b/themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js
@@ -731,9 +731,19 @@ module.controller('ClientImportCtrl', function($scope, $location, $upload, realm
});
-module.controller('ClientListCtrl', function($scope, realm, clients, Client, serverInfo, $route, Dialog, Notifications) {
+module.controller('ClientListCtrl', function($scope, realm, clients, Client, serverInfo, $route, Dialog, Notifications, filterFilter) {
$scope.realm = realm;
$scope.clients = clients;
+ $scope.currentPage = 1;
+ $scope.pageSize = 20;
+ $scope.numberOfPages = Math.ceil($scope.clients.length/$scope.pageSize);
+
+ $scope.$watch('search', function (newVal, oldVal) {
+ $scope.filtered = filterFilter($scope.clients, newVal);
+ $scope.totalItems = $scope.filtered.length;
+ $scope.numberOfPages = Math.ceil($scope.totalItems/$scope.pageSize);
+ $scope.currentPage = 1;
+ }, true);
$scope.removeClient = function(client) {
Dialog.confirmDelete(client.clientId, 'client', function() {
diff --git a/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
index 1589ffd..a42ef3c 100644
--- a/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
+++ b/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
@@ -1223,9 +1223,19 @@ module.controller('RealmRevocationCtrl', function($scope, Realm, RealmPushRevoca
});
-module.controller('RoleListCtrl', function($scope, $route, Dialog, Notifications, realm, roles, RoleById) {
+module.controller('RoleListCtrl', function($scope, $route, Dialog, Notifications, realm, roles, RoleById, filterFilter) {
$scope.realm = realm;
$scope.roles = roles;
+ $scope.currentPage = 1;
+ $scope.pageSize = 20;
+ $scope.numberOfPages = Math.ceil($scope.roles.length/$scope.pageSize);
+
+ $scope.$watch('searchQuery', function (newVal, oldVal) {
+ $scope.filtered = filterFilter($scope.roles, newVal);
+ $scope.totalItems = $scope.filtered.length;
+ $scope.numberOfPages = Math.ceil($scope.totalItems/$scope.pageSize);
+ $scope.currentPage = 1;
+ }, true);
$scope.removeRole = function (role) {
Dialog.confirmDelete(role.name, 'role', function () {
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/client-list.html b/themes/src/main/resources/theme/base/admin/resources/partials/client-list.html
index 7f796e9..50c71dc 100755
--- a/themes/src/main/resources/theme/base/admin/resources/partials/client-list.html
+++ b/themes/src/main/resources/theme/base/admin/resources/partials/client-list.html
@@ -32,8 +32,15 @@
<th colspan="3">{{:: 'actions' | translate}}</th>
</tr>
</thead>
+ <tfoot data-ng-hide="(clients | filter:search).length == 0">
+ <tr>
+ <td class="kc-action-cell" colspan="6">
+ <div kc-paging current-page='currentPage' number-of-pages='numberOfPages'></div>
+ </td>
+ </tr>
+ </tfoot>
<tbody>
- <tr ng-repeat="client in clients | filter:search | orderBy:'clientId'">
+ <tr ng-repeat="client in clients | filter:search | orderBy:'clientId' | startFrom:(currentPage-1)*pageSize | limitTo:pageSize">
<td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}">{{client.clientId}}</a></td>
<td translate="{{client.enabled}}"></td>
<td ng-class="{'text-muted': !client.baseUrl}">
@@ -45,8 +52,8 @@
<td class="kc-action-cell" data-ng-show="access.manageClients" data-ng-click="removeClient(client)">{{:: 'delete' | translate}}</td>
</tr>
<tr data-ng-show="(clients | filter:search).length == 0">
- <td class="text-muted" colspan="3" data-ng-show="search.clientId">{{:: 'no-results' | translate}}</td>
- <td class="text-muted" colspan="3" data-ng-hide="search.clientId">{{:: 'no-clients-available' | translate}}</td>
+ <td class="text-muted" colspan="4" data-ng-show="search.clientId">{{:: 'no-results' | translate}}</td>
+ <td class="text-muted" colspan="4" data-ng-hide="search.clientId">{{:: 'no-clients-available' | translate}}</td>
</tr>
</tbody>
</table>
diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/role-list.html b/themes/src/main/resources/theme/base/admin/resources/partials/role-list.html
index 8b2bd26..ca27439 100755
--- a/themes/src/main/resources/theme/base/admin/resources/partials/role-list.html
+++ b/themes/src/main/resources/theme/base/admin/resources/partials/role-list.html
@@ -33,8 +33,15 @@
<th colspan="2">{{:: 'actions' | translate}}</th>
</tr>
</thead>
+ <tfoot data-ng-hide="(roles | filter:{name: searchQuery}).length == 0">
+ <tr>
+ <td class="kc-action-cell" colspan="6">
+ <div kc-paging current-page='currentPage' number-of-pages='numberOfPages'></div>
+ </td>
+ </tr>
+ </tfoot>
<tbody>
- <tr ng-repeat="role in roles | orderBy:'name' | filter:{name: searchQuery}">
+ <tr ng-repeat="role in roles | filter:{name: searchQuery} | orderBy:'name'| startFrom:(currentPage-1)*pageSize | limitTo:pageSize">
<td><a href="#/realms/{{realm.realm}}/roles/{{role.id}}">{{role.name}}</a></td>
<td translate="{{role.composite}}"></td>
<td>{{role.description}}</td>
@@ -42,8 +49,8 @@
<td class="kc-action-cell" data-ng-click="removeRole(role)">{{:: 'delete' | translate}}</td>
</tr>
<tr data-ng-show="(roles | filter:{name: searchQuery}).length == 0">
- <td class="text-muted" colspan="3" data-ng-show="searchQuery">{{:: 'no-results' | translate}}</td>
- <td class="text-muted" colspan="3" data-ng-hide="searchQuery">{{:: 'no-realm-roles-available' | translate}}</td>
+ <td class="text-muted" colspan="4" data-ng-show="searchQuery">{{:: 'no-results' | translate}}</td>
+ <td class="text-muted" colspan="4" data-ng-hide="searchQuery">{{:: 'no-realm-roles-available' | translate}}</td>
</tr>
</tbody>
</table>
diff --git a/themes/src/main/resources/theme/base/admin/resources/templates/kc-paging.html b/themes/src/main/resources/theme/base/admin/resources/templates/kc-paging.html
new file mode 100644
index 0000000..d875c72
--- /dev/null
+++ b/themes/src/main/resources/theme/base/admin/resources/templates/kc-paging.html
@@ -0,0 +1,19 @@
+<div class="pull-right">
+ <ul class="pagination">
+ <li ng-class="{disabled: currentPage === 1}" ng-click="currentPage=1">
+ <span class="i fa fa-angle-double-left"></span>
+ </li>
+ <li ng-class="{disabled: currentPage === 1}" ng-click="isFirstPage() || (currentPage=currentPage-1)">
+ <span class="i fa fa-angle-left"></span>
+ </li>
+ <li>
+ <span style="padding: 1px 15px 0;"><input ng-model="currentPage" ng-max="numberOfPages" class="kc-pagination"> of {{numberOfPages}}</span>
+ </li>
+ <li ng-class="{disabled: currentPage === numberOfPages}" ng-click="isLastPage() || (currentPage=currentPage+1)">
+ <span class="i fa fa-angle-right" ></span>
+ </li>
+ <li ng-class="{disabled: currentPage === numberOfPages}" ng-click="currentPage=numberOfPages">
+ <span class="i fa fa-angle-double-right"></span>
+ </li>
+ </ul>
+ </div>
\ No newline at end of file