Merge branch 'dockerbuild' of https://bitbucket.org/yackob03/quay into dockerbuild
This commit is contained in:
commit
f72036c3fb
4 changed files with 63 additions and 28 deletions
|
@ -191,6 +191,8 @@ def create_repo_api():
|
||||||
|
|
||||||
repo = model.create_repository(namespace_name, repository_name, owner,
|
repo = model.create_repository(namespace_name, repository_name, owner,
|
||||||
visibility)
|
visibility)
|
||||||
|
repo.description = request.get_json()['description']
|
||||||
|
repo.save()
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'namespace': namespace_name,
|
'namespace': namespace_name,
|
||||||
|
|
|
@ -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) {
|
var startBuildInfoTimer = function(repo) {
|
||||||
if ($scope.interval) { return; }
|
if ($scope.interval) { return; }
|
||||||
|
|
||||||
getBuildInfo(repo);
|
getBuildInfo(repo);
|
||||||
$scope.interval = setInterval(function() {
|
$scope.interval = setInterval(function() {
|
||||||
var container = document.getElementById('build-status-container');
|
$scope.$apply(function() { getBuildInfo(repo); });
|
||||||
if (container != null && container.offsetWidth > 0) {
|
}, 5000);
|
||||||
$scope.$apply(function() { getBuildInfo(repo); });
|
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
$scope.$on("$destroy", function() {
|
$scope.$on("$destroy", function() {
|
||||||
if ($scope.interval) {
|
cancelBuildInfoTimer();
|
||||||
clearInterval($scope.interval);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var cancelBuildInfoTimer = function() {
|
||||||
|
if ($scope.interval) {
|
||||||
|
clearInterval($scope.interval);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var getBuildInfo = function(repo) {
|
var getBuildInfo = function(repo) {
|
||||||
var buildInfo = Restangular.one('repository/' + repo.namespace + '/' + repo.name + '/build/');
|
var buildInfo = Restangular.one('repository/' + repo.namespace + '/' + repo.name + '/build/');
|
||||||
buildInfo.get().then(function(resp) {
|
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;
|
$scope.loading = true;
|
||||||
|
|
||||||
// Fetch the repo.
|
// Fetch the repo.
|
||||||
var repositoryFetch = Restangular.one('repository/' + namespace + '/' + name);
|
fetchRepository();
|
||||||
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';
|
|
||||||
});
|
|
||||||
|
|
||||||
// Fetch the image history.
|
// Fetch the image history.
|
||||||
listImages();
|
listImages();
|
||||||
|
@ -1028,7 +1052,8 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer
|
||||||
var repo = $scope.repo;
|
var repo = $scope.repo;
|
||||||
var data = {
|
var data = {
|
||||||
'repository': repo.name,
|
'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');
|
var createPost = Restangular.one('repository');
|
||||||
|
|
|
@ -2,4 +2,8 @@
|
||||||
<div ng-repeat="build in buildsInfo">
|
<div ng-repeat="build in buildsInfo">
|
||||||
<div class="build-status" build="build"></div>
|
<div class="build-status" build="build"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div ng-show="buildsInfo.length == 0">
|
||||||
|
All Dockerfile builds complete
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -64,6 +64,10 @@
|
||||||
<div class="empty-message">(This repository is empty)</div>
|
<div class="empty-message">(This repository is empty)</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="repo-content" ng-show="!currentTag.image && repo.is_building">
|
||||||
|
<div class="empty-message">Your build is currently processing, if this takes longer than an hour, please contact quay support</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Content view -->
|
<!-- Content view -->
|
||||||
<div class="repo-content" ng-show="currentTag.image">
|
<div class="repo-content" ng-show="currentTag.image">
|
||||||
<!-- Image History -->
|
<!-- Image History -->
|
||||||
|
|
Reference in a new issue