|
|
@ -155,34 +155,83 @@ function SettingsController($scope, System, Docker, Settings, Messages) {
|
|
|
|
function ContainerController($scope, $routeParams, $location, Container, Messages, ViewSpinner) {
|
|
|
|
function ContainerController($scope, $routeParams, $location, Container, Messages, ViewSpinner) {
|
|
|
|
$scope.changes = [];
|
|
|
|
$scope.changes = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var update = function() {
|
|
|
|
|
|
|
|
Container.get({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
$scope.container = d;
|
|
|
|
|
|
|
|
ViewSpinner.stop();
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
if (e.status === 404) {
|
|
|
|
|
|
|
|
$('.detail').hide();
|
|
|
|
|
|
|
|
Messages.error("Not found", "Container not found.");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Messages.error("Failure", e.data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ViewSpinner.stop();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.start = function(){
|
|
|
|
$scope.start = function(){
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
Container.start({id: $routeParams.id}, function(d) {
|
|
|
|
Container.start({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.send("Container started", $routeParams.id);
|
|
|
|
Messages.send("Container started", $routeParams.id);
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.error("Failure", "Container failed to start." + e.data);
|
|
|
|
Messages.error("Failure", "Container failed to start." + e.data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.stop = function() {
|
|
|
|
$scope.stop = function() {
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
Container.stop({id: $routeParams.id}, function(d) {
|
|
|
|
Container.stop({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.send("Container stopped", $routeParams.id);
|
|
|
|
Messages.send("Container stopped", $routeParams.id);
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.error("Failure", "Container failed to stop." + e.data);
|
|
|
|
Messages.error("Failure", "Container failed to stop." + e.data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.kill = function() {
|
|
|
|
$scope.kill = function() {
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
Container.kill({id: $routeParams.id}, function(d) {
|
|
|
|
Container.kill({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.send("Container killed", $routeParams.id);
|
|
|
|
Messages.send("Container killed", $routeParams.id);
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.error("Failure", "Container failed to die." + e.data);
|
|
|
|
Messages.error("Failure", "Container failed to die." + e.data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.pause = function() {
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
|
|
|
|
Container.pause({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
|
|
|
|
Messages.send("Container paused", $routeParams.id);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
|
|
|
|
Messages.error("Failure", "Container failed to pause." + e.data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.unpause = function() {
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
|
|
|
|
Container.unpause({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
|
|
|
|
Messages.send("Container unpaused", $routeParams.id);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
|
|
|
|
Messages.error("Failure", "Container failed to unpause." + e.data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.remove = function() {
|
|
|
|
$scope.remove = function() {
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
Container.remove({id: $routeParams.id}, function(d) {
|
|
|
|
Container.remove({id: $routeParams.id}, function(d) {
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.send("Container removed", $routeParams.id);
|
|
|
|
Messages.send("Container removed", $routeParams.id);
|
|
|
|
}, function(e){
|
|
|
|
}, function(e){
|
|
|
|
|
|
|
|
update();
|
|
|
|
Messages.error("Failure", "Container failed to remove." + e.data);
|
|
|
|
Messages.error("Failure", "Container failed to remove." + e.data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -192,22 +241,14 @@ function ContainerController($scope, $routeParams, $location, Container, Message
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.getChanges = function() {
|
|
|
|
$scope.getChanges = function() {
|
|
|
|
|
|
|
|
ViewSpinner.spin();
|
|
|
|
Container.changes({id: $routeParams.id}, function(d) {
|
|
|
|
Container.changes({id: $routeParams.id}, function(d) {
|
|
|
|
$scope.changes = d;
|
|
|
|
$scope.changes = d;
|
|
|
|
|
|
|
|
ViewSpinner.stop();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Container.get({id: $routeParams.id}, function(d) {
|
|
|
|
update();
|
|
|
|
$scope.container = d;
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
|
|
|
|
if (e.status === 404) {
|
|
|
|
|
|
|
|
$('.detail').hide();
|
|
|
|
|
|
|
|
Messages.error("Not found", "Container not found.");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Messages.error("Failure", e.data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.getChanges();
|
|
|
|
$scope.getChanges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -233,6 +274,7 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
|
|
|
counter = counter -1;
|
|
|
|
counter = counter -1;
|
|
|
|
if (counter === 0) {
|
|
|
|
if (counter === 0) {
|
|
|
|
ViewSpinner.stop();
|
|
|
|
ViewSpinner.stop();
|
|
|
|
|
|
|
|
update({all: Settings.displayAll ? 1 : 0});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
angular.forEach(items, function(c) {
|
|
|
|
angular.forEach(items, function(c) {
|
|
|
@ -241,7 +283,6 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
|
|
|
action({id: c.Id}, function(d) {
|
|
|
|
action({id: c.Id}, function(d) {
|
|
|
|
Messages.send("Container " + msg, c.Id);
|
|
|
|
Messages.send("Container " + msg, c.Id);
|
|
|
|
var index = $scope.containers.indexOf(c);
|
|
|
|
var index = $scope.containers.indexOf(c);
|
|
|
|
$scope.containers.splice(index, 1);
|
|
|
|
|
|
|
|
complete();
|
|
|
|
complete();
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
Messages.error("Failure", e.data);
|
|
|
|
Messages.error("Failure", e.data);
|
|
|
@ -249,6 +290,9 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (counter === 0) {
|
|
|
|
|
|
|
|
ViewSpinner.stop();
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.toggleSelectAll = function() {
|
|
|
|
$scope.toggleSelectAll = function() {
|
|
|
@ -274,6 +318,14 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
|
|
|
batch($scope.containers, Container.kill, "Killed");
|
|
|
|
batch($scope.containers, Container.kill, "Killed");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.pauseAction = function() {
|
|
|
|
|
|
|
|
batch($scope.containers, Container.pause, "Paused");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.unpauseAction = function() {
|
|
|
|
|
|
|
|
batch($scope.containers, Container.unpause, "Unpaused");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.removeAction = function() {
|
|
|
|
$scope.removeAction = function() {
|
|
|
|
batch($scope.containers, Container.remove, "Removed");
|
|
|
|
batch($scope.containers, Container.remove, "Removed");
|
|
|
|
};
|
|
|
|
};
|
|
|
|