mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
Progress on Networks.
This commit is contained in:
parent
5947e262fc
commit
a712d5b77e
6 changed files with 165 additions and 16 deletions
50
app/components/networks/networksController.js
Normal file
50
app/components/networks/networksController.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
angular.module('networks', []).config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/networks', {
|
||||
templateUrl: 'app/components/networks/networks.html',
|
||||
controller: 'NetworksController'
|
||||
});
|
||||
}]).controller('NetworksController', ['$scope', 'Network', 'ViewSpinner', 'Messages',
|
||||
function ($scope, Network, ViewSpinner, Messages) {
|
||||
$scope.toggle = false;
|
||||
//$scope.predicate = '-Created';
|
||||
|
||||
$scope.removeAction = function () {
|
||||
ViewSpinner.spin();
|
||||
var counter = 0;
|
||||
var complete = function () {
|
||||
counter = counter - 1;
|
||||
if (counter === 0) {
|
||||
ViewSpinner.stop();
|
||||
}
|
||||
};
|
||||
angular.forEach($scope.networks, function (network) {
|
||||
if (network.Checked) {
|
||||
counter = counter + 1;
|
||||
Network.remove({id: network.Id}, function (d) {
|
||||
Messages.send("Network deleted", resource.Deleted);
|
||||
var index = $scope.networks.indexOf(network);
|
||||
$scope.networks.splice(index, 1);
|
||||
complete();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e.data);
|
||||
complete();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleSelectAll = function () {
|
||||
angular.forEach($scope.images, function (i) {
|
||||
i.Checked = $scope.toggle;
|
||||
});
|
||||
};
|
||||
|
||||
ViewSpinner.spin();
|
||||
Network.query({}, function (d) {
|
||||
$scope.networks = d;
|
||||
ViewSpinner.stop();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e.data);
|
||||
ViewSpinner.stop();
|
||||
});
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue