diff --git a/endpoints/api.py b/endpoints/api.py index a0fb1e0cf..55306ee89 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -382,6 +382,12 @@ def create_repo_api(): repository_name = json['repository'] visibility = json['visibility'] + existing = model.get_repository(namespace_name, repository_name) + if existing: + return make_response('Repository already exists', 400) + + visibility = request.get_json()['visibility'] + repo = model.create_repository(namespace_name, repository_name, owner, visibility) repo.description = json['description'] diff --git a/static/css/quay.css b/static/css/quay.css index d1ea6bac9..cd9253696 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -211,10 +211,14 @@ color: #444 !important; } -.new-repo .new-header { +.new-repo .new-header span { font-size: 22px; } +.new-repo .new-header .popover { + font-size: 14px; +} + .new-repo .new-header .repo-circle { margin-right: 14px; } @@ -398,6 +402,10 @@ padding: 20px; } +.landing .popover { + font-size: 14px; +} + .landing { color: white; diff --git a/static/js/controllers.js b/static/js/controllers.js index a2cbb72af..06b810ec9 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -953,7 +953,7 @@ function V1Ctrl($scope, $location, UserService) { }, true); } -function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanService) { +function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangular, PlanService) { $scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) { $scope.user = currentUser; }, true); @@ -1079,6 +1079,8 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer }; $scope.createNewRepo = function() { + $('#repoName').popover('hide'); + var uploader = $('#file-drop')[0]; if ($scope.repo.initialize && uploader.files.length < 1) { $('#missingfileModal').modal(); @@ -1107,9 +1109,12 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer // Otherwise, redirect to the repo page. $location.path('/repository/' + created.namespace + '/' + created.name); - }, function() { - $('#cannotcreateModal').modal(); + }, function(result) { $scope.creating = false; + $scope.createError = result.data; + $timeout(function() { + $('#repoName').popover('show'); + }); }); }; diff --git a/static/partials/new-repo.html b/static/partials/new-repo.html index 96a122ce3..8330cc6d4 100644 --- a/static/partials/new-repo.html +++ b/static/partials/new-repo.html @@ -20,7 +20,7 @@
-
+
@@ -32,7 +32,7 @@ / - +