From 8cb177128b6c32f10b9a29068c572b9eef0f3c02 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 28 Oct 2013 13:09:22 -0400 Subject: [PATCH] Fixes to the new repo and build status: - make the new repo icon gray - have the build status properly center (this is a hack, unfortunately) - have the build status update when open --- static/css/quay.css | 13 ++++++++++++- static/directives/build-status.html | 2 +- static/js/controllers.js | 24 ++++++++++++++++-------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/static/css/quay.css b/static/css/quay.css index 15fd496c3..ed0c3b390 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -5,7 +5,7 @@ .user-tools .user-tool { font-size: 24px; margin-top: 14px; - color: black; + color: #aaa; } .user-tools i.user-tool:hover { @@ -13,6 +13,14 @@ color: #428bca; } +.status-boxes .popover { + margin-right: 20px; +} + +.status-boxes .popover-content { + width: 260px; +} + .build-statuses { } @@ -20,17 +28,20 @@ padding: 4px; margin-bottom: 10px; border-bottom: 1px solid #eee; + width: 230px; } .build-status-container .build-message { display: block; white-space: nowrap; + font-size: 12px; } .build-status-container .progress { height: 12px; margin: 0px; margin-top: 10px; + width: 230px; } .build-status-container:last-child { diff --git a/static/directives/build-status.html b/static/directives/build-status.html index e1c1e2ce6..8c27dba53 100644 --- a/static/directives/build-status.html +++ b/static/directives/build-status.html @@ -1,4 +1,4 @@ -
+
{{ getBuildMessage(build) }}
diff --git a/static/js/controllers.js b/static/js/controllers.js index 86cf05fa5..64042558c 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -340,9 +340,13 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim }); var startBuildInfoTimer = function(repo) { + getBuildInfo(repo); setInterval(function() { - $scope.$apply(function() { getBuildInfo(repo); }); - }, 5000); + var container = document.getElementById('build-status-container'); + if (container != null && container.offsetWidth > 0) { + $scope.$apply(function() { getBuildInfo(repo); }); + } + }, 2000); }; var getBuildInfo = function(repo) { @@ -458,7 +462,7 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim $scope.loading = false; if (repo.is_building) { - getBuildInfo(repo); + startBuildInfoTimer(repo); } }, function() { $scope.repo = null; @@ -919,6 +923,12 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular) { 'initialize': false }; + $('#couldnotbuildModal').on('hidden.bs.modal', function() { + $scope.$apply(function() { + $location.path('/repository/' + $scope.created.namespace + '/' + $scope.created.name); + }); + }); + var startBuild = function(repo, fileId) { $scope.building = true; @@ -931,7 +941,6 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular) { $location.path('/repository/' + repo.namespace + '/' + repo.name); }, function() { $('#couldnotbuildModal').modal(); - $location.path('/repository/' + repo.namespace + '/' + repo.name); }); }; @@ -940,7 +949,7 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular) { request.open('PUT', url, true); request.setRequestHeader('Content-Type', mimeType); request.onprogress = function(e) { - $scope.apply(function() { + $scope.$apply(function() { var percentLoaded; if (e.lengthComputable) { $scope.upload_progress = (e.loaded / e.total) * 100; @@ -948,9 +957,8 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular) { }); }; request.onerror = function() { - $scope.apply(function() { + $scope.$apply(function() { $('#couldnotbuildModal').modal(); - $location.path('/repository/' + repo.namespace + '/' + repo.name); }); }; request.onreadystatechange = function() { @@ -984,7 +992,6 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular) { conductUpload(repo, file, resp.url, resp.file_id, mimeType); }, function() { $('#couldnotbuildModal').modal(); - $location.path('/repository/' + repo.namespace + '/' + repo.name); }); }; @@ -1035,6 +1042,7 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular) { var createPost = Restangular.one('repository'); createPost.customPOST(data).then(function(created) { $scope.creating = false; + $scope.created = created; // Repository created. Start the upload process if applicable. if ($scope.repo.initialize) {