mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 13:59:40 +02:00
feat(networks): prevent removal of predefined networks (#2697)
* fix(networks): disable removing predefined networks (#1838) * fix(networks): disable select all for predefined networks (#1838) * fix(networks): do not allow delete in network-details & use constant (#1838)
This commit is contained in:
parent
c152d3f62e
commit
9cbf1f34a7
6 changed files with 31 additions and 6 deletions
|
@ -0,0 +1,20 @@
|
|||
angular.module('portainer.docker')
|
||||
.controller('NetworksDatatableController', ['$scope', '$controller', 'PREDEFINED_NETWORKS',
|
||||
function ($scope, $controller, PREDEFINED_NETWORKS) {
|
||||
angular.extend(this, $controller('GenericDatatableController', {$scope: $scope}));
|
||||
|
||||
this.disableRemove = function(item) {
|
||||
return PREDEFINED_NETWORKS.includes(item.Name);
|
||||
};
|
||||
|
||||
this.selectAll = function() {
|
||||
for (var i = 0; i < this.state.filteredDataSet.length; i++) {
|
||||
var item = this.state.filteredDataSet[i];
|
||||
if (!this.disableRemove(item) && item.Checked !== this.state.selectAll) {
|
||||
item.Checked = this.state.selectAll;
|
||||
this.selectItem(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue