Fix create token form in the repo-admin view. We had to add type="button" to the delete-ui button so that clicking it doesn't submit the form (and keep the focus there)

This commit is contained in:
Joseph Schorr 2014-07-29 18:53:23 -04:00
parent a661ef4fa8
commit af32b53a4e
3 changed files with 8 additions and 6 deletions

View file

@ -1387,14 +1387,16 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams
});
};
$scope.newTokenName = null;
$scope.createToken = function() {
var friendlyName = {
'friendlyName': $scope.newToken.friendlyName
var data = {
'friendlyName': $scope.newTokenName
};
var params = {'repository': namespace + '/' + name};
ApiService.createToken(friendlyName, params).then(function(newToken) {
$scope.newToken.friendlyName = '';
ApiService.createToken(data, params).then(function(newToken) {
$scope.newTokenName = null;
$scope.createTokenForm.$setPristine();
$scope.tokens[newToken.code] = newToken;
});