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