mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
parent
6f53d1a35a
commit
64ef74321a
7 changed files with 70 additions and 7 deletions
|
@ -63,7 +63,16 @@
|
|||
</rd-widget-header>
|
||||
<rd-widget-taskbar classes="col-lg-12">
|
||||
<div class="pull-left">
|
||||
<button type="button" class="btn btn-danger" ng-click="removeAction()" ng-disabled="!state.selectedItemCount"><i class="fa fa-trash space-right" aria-hidden="true"></i>Remove</button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-danger" ng-click="removeAction()" ng-disabled="!state.selectedItemCount"><i class="fa fa-trash space-right" aria-hidden="true"></i>Remove</button>
|
||||
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-disabled="!state.selectedItemCount" >
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a ng-click="confirmRemovalAction(true)" ng-disabled="!state.selectedItemCount" >Force Remove</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<input type="text" id="filter" ng-model="state.filter" placeholder="Filter..." class="form-control input-sm" />
|
||||
|
|
|
@ -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