2019-02-25 01:25:48 +00:00
|
|
|
angular.module('portainer.docker')
|
2019-07-02 15:51:17 +00:00
|
|
|
.controller('NetworksDatatableController', ['$scope', '$controller', 'PREDEFINED_NETWORKS', 'DatatableService',
|
|
|
|
function ($scope, $controller, PREDEFINED_NETWORKS, DatatableService) {
|
|
|
|
|
2019-02-25 01:25:48 +00:00
|
|
|
angular.extend(this, $controller('GenericDatatableController', {$scope: $scope}));
|
|
|
|
|
|
|
|
this.disableRemove = function(item) {
|
|
|
|
return PREDEFINED_NETWORKS.includes(item.Name);
|
|
|
|
};
|
|
|
|
|
2019-07-02 15:51:17 +00:00
|
|
|
/**
|
|
|
|
* Do not allow PREDEFINED_NETWORKS to be selected
|
|
|
|
*/
|
|
|
|
this.allowSelection = function(item) {
|
|
|
|
return !this.disableRemove(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$onInit = function() {
|
|
|
|
this.setDefaults();
|
|
|
|
this.prepareTableFromDataset();
|
|
|
|
|
|
|
|
var storedOrder = DatatableService.getDataTableOrder(this.tableKey);
|
|
|
|
if (storedOrder !== null) {
|
|
|
|
this.state.reverseOrder = storedOrder.reverse;
|
|
|
|
this.state.orderBy = storedOrder.orderBy;
|
|
|
|
}
|
|
|
|
|
|
|
|
var textFilter = DatatableService.getDataTableTextFilters(this.tableKey);
|
|
|
|
if (textFilter !== null) {
|
|
|
|
this.state.textFilter = textFilter;
|
|
|
|
this.onTextFilterChange();
|
|
|
|
}
|
|
|
|
|
|
|
|
var storedFilters = DatatableService.getDataTableFilters(this.tableKey);
|
|
|
|
if (storedFilters !== null) {
|
|
|
|
this.filters = storedFilters;
|
|
|
|
}
|
|
|
|
if (this.filters && this.filters.state) {
|
|
|
|
this.filters.state.open = false;
|
2019-02-25 01:25:48 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
]);
|