mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 13:59:40 +02:00
feat(networks): group networks for swarm endpoints (#3028)
* feat(networks): group networks for swarm endpoints * fix(networks): display error on networks with 1 sub
This commit is contained in:
parent
552c897b3b
commit
c12ce5a5c7
5 changed files with 118 additions and 31 deletions
|
@ -1,3 +1,5 @@
|
|||
import _ from 'lodash-es';
|
||||
|
||||
angular.module('portainer.docker')
|
||||
.controller('NetworksDatatableController', ['$scope', '$controller', 'PREDEFINED_NETWORKS', 'DatatableService',
|
||||
function ($scope, $controller, PREDEFINED_NETWORKS, DatatableService) {
|
||||
|
@ -8,6 +10,10 @@ angular.module('portainer.docker')
|
|||
return PREDEFINED_NETWORKS.includes(item.Name);
|
||||
};
|
||||
|
||||
this.state = Object.assign(this.state, {
|
||||
expandedItems: []
|
||||
})
|
||||
|
||||
/**
|
||||
* Do not allow PREDEFINED_NETWORKS to be selected
|
||||
*/
|
||||
|
@ -47,5 +53,26 @@ angular.module('portainer.docker')
|
|||
}
|
||||
this.onSettingsRepeaterChange();
|
||||
};
|
||||
|
||||
this.expandItem = function(item, expanded) {
|
||||
item.Expanded = expanded;
|
||||
};
|
||||
|
||||
this.itemCanExpand = function(item) {
|
||||
return item.Subs.length > 0;
|
||||
}
|
||||
|
||||
this.hasExpandableItems = function() {
|
||||
return _.filter(this.state.filteredDataSet, (item) => this.itemCanExpand(item)).length;
|
||||
};
|
||||
|
||||
this.expandAll = function() {
|
||||
this.state.expandAll = !this.state.expandAll;
|
||||
_.forEach(this.state.filteredDataSet, (item) => {
|
||||
if (this.itemCanExpand(item)) {
|
||||
this.expandItem(item, this.state.expandAll);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue