Work in progress: Add the UI for the build status and start on the file drop stuff

This commit is contained in:
Joseph Schorr 2013-10-26 16:03:11 -04:00
parent dc7a62db67
commit fc6e3258a8
13 changed files with 278 additions and 31 deletions

View file

@ -339,6 +339,19 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim
}
});
var startBuildInfoTimer = function(repo) {
setInterval(function() {
$scope.$apply(function() { getBuildInfo(repo); });
}, 5000);
};
var getBuildInfo = function(repo) {
var buildInfo = Restangular.one('repository/' + repo.namespace + '/' + repo.name + '/build/');
buildInfo.get().then(function(resp) {
$scope.buildsInfo = resp.builds;
});
};
var listImages = function() {
if ($scope.imageHistory) { return; }
@ -443,6 +456,10 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim
$('#copyClipboard').clipboardCopy();
$scope.loading = false;
if (repo.is_building) {
getBuildInfo(repo);
}
}, function() {
$scope.repo = null;
$scope.loading = false;
@ -895,7 +912,7 @@ function V1Ctrl($scope, UserService) {
};
}
function NewRepoCtrl($scope, UserService) {
function NewRepoCtrl($scope, $location, UserService, Restangular) {
$scope.repo = {
'is_public': 1,
'description': '',
@ -906,7 +923,7 @@ function NewRepoCtrl($scope, UserService) {
$scope.user = currentUser;
if ($scope.user.anonymous) {
document.location = '/signin/';
$location.path('/signin/');
}
}, true);
@ -931,4 +948,24 @@ function NewRepoCtrl($scope, UserService) {
$('#editModal').modal('hide');
$scope.repo.description = $('#wmd-input-description')[0].value;
};
$scope.createNewRepo = function() {
$scope.creating = true;
var repo = $scope.repo;
var data = {
'repository': repo.name,
'visibility': repo.is_public == '1' ? 'public' : 'private'
};
var createPost = Restangular.one('repository');
createPost.customPOST(data).then(function(created) {
// Repository created. Start the upload process if applicable.
// Otherwise, redirect to the repo page.
$location.path('/repository/' + created.namespace + '/' + created.name);
}, function() {
$('#cannotcreateModal').modal();
$scope.creating = false;
});
};
}