feat(containers): do not remember selected items (#1988)

pull/2000/head
Anthony Lapenna 7 years ago committed by GitHub
parent d3a26a4ade
commit 0a9eab53d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -178,7 +178,7 @@
<td>{{ item.IP ? item.IP : '-' }}</td>
<td ng-if="$ctrl.showHostColumn">{{ item.NodeName ? item.NodeName : '-' }}</td>
<td>
<a ng-if="item.Ports.length > 0" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.state.publicUrl || p.host }}:{{p.public}}" target="_blank">
<a ng-if="item.Ports.length > 0" ng-repeat="p in item.Ports" class="image-tag" ng-href="http://{{ $ctrl.state.publicURL || p.host }}:{{p.public}}" target="_blank">
<i class="fa fa-external-link-alt" aria-hidden="true"></i> {{ p.public }}:{{ p.private }}
</a>
<span ng-if="item.Ports.length == 0" >-</span>

@ -1,7 +1,6 @@
angular.module('portainer.docker')
.controller('ContainersDatatableController', ['PaginationService', 'DatatableService', 'EndpointProvider',
function (PaginationService, DatatableService, EndpointProvider) {
var ctrl = this;
this.state = {
@ -49,7 +48,6 @@ function (PaginationService, DatatableService, EndpointProvider) {
this.state.selectedItems.splice(this.state.selectedItems.indexOf(item), 1);
this.state.selectedItemCount--;
}
DatatableService.setDataTableSelectedItems(this.tableKey + '_' + EndpointProvider.endpointID(), this.state.selectedItems);
};
this.selectItem = function(item) {
@ -162,30 +160,6 @@ function (PaginationService, DatatableService, EndpointProvider) {
}
};
function selectPreviouslySelectedItem(item, storedSelectedItems) {
var selectedItem = _.find(storedSelectedItems, function(container) {
return item.Id === container.Id;
});
if (selectedItem) {
item.Checked = true;
ctrl.state.selectedItemCount++;
ctrl.state.selectedItems.push(item);
}
}
this.selectItems = function(storedSelectedItems) {
for (var i = 0; i < this.dataset.length; i++) {
var item = this.dataset[i];
selectPreviouslySelectedItem(item, storedSelectedItems);
}
if (this.state.selectedItemCount > 0 && this.state.selectedItemCount === this.dataset.length) {
this.state.selectAll = true;
}
this.updateSelectionState();
};
this.$onInit = function() {
setDefaults(this);
this.prepareTableFromDataset();
@ -196,11 +170,6 @@ function (PaginationService, DatatableService, EndpointProvider) {
this.state.orderBy = storedOrder.orderBy;
}
var storedSelectedItems = DatatableService.getDataTableSelectedItems(this.tableKey + '_' + EndpointProvider.endpointID());
if (storedSelectedItems !== null) {
this.selectItems(storedSelectedItems);
}
var storedFilters = DatatableService.getDataTableFilters(this.tableKey);
if (storedFilters !== null) {
this.updateStoredFilters(storedFilters.state.values);

Loading…
Cancel
Save