1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-01 20:05:23 +02:00

feat(ux): add the ability to change the number of paginated items on all entity tables (#537)

This commit is contained in:
Anthony Lapenna 2017-01-24 14:28:40 +13:00 committed by GitHub
parent 70933d1056
commit e2fc8af87a
26 changed files with 269 additions and 83 deletions

View file

@ -327,6 +327,22 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
setActiveEndpoint: { method: 'POST', params: { id: '@id', action: 'active' } }
});
}])
.factory('Pagination', ['LocalStorage', 'Settings', function PaginationFactory(LocalStorage, Settings) {
'use strict';
return {
getPaginationCount: function(key) {
var storedCount = LocalStorage.getPaginationCount(key);
var paginationCount = Settings.pagination_count;
if (storedCount !== null) {
paginationCount = storedCount;
}
return '' + paginationCount;
},
setPaginationCount: function(key, count) {
LocalStorage.storePaginationCount(key, count);
}
};
}])
.factory('LocalStorage', ['localStorageService', function LocalStorageFactory(localStorageService) {
'use strict';
return {
@ -345,6 +361,12 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
deleteJWT: function() {
localStorageService.remove('JWT');
},
storePaginationCount: function(key, count) {
localStorageService.cookie.set('pagination_' + key, count);
},
getPaginationCount: function(key) {
return localStorageService.cookie.get('pagination_' + key);
},
clean: function() {
localStorageService.clearAll();
}