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:
parent
d7f51fb764
commit
8cb177128b
3 changed files with 29 additions and 10 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue