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 eeae412e9f..adb0c5ea41 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
@@ -2680,20 +2680,38 @@ module.directive('kcOnReadFile', function ($parse) {
});
module.controller('PagingCtrl', function ($scope) {
- $scope.isLastPage = function()
- {
- if ($scope.currentPage === $scope.numberOfPages) {
- return true;
- }
- return false;
+ $scope.currentPageInput = 1;
+
+ $scope.firstPage = function() {
+ if (!$scope.hasPrevious()) return;
+ $scope.currentPage = 1;
+ $scope.currentPageInput = 1;
};
-
- $scope.isFirstPage = function()
- {
- if ($scope.currentPage === 1) {
- return true;
- }
- return false;
+
+ $scope.lastPage = function() {
+ if (!$scope.hasNext()) return;
+ $scope.currentPage = $scope.numberOfPages;
+ $scope.currentPageInput = $scope.numberOfPages;
+ };
+
+ $scope.previousPage = function() {
+ if (!$scope.hasPrevious()) return;
+ $scope.currentPage--;
+ $scope.currentPageInput = $scope.currentPage;
+ };
+
+ $scope.nextPage = function() {
+ if (!$scope.hasNext()) return;
+ $scope.currentPage++;
+ $scope.currentPageInput = $scope.currentPage;
+ };
+
+ $scope.hasNext = function() {
+ return $scope.currentPage < $scope.numberOfPages;
+ };
+
+ $scope.hasPrevious = function() {
+ return $scope.currentPage > 1;
};
});
@@ -2701,15 +2719,34 @@ module.directive('kcPaging', function () {
return {
scope: {
currentPage: '=',
+ currentPageInput: '=',
numberOfPages: '='
},
- restrict: 'A',
+ restrict: 'E',
replace: true,
controller: 'PagingCtrl',
templateUrl: resourceUrl + '/templates/kc-paging.html'
}
});
+// Tests the page number input from currentPageInput to see
+// if it represents a valid page. If so, the current page is changed.
+module.directive('kcValidPage', function() {
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ctrl) {
+ ctrl.$validators.inRange = function(modelValue, viewValue) {
+ if (viewValue >= 1 && viewValue <= scope.numberOfPages) {
+ scope.currentPage = viewValue;
+ }
+
+ return true;
+ }
+ }
+ }
+});
+
+// filter used for paged tables
module.filter('startFrom', function () {
return function (input, start) {
if (input) {
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 d81882d797..7d8de51ead 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
@@ -735,6 +735,7 @@ module.controller('ClientListCtrl', function($scope, realm, clients, Client, ser
$scope.realm = realm;
$scope.clients = clients;
$scope.currentPage = 1;
+ $scope.currentPageInput = 1;
$scope.pageSize = 20;
$scope.numberOfPages = Math.ceil($scope.clients.length/$scope.pageSize);
@@ -743,6 +744,7 @@ module.controller('ClientListCtrl', function($scope, realm, clients, Client, ser
$scope.totalItems = $scope.filtered.length;
$scope.numberOfPages = Math.ceil($scope.totalItems/$scope.pageSize);
$scope.currentPage = 1;
+ $scope.currentPageInput = 1;
}, true);
$scope.removeClient = function(client) {
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 a42ef3c5e4..d7909ac509 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
@@ -1227,14 +1227,16 @@ module.controller('RoleListCtrl', function($scope, $route, Dialog, Notifications
$scope.realm = realm;
$scope.roles = roles;
$scope.currentPage = 1;
+ $scope.currentPageInput = 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.filtered = filterFilter($scope.roles, {name: newVal});
$scope.totalItems = $scope.filtered.length;
$scope.numberOfPages = Math.ceil($scope.totalItems/$scope.pageSize);
$scope.currentPage = 1;
+ $scope.currentPageInput = 1;
}, true);
$scope.removeRole = function (role) {
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 50c71dcb57..51aaa2009b 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
@@ -4,59 +4,53 @@
-
-
-
-
-
-
+
+ |
-
+
-
-
-
+
-
+
+
+
+
{{:: 'client-id' | translate}} |
- {{:: 'enabled' | translate}} |
- {{:: 'base-url' | translate}} |
- {{:: 'actions' | translate}} |
- | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- - | +|||||||||||||||||
{{:: 'client-id' | translate}} | +{{:: 'enabled' | translate}} | +{{:: 'base-url' | translate}} | +{{:: 'actions' | translate}} | +||||||||||||||
{{client.clientId}} | -- | - {{client.rootUrl}}{{client.baseUrl}} - {{:: 'not-defined' | translate}} - | -{{:: 'edit' | translate}} | -{{:: 'export' | translate}} | -{{:: 'delete' | translate}} | -||||||||||||
{{:: 'no-results' | translate}} | -{{:: 'no-clients-available' | translate}} | -||||||||||||||||
{{client.clientId}} | ++ | + {{client.rootUrl}}{{client.baseUrl}} + {{:: 'not-defined' | translate}} + | +{{:: 'edit' | translate}} | +{{:: 'export' | translate}} | +{{:: 'delete' | translate}} | +||||||||||||
{{:: 'no-results' | translate}} | +{{:: 'no-clients-available' | translate}} | +
-
-
-
-
-
-
+
+ |
-
+
-
-
-
+
-
+
+
+
+
{{:: 'role-name' | translate}} |
- {{:: 'composite' | translate}} |
- {{:: 'description' | translate}} |
- {{:: 'actions' | translate}} |
- | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- - | +||||||||||||||
{{:: 'role-name' | translate}} | +{{:: 'composite' | translate}} | +{{:: 'description' | translate}} | +{{:: 'actions' | translate}} | +|||||||||||
{{role.name}} | -- | {{role.description}} | -{{:: 'edit' | translate}} | -{{:: 'delete' | translate}} | -||||||||||
{{:: 'no-results' | translate}} | -{{:: 'no-realm-roles-available' | translate}} | -|||||||||||||
{{role.name}} | ++ | {{role.description}} | +{{:: 'edit' | translate}} | +{{:: 'delete' | translate}} | +||||||||||
{{:: 'no-results' | translate}} | +{{:: 'no-realm-roles-available' | translate}} | +