Load repo info on the image view page so we can display the proper visibility status in the repo circle

This commit is contained in:
Joseph Schorr 2014-03-05 17:01:04 -05:00
parent c75921498c
commit 5115292bf8

View file

@ -1808,6 +1808,16 @@ function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, I
}, 10);
};
var fetchRepository = function() {
var params = {
'repository': namespace + '/' + name
};
ApiService.getRepoAsResource(params).get(function(repo) {
$scope.repo = repo;
});
};
var fetchImage = function() {
var params = {
'repository': namespace + '/' + name,
@ -1815,11 +1825,13 @@ function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, I
};
$scope.image = ApiService.getImageAsResource(params).get(function(image) {
$scope.repo = {
'name': name,
'namespace': namespace,
'is_public': true
};
if (!$scope.repo) {
$scope.repo = {
'name': name,
'namespace': namespace,
'is_public': true
};
}
$rootScope.title = 'View Image - ' + image.id;
$rootScope.description = 'Viewing docker image ' + image.id + ' under repository ' + namespace + '/' + name +
@ -1860,6 +1872,9 @@ function ImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, I
});
};
// Fetch the repository.
fetchRepository();
// Fetch the image.
fetchImage();
}