From dbbec5a853638a5405697271e5c5f180d9abeb46 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 29 Oct 2013 20:21:18 -0400 Subject: [PATCH 1/2] Fix description handling in new repo view --- endpoints/api.py | 2 ++ static/js/controllers.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/endpoints/api.py b/endpoints/api.py index c5592d8b8..853c7498f 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -191,6 +191,8 @@ def create_repo_api(): repo = model.create_repository(namespace_name, repository_name, owner, visibility) + repo.description = request.get_json()['description'] + repo.save() return jsonify({ 'namespace': namespace_name, diff --git a/static/js/controllers.js b/static/js/controllers.js index a74f606a7..0282c460b 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1028,7 +1028,8 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer var repo = $scope.repo; var data = { 'repository': repo.name, - 'visibility': repo.is_public == '1' ? 'public' : 'private' + 'visibility': repo.is_public == '1' ? 'public' : 'private', + 'description': repo.description }; var createPost = Restangular.one('repository'); From 081041b85fe4201d41bf183fbccf6a7f83276c00 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 29 Oct 2013 20:54:36 -0400 Subject: [PATCH 2/2] - Update the repo page when a build is complete - Change the polling to be 5s - Show a message on an empty repo when building --- static/js/controllers.js | 78 +++++++++++++++++--------- static/partials/build-status-item.html | 4 ++ static/partials/view-repo.html | 4 ++ 3 files changed, 59 insertions(+), 27 deletions(-) diff --git a/static/js/controllers.js b/static/js/controllers.js index 0282c460b..f3954c6a9 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -335,28 +335,69 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim } }); + var fetchRepository = function() { + var repositoryFetch = Restangular.one('repository/' + namespace + '/' + name); + repositoryFetch.get().then(function(repo) { + $rootScope.title = namespace + '/' + name; + $scope.repo = repo; + + $scope.setTag($routeParams.tag); + + $('#copyClipboard').clipboardCopy(); + $scope.loading = false; + + if (repo.is_building) { + startBuildInfoTimer(repo); + } + }, function() { + $scope.repo = null; + $scope.loading = false; + $rootScope.title = 'Unknown Repository'; + }); + }; + var startBuildInfoTimer = function(repo) { if ($scope.interval) { return; } getBuildInfo(repo); $scope.interval = setInterval(function() { - var container = document.getElementById('build-status-container'); - if (container != null && container.offsetWidth > 0) { - $scope.$apply(function() { getBuildInfo(repo); }); - } - }, 2000); + $scope.$apply(function() { getBuildInfo(repo); }); + }, 5000); $scope.$on("$destroy", function() { - if ($scope.interval) { - clearInterval($scope.interval); - } + cancelBuildInfoTimer(); }); }; + var cancelBuildInfoTimer = function() { + if ($scope.interval) { + clearInterval($scope.interval); + } + }; + var getBuildInfo = function(repo) { var buildInfo = Restangular.one('repository/' + repo.namespace + '/' + repo.name + '/build/'); buildInfo.get().then(function(resp) { - $scope.buildsInfo = resp.builds; + var runningBuilds = []; + for (var i = 0; i < resp.builds.length; ++i) { + var build = resp.builds[i]; + if (build.status != 'complete') { + runningBuilds.push(build); + } + } + + $scope.buildsInfo = runningBuilds; + if (!runningBuilds.length) { + // Cancel the build timer. + cancelBuildInfoTimer(); + + // Mark the repo as no longer building. + $scope.repo.is_building = false; + + // Reload the repo information. + fetchRepository(); + listImages(); + } }); }; @@ -455,24 +496,7 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim $scope.loading = true; // Fetch the repo. - var repositoryFetch = Restangular.one('repository/' + namespace + '/' + name); - repositoryFetch.get().then(function(repo) { - $rootScope.title = namespace + '/' + name; - $scope.repo = repo; - - $scope.setTag($routeParams.tag); - - $('#copyClipboard').clipboardCopy(); - $scope.loading = false; - - if (repo.is_building) { - startBuildInfoTimer(repo); - } - }, function() { - $scope.repo = null; - $scope.loading = false; - $rootScope.title = 'Unknown Repository'; - }); + fetchRepository(); // Fetch the image history. listImages(); diff --git a/static/partials/build-status-item.html b/static/partials/build-status-item.html index a85af075d..be1c06878 100644 --- a/static/partials/build-status-item.html +++ b/static/partials/build-status-item.html @@ -2,4 +2,8 @@
+ +
+ All Dockerfile builds complete +
diff --git a/static/partials/view-repo.html b/static/partials/view-repo.html index b2293d2e4..77a574b5a 100644 --- a/static/partials/view-repo.html +++ b/static/partials/view-repo.html @@ -64,6 +64,10 @@
(This repository is empty)
+
+
Your build is currently processing, if this takes longer than an hour, please contact quay support
+
+