mirror of https://github.com/portainer/portainer
parent
f1c458b147
commit
6f53d1a35a
|
@ -1,6 +1,6 @@
|
|||
angular.module('containers', [])
|
||||
.controller('ContainersController', ['$scope', '$filter', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config', 'Pagination',
|
||||
function ($scope, $filter, Container, ContainerHelper, Info, Settings, Messages, Config, Pagination) {
|
||||
.controller('ContainersController', ['$scope', '$filter', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config', 'Pagination', 'EntityListService',
|
||||
function ($scope, $filter, Container, ContainerHelper, Info, Settings, Messages, Config, Pagination, EntityListService) {
|
||||
$scope.state = {};
|
||||
$scope.state.pagination_count = Pagination.getPaginationCount('containers');
|
||||
$scope.state.displayAll = Settings.displayAll;
|
||||
|
@ -29,6 +29,10 @@ function ($scope, $filter, Container, ContainerHelper, Info, Settings, Messages,
|
|||
var model = new ContainerViewModel(container);
|
||||
model.Status = $filter('containerstatus')(model.Status);
|
||||
|
||||
EntityListService.rememberPreviousSelection($scope.containers, model, function onSelect(model){
|
||||
$scope.selectItem(model);
|
||||
});
|
||||
|
||||
if (model.IP) {
|
||||
$scope.state.displayIP = true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
angular.module('portainer.services')
|
||||
.factory('EntityListService', [function EntityListServiceFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
rememberPreviousSelection: function(oldContainerList, model, onSelectCallback) {
|
||||
var oldModel = _.find(oldContainerList, function(item){
|
||||
return item.Id === model.Id;
|
||||
});
|
||||
if (oldModel && oldModel.Checked) {
|
||||
model.Checked = true;
|
||||
onSelectCallback(model);
|
||||
}
|
||||
}
|
||||
};
|
||||
}]);
|
Loading…
Reference in New Issue