mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(containers): store show all filter value in a cookie (#1203)
This commit is contained in:
parent
61f652da04
commit
910136ee9b
2 changed files with 18 additions and 7 deletions
|
@ -1,16 +1,16 @@
|
||||||
angular.module('containers', [])
|
angular.module('containers', [])
|
||||||
.controller('ContainersController', ['$q', '$scope', '$filter', 'Container', 'ContainerService', 'ContainerHelper', 'SystemService', 'Notifications', 'Pagination', 'EntityListService', 'ModalService', 'ResourceControlService', 'EndpointProvider',
|
.controller('ContainersController', ['$q', '$scope', '$filter', 'Container', 'ContainerService', 'ContainerHelper', 'SystemService', 'Notifications', 'Pagination', 'EntityListService', 'ModalService', 'ResourceControlService', 'EndpointProvider', 'LocalStorage',
|
||||||
function ($q, $scope, $filter, Container, ContainerService, ContainerHelper, SystemService, Notifications, Pagination, EntityListService, ModalService, ResourceControlService, EndpointProvider) {
|
function ($q, $scope, $filter, Container, ContainerService, ContainerHelper, SystemService, Notifications, Pagination, EntityListService, ModalService, ResourceControlService, EndpointProvider, LocalStorage) {
|
||||||
$scope.state = {};
|
$scope.state = {};
|
||||||
$scope.state.pagination_count = Pagination.getPaginationCount('containers');
|
$scope.state.pagination_count = Pagination.getPaginationCount('containers');
|
||||||
$scope.state.displayAll = true;
|
$scope.state.displayAll = LocalStorage.getFilterContainerShowAll();
|
||||||
$scope.state.displayIP = false;
|
$scope.state.displayIP = false;
|
||||||
$scope.sortType = 'State';
|
$scope.sortType = 'State';
|
||||||
$scope.sortReverse = false;
|
$scope.sortReverse = false;
|
||||||
$scope.state.selectedItemCount = 0;
|
$scope.state.selectedItemCount = 0;
|
||||||
$scope.truncate_size = 40;
|
$scope.truncate_size = 40;
|
||||||
$scope.showMore = true;
|
$scope.showMore = true;
|
||||||
|
|
||||||
$scope.order = function (sortType) {
|
$scope.order = function (sortType) {
|
||||||
$scope.sortReverse = ($scope.sortType === sortType) ? !$scope.sortReverse : false;
|
$scope.sortReverse = ($scope.sortType === sortType) ? !$scope.sortReverse : false;
|
||||||
$scope.sortType = sortType;
|
$scope.sortType = sortType;
|
||||||
|
@ -133,6 +133,7 @@ angular.module('containers', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleGetAll = function () {
|
$scope.toggleGetAll = function () {
|
||||||
|
LocalStorage.storeFilterContainerShowAll($scope.state.displayAll);
|
||||||
update({all: $scope.state.displayAll ? 1 : 0});
|
update({all: $scope.state.displayAll ? 1 : 0});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,8 +164,8 @@ angular.module('containers', [])
|
||||||
$scope.removeAction = function () {
|
$scope.removeAction = function () {
|
||||||
batch($scope.containers, Container.remove, 'Removed');
|
batch($scope.containers, Container.remove, 'Removed');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.truncateMore = function(size) {
|
$scope.truncateMore = function(size) {
|
||||||
$scope.truncate_size = 80;
|
$scope.truncate_size = 80;
|
||||||
$scope.showMore = false;
|
$scope.showMore = false;
|
||||||
|
@ -214,7 +215,7 @@ angular.module('containers', [])
|
||||||
|
|
||||||
if(container.Status === 'paused') {
|
if(container.Status === 'paused') {
|
||||||
$scope.state.noPausedItemsSelected = false;
|
$scope.state.noPausedItemsSelected = false;
|
||||||
} else if(container.Status === 'stopped' ||
|
} else if(container.Status === 'stopped' ||
|
||||||
container.Status === 'created') {
|
container.Status === 'created') {
|
||||||
$scope.state.noStoppedItemsSelected = false;
|
$scope.state.noStoppedItemsSelected = false;
|
||||||
} else if(container.Status === 'running') {
|
} else if(container.Status === 'running') {
|
||||||
|
|
|
@ -43,6 +43,16 @@ angular.module('portainer.services')
|
||||||
},
|
},
|
||||||
clean: function() {
|
clean: function() {
|
||||||
localStorageService.clearAll();
|
localStorageService.clearAll();
|
||||||
|
},
|
||||||
|
storeFilterContainerShowAll: function(filter) {
|
||||||
|
localStorageService.cookie.set('filter_containerShowAll', filter);
|
||||||
|
},
|
||||||
|
getFilterContainerShowAll: function() {
|
||||||
|
var filter = localStorageService.cookie.get('filter_containerShowAll');
|
||||||
|
if (filter === null) {
|
||||||
|
filter = true;
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue