From c144a1d8d56a1593932cb8031e75391d0c2a30fc Mon Sep 17 00:00:00 2001 From: Filirom1 Date: Thu, 11 Feb 2016 22:50:11 +0100 Subject: [PATCH] re-add layer size --- app/image/image-controller.js | 11 +++-------- app/image/image-details-directive.html | 7 +++---- app/services/registry-services.js | 14 ++++++-------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/app/image/image-controller.js b/app/image/image-controller.js index c94a7e5..6c6c365 100644 --- a/app/image/image-controller.js +++ b/app/image/image-controller.js @@ -8,9 +8,9 @@ * Controller of the docker-registry-frontend */ angular.module('image-controller', ['registry-services', 'app-mode-services']) - .controller('ImageController', ['$scope', '$route', '$routeParams', '$location', '$log', '$filter', 'Manifest', 'AppMode', - function($scope, $route, $routeParams, $location, $log, $filter, Manifest, AppMode){ - + .controller('ImageController', ['$scope', '$route', '$routeParams', '$location', '$log', '$filter', 'Manifest', 'Blob', 'AppMode', + function($scope, $route, $routeParams, $location, $log, $filter, Manifest, Blob, AppMode){ + $scope.appMode = AppMode.query(); $scope.totalImageSize = 0; @@ -18,16 +18,13 @@ angular.module('image-controller', ['registry-services', 'app-mode-services']) - // This is not totally working right now (problem with big layers) /** * Calculates the total download size for the image based on * it's layers. */ - /* $scope.totalImageSize = null; $scope.calculateTotalImageSize = function() { $scope.totalImageSize = 0; - var size; angular.forEach($scope.imageDetails.fsLayers, function (id, key) { Blob.query({repository: $scope.repository, digest: id.blobSum}).$promise.then(function(data){ if(!isNaN(data.contentLength-0)){ @@ -36,6 +33,4 @@ angular.module('image-controller', ['registry-services', 'app-mode-services']) }); }); }; - */ - }]); diff --git a/app/image/image-details-directive.html b/app/image/image-details-directive.html index 5101c9e..79d3961 100644 --- a/app/image/image-details-directive.html +++ b/app/image/image-details-directive.html @@ -71,20 +71,19 @@

--> - - + diff --git a/app/services/registry-services.js b/app/services/registry-services.js index 26f5dbf..1241c62 100644 --- a/app/services/registry-services.js +++ b/app/services/registry-services.js @@ -238,18 +238,16 @@ angular.module('registry-services', ['ngResource']) }, }); }]) - // This is not totally working right now (problem with big layers) - /* .factory('Blob', ['$resource', function($resource){ return $resource('/v2/:repository/blobs/:digest', {}, { - 'query': { method:'HEAD', - interceptor: function(data, headers){ - var res = {contentLength: parseInt(headers('content-length'))}; - return res; + interceptor: { + response: function(response){ + var res = {contentLength: parseInt(response.headers('content-length'))}; + return res; + } } } - }); - }]) */ ; + }]);