Merge branch 'master' of ssh://bitbucket.org/yackob03/quay

This commit is contained in:
jakedt 2014-03-05 16:33:29 -05:00
commit 63bfde1036
8 changed files with 51 additions and 8 deletions

View file

@ -1239,7 +1239,10 @@ def request_repo_build(namespace, repository):
permission = ModifyRepositoryPermission(namespace, repository) permission = ModifyRepositoryPermission(namespace, repository)
if permission.can(): if permission.can():
logger.debug('User requested repository initialization.') logger.debug('User requested repository initialization.')
dockerfile_id = request.get_json()['file_id'] request_json = request.get_json()
dockerfile_id = request_json['file_id']
subdir = request_json['subdirectory'] if 'subdirectory' in request_json else ''
# Check if the dockerfile resource has already been used. If so, then it # Check if the dockerfile resource has already been used. If so, then it
# can only be reused if the user has access to the repository for which it # can only be reused if the user has access to the repository for which it
@ -1255,7 +1258,7 @@ def request_repo_build(namespace, repository):
display_name = user_files.get_file_checksum(dockerfile_id) display_name = user_files.get_file_checksum(dockerfile_id)
build_request = start_build(repo, dockerfile_id, ['latest'], display_name, build_request = start_build(repo, dockerfile_id, ['latest'], display_name,
'', True) subdir, True)
resp = jsonify(build_status_view(build_request, True)) resp = jsonify(build_status_view(build_request, True))
repo_string = '%s/%s' % (namespace, repository) repo_string = '%s/%s' % (namespace, repository)

View file

@ -9,7 +9,23 @@
} }
} }
.dockerfile-path {
margin-top: 10px;
padding: 20px;
padding-bottom: 0px;
font-family: Consolas, "Lucida Console", Monaco, monospace;
font-size: 14px;
}
.dockerfile-path:before {
content: "\f15b";
font-family: FontAwesome;
margin-right: 8px;
font-size: 18px;
}
.dockerfile-view { .dockerfile-view {
margin-top: 10px;
margin: 20px; margin: 20px;
padding: 20px; padding: 20px;
background: #F7F6F6; background: #F7F6F6;

View file

@ -9,7 +9,7 @@
</a> </a>
</span> </span>
</div> </div>
<div style="margin-top: 4px; margin-left: 26px; font-size: 12px; color: gray;" ng-if="!trigger.config.subdir"> <div style="margin-top: 4px; margin-left: 26px; font-size: 12px; color: gray;" ng-if="!trigger.config.subdir && !short">
<span>Dockerfile: <span>Dockerfile:
<a href="https://github.com/{{ trigger.config.build_source }}/tree/{{ trigger.config.master_branch || 'master' }}/Dockerfile" target="_blank"> <a href="https://github.com/{{ trigger.config.build_source }}/tree/{{ trigger.config.master_branch || 'master' }}/Dockerfile" target="_blank">
//Dockerfile //Dockerfile

View file

@ -2672,7 +2672,8 @@ quayApp.directive('triggerDescription', function () {
transclude: false, transclude: false,
restrict: 'C', restrict: 'C',
scope: { scope: {
'trigger': '=trigger' 'trigger': '=trigger',
'short': '=short'
}, },
controller: function($scope, $element) { controller: function($scope, $element) {
} }

View file

@ -816,9 +816,23 @@ function BuildPackageCtrl($scope, Restangular, ApiService, $routeParams, $rootSc
// itself (should) be the Dockerfile. // itself (should) be the Dockerfile.
if (zipFiles && Object.keys(zipFiles).length) { if (zipFiles && Object.keys(zipFiles).length) {
// Load the dockerfile contents. // Load the dockerfile contents.
var dockerfile = zip.file('Dockerfile'); var dockerfilePath = 'Dockerfile';
if ($scope.repobuild['job_config']) {
var dockerfileFolder = ($scope.repobuild['job_config']['build_subdir'] || '');
if (dockerfileFolder[0] == '/') {
dockerfileFolder = dockerfileFolder.substr(1);
}
if (dockerfileFolder[dockerfileFolder.length - 1] == '/') {
dockerfileFolder = dockerfileFolder.substr(0, dockerfileFolder.length - 1);
}
dockerfilePath = dockerfileFolder + 'Dockerfile';
}
var dockerfile = zip.file(dockerfilePath);
if (dockerfile) { if (dockerfile) {
$scope.dockerFileContents = dockerfile.asText(); $scope.dockerFileContents = dockerfile.asText();
$scope.dockerFilePath = dockerfilePath;
} }
// Build the zip file tree. // Build the zip file tree.
@ -833,6 +847,7 @@ function BuildPackageCtrl($scope, Restangular, ApiService, $routeParams, $rootSc
}); });
} else { } else {
$scope.dockerFileContents = response; $scope.dockerFileContents = response;
$scope.dockerFilePath = 'Dockerfile';
} }
$scope.loaded = true; $scope.loaded = true;
@ -951,8 +966,14 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope
$scope.restartBuild = function(build) { $scope.restartBuild = function(build) {
$('#confirmRestartBuildModal').modal('hide'); $('#confirmRestartBuildModal').modal('hide');
var subdirectory = '';
if (build['job_config']) {
subdirectory = build['job_config']['build_subdir'] || '';
}
var data = { var data = {
'file_id': build['resource_key'] 'file_id': build['resource_key'],
'subdirectory': subdirectory
}; };
var params = { var params = {

View file

@ -851,7 +851,8 @@ function FileTreeBase() {
* Calculates the dimensions of the tree. * Calculates the dimensions of the tree.
*/ */
FileTreeBase.prototype.calculateDimensions_ = function(container) { FileTreeBase.prototype.calculateDimensions_ = function(container) {
var cw = document.getElementById(container).clientWidth; var containerElm = document.getElementById(container);
var cw = containerElm ? containerElm.clientWidth : 1200;
var barHeight = 20; var barHeight = 20;
var ch = (this.getNodesHeight() * barHeight) + 40; var ch = (this.getNodesHeight() * barHeight) + 40;

View file

@ -37,6 +37,7 @@
<div class="tab-content"> <div class="tab-content">
<!-- Dockerfile view --> <!-- Dockerfile view -->
<div class="tab-pane active" id="dockerfile"> <div class="tab-pane active" id="dockerfile">
<div class="dockerfile-path">{{ dockerFilePath }}</div>
<div class="dockerfile-view" contents="dockerFileContents"></div> <div class="dockerfile-view" contents="dockerFileContents"></div>
<span ng-show="!dockerFileContents">No Dockerfile found in the build pack</span> <span ng-show="!dockerFileContents">No Dockerfile found in the build pack</span>
</div> </div>

View file

@ -40,7 +40,7 @@
<div class="tab-content" onresize="adjustLogHeight()"> <div class="tab-content" onresize="adjustLogHeight()">
<div ng-repeat="build in builds" class="tab-pane build-pane" ng-class="currentBuild == build ? 'active' : ''"> <div ng-repeat="build in builds" class="tab-pane build-pane" ng-class="currentBuild == build ? 'active' : ''">
<div class="alert alert-info" ng-show="build.trigger"> <div class="alert alert-info" ng-show="build.trigger">
Triggered by: <span class="trigger-description" trigger="build.trigger" style="margin-left: 10px"></span> Triggered by: <span class="trigger-description" trigger="build.trigger" short="true" style="margin-left: 10px"></span>
</div> </div>
<div class="build-header"> <div class="build-header">