--- a/js/app.js Mon Dec 08 01:28:37 2014 -0600
+++ b/js/app.js Mon Dec 08 02:12:46 2014 -0600
@@ -65,23 +65,34 @@
$scope.select_repo = function(repo) {
- // manifestREST.images($scope.registry, repo.name)
- // .success(function(data, status, headers, config) {
- // .error(function(data, status, headers, config) {
- // console.log("Failed to get the image list: " + status);
manifestREST.tags($scope.registry, repo.name)
.success(function(data, status, headers, config) {
+ /* the docker registry returns a list of objects like + * [{"layer", "deadb33f", "name": "latest"}] + * and the private registry returns a dictionary of tag + * names to images. Like: + * {"latest", "deadb33f"} + * This function will normalize them into an object like + * {"deadb33f", ["latest"]} - for(var ntag in data) {
- $scope.tags[tag.layer] = $scope.tags[tag.layer] || [];
+ if(data.constructor === Array) { /* registry.hub.docker.com */ + for(var ntag in data) { + $scope.tags[tag.layer] = $scope.tags[tag.layer] || []; - $scope.tags[tag.layer].push(tag.name);
+ $scope.tags[tag.layer].push(tag.name); + } else if(data !== null && typeof data === 'object') { /* private registries */ + $scope.tags[layer] = $scope.tags[layer] || []; + $scope.tags[layer].push(tag); .error(function(data, status, headers, config) {