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
This commit is contained in:
Joseph Schorr 2013-10-28 13:09:22 -04:00
parent d7f51fb764
commit 8cb177128b
3 changed files with 29 additions and 10 deletions

View file

@ -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 {

View file

@ -1,4 +1,4 @@
<div class="build-status-container">
<div id="build-status-container" class="build-status-container">
<span class="build-message">{{ getBuildMessage(build) }}</span>
<div class="progress" ng-class="getBuildProgress(build) < 100 ? 'active progress-striped' : ''" ng-show="getBuildProgress(build) >= 0">
<div class="progress-bar" role="progressbar" aria-valuenow="{{ getBuildProgress(build) }}" aria-valuemin="0" aria-valuemax="100" style="{{ 'width: ' + getBuildProgress(build) + '%' }}">

View file

@ -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) {