mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
parent
6f53d1a35a
commit
64ef74321a
7 changed files with 70 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
angular.module('images', [])
|
||||
.controller('ImagesController', ['$scope', '$state', 'Config', 'Image', 'ImageHelper', 'Messages', 'Pagination',
|
||||
function ($scope, $state, Config, Image, ImageHelper, Messages, Pagination) {
|
||||
.controller('ImagesController', ['$scope', '$state', 'Config', 'Image', 'ImageHelper', 'Messages', 'Pagination', 'ModalService',
|
||||
function ($scope, $state, Config, Image, ImageHelper, Messages, Pagination, ModalService) {
|
||||
$scope.state = {};
|
||||
$scope.state.pagination_count = Pagination.getPaginationCount('images');
|
||||
$scope.sortType = 'RepoTags';
|
||||
|
@ -59,7 +59,27 @@ function ($scope, $state, Config, Image, ImageHelper, Messages, Pagination) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.removeAction = function () {
|
||||
$scope.confirmRemovalAction = function (force) {
|
||||
ModalService.confirm({
|
||||
title: "Are you sure?",
|
||||
message: "Forcing the removal of the image will remove the image even if it has multiple tags or if it is used by stopped containers.",
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: 'Remove the image',
|
||||
},
|
||||
cancel: {
|
||||
label: 'Cancel'
|
||||
}
|
||||
},
|
||||
callback: function (confirmed) {
|
||||
if(!confirmed) { return; }
|
||||
$scope.removeAction(force);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeAction = function (force) {
|
||||
force = !!force;
|
||||
$('#loadImagesSpinner').show();
|
||||
var counter = 0;
|
||||
var complete = function () {
|
||||
|
@ -71,7 +91,7 @@ function ($scope, $state, Config, Image, ImageHelper, Messages, Pagination) {
|
|||
angular.forEach($scope.images, function (i) {
|
||||
if (i.Checked) {
|
||||
counter = counter + 1;
|
||||
Image.remove({id: i.Id}, function (d) {
|
||||
Image.remove({id: i.Id, force: force}, function (d) {
|
||||
if (d[0].message) {
|
||||
$('#loadImagesSpinner').hide();
|
||||
Messages.error("Unable to remove image", {}, d[0].message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue