Merge pull request #656 from coreos-inc/builddialogerr

Fix small UI bugs around uploading dockerfiles
This commit is contained in:
josephschorr 2015-10-16 17:53:14 -04:00
commit 72b938c45a
2 changed files with 21 additions and 5 deletions

View file

@ -52,6 +52,7 @@ angular.module('quay').directive('dockerfileBuildDialog', function () {
if (sn && $scope.repository) {
$scope.viewTriggers = false;
$scope.startTrigger = null;
$scope.errorMessage = null;
$element.find('.dockerfilebuildModal').modal({});

View file

@ -196,21 +196,36 @@ angular.module('quay').directive('dockerfileBuildForm', function () {
}
});
};
request.onerror = function() {
$scope.$apply(function() {
handleUploadFailed();
});
};
request.onreadystatechange = function() {
var state = request.readyState;
var status = request.status;
if (state == 4) {
$scope.$apply(function() {
startBuild(fileId);
$scope.uploading = false;
});
return;
if (Math.floor(status / 100) == 2) {
$scope.$apply(function() {
startBuild(fileId);
$scope.uploading = false;
});
} else {
var message = request.statusText;
if (status == 413) {
message = 'Selected file too large to upload';
}
$scope.$apply(function() {
handleUploadFailed(message);
});
}
}
};
request.send(file);
};