Skip to content

Commit

Permalink
re-add layer size
Browse files Browse the repository at this point in the history
  • Loading branch information
Filirom1 authored and Brad van der Laan committed Jun 11, 2018
1 parent 57a7163 commit c144a1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
11 changes: 3 additions & 8 deletions app/image/image-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@
* 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;
$scope.imageDetails = Manifest.query({repository: $scope.repository, tagName: $scope.tagName});



// 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)){
Expand All @@ -36,6 +33,4 @@ angular.module('image-controller', ['registry-services', 'app-mode-services'])
});
});
};
*/

}]);
7 changes: 3 additions & 4 deletions app/image/image-details-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,19 @@ <h2>
</p>
</div>
</div> -->

<!-- <div class="form-group">
<div class="form-group">
<label class="col-sm-2 control-label"><span class="glyphicon glyphicon-compressed"></span> Size <small>(including base image sizes)</small></label>
<div class="col-sm-10">
<p class="form-control-static">
<span ng-show="totalImageSize!==null">
{{totalImageSize/1024/1024 | number: 2}} <b>MB</b> {{totalImageSize / 1024 | number: 2}} <b>KB</b> {{totalImageSize}} <b>B</b>
{{totalImageSize/1024/1024 | number: 2}} <b>MB</b>
</span>
<button type="submit" class="btn btn-info" ng-click="calculateTotalImageSize()" ng-show="totalImageSize===null">
<span class="glyphicon glyphicon-stats"></span> Calculate
</button>
</p>
</div>
</div> -->
</div>
</form>
</tab>
<tab>
Expand Down
14 changes: 6 additions & 8 deletions app/services/registry-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
});
}]) */ ;
}]);

0 comments on commit c144a1d

Please sign in to comment.