From 5115292bf8230bcc47d03eb453e7aaf714a7df3b Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 5 Mar 2014 17:01:04 -0500 Subject: [PATCH] Load repo info on the image view page so we can display the proper visibility status in the repo circle --- static/js/controllers.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/static/js/controllers.js b/static/js/controllers.js index 074ad869b..50c437b20 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -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(); }