From 5db20229aa2e98e19dca9ba95baf077d248cff00 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 23 Jun 2016 16:24:36 -0400 Subject: [PATCH] Fix error display in create repo view Fixes #1575 --- static/js/pages/new-repo.js | 11 +++++------ static/partials/new-repo.html | 5 ++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/static/js/pages/new-repo.js b/static/js/pages/new-repo.js index 2e532ab9b..e4843afa7 100644 --- a/static/js/pages/new-repo.js +++ b/static/js/pages/new-repo.js @@ -53,9 +53,11 @@ return true; }; - $scope.createNewRepo = function() { - $('#repoName').popover('hide'); + $scope.$watch('repo.name', function() { + $scope.createError = null; + }); + $scope.createNewRepo = function() { $scope.creating = true; var repo = $scope.repo; var data = { @@ -86,10 +88,7 @@ $location.path('/repository/' + created.namespace + '/' + created.name); }, function(result) { $scope.creating = false; - $scope.createError = result.data ? result.data.message : 'Cannot create repository'; - $timeout(function() { - $('#repoName').popover('show'); - }); + $scope.createError = ApiService.getErrorMessage(result); }); }; } diff --git a/static/partials/new-repo.html b/static/partials/new-repo.html index 6b379c628..801b65b58 100644 --- a/static/partials/new-repo.html +++ b/static/partials/new-repo.html @@ -41,9 +41,12 @@ - + Repository names must match [a-z0-9_-]+ + + {{ createError }} +