mirror of
https://github.com/kwk/docker-registry-frontend.git
synced 2024-09-20 23:36:49 +08:00
97c9ca0446
I did some cleanup and unified the deletion of items (e.g. tags or repos) a bit. Now, you can select multiple repositories or tags and delete them at once. Confirmation is done using a modal popup. Success and error messages will still be prompted for each operation using toastr notification. One thing that is still missing is the selection of multiple items using some automation like a stupid "select all" button. Also, any selected item remains selected even if it does not show up any longer due to filtering. That's why the delete buttons explicitly tell the number of items to be deleted. This can cause issues when paging (not implemented yet) or filtering.
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* @ngdoc function
|
|
* @name docker-registry-frontend.controller:ImageController
|
|
* @description
|
|
* # ImageController
|
|
* Controller of the docker-registry-frontend
|
|
*/
|
|
angular.module('image-controller', ['registry-services', 'app-mode-services'])
|
|
.controller('ImageController', ['$scope', '$route', '$routeParams', '$location', '$log', '$filter', 'Image', 'Ancestry', 'AppMode',
|
|
function($scope, $route, $routeParams, $location, $log, $filter, Image, Ancestry, AppMode){
|
|
$scope.imageId = $route.current.params.imageId;
|
|
$scope.imageDetails = Image.query( {imageId: $scope.imageId} );
|
|
$scope.imageAncestry = Ancestry.query( {imageId: $scope.imageId} );
|
|
$scope.appMode = AppMode.query();
|
|
/**
|
|
* Calculates the total download size for the image based on
|
|
* it's ancestry.
|
|
*/
|
|
$scope.totalImageSize = null;
|
|
$scope.calculateTotalImageSize = function() {
|
|
$scope.totalImageSize = 0;
|
|
angular.forEach($scope.imageAncestry, function (id, key) {
|
|
/* We have to use the $promise object here to be sure the result is accessible */
|
|
Image.get( {imageId: id} ).$promise.then(function (result) {
|
|
if (!isNaN(result.Size-0)) {
|
|
$scope.totalImageSize += result.Size;
|
|
}
|
|
});
|
|
});
|
|
};
|
|
}]);
|