Merge pull request #1576 from coreos-inc/new-repo-error
Fix error display in create repo view
This commit is contained in:
commit
31d5ff0649
2 changed files with 9 additions and 7 deletions
|
@ -53,9 +53,11 @@
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.createNewRepo = function() {
|
$scope.$watch('repo.name', function() {
|
||||||
$('#repoName').popover('hide');
|
$scope.createError = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.createNewRepo = function() {
|
||||||
$scope.creating = true;
|
$scope.creating = true;
|
||||||
var repo = $scope.repo;
|
var repo = $scope.repo;
|
||||||
var data = {
|
var data = {
|
||||||
|
@ -86,10 +88,7 @@
|
||||||
$location.path('/repository/' + created.namespace + '/' + created.name);
|
$location.path('/repository/' + created.namespace + '/' + created.name);
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
$scope.creating = false;
|
$scope.creating = false;
|
||||||
$scope.createError = result.data ? result.data.message : 'Cannot create repository';
|
$scope.createError = ApiService.getErrorMessage(result);
|
||||||
$timeout(function() {
|
|
||||||
$('#repoName').popover('show');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,12 @@
|
||||||
<input id="repoName" name="repoName" type="text" class="form-control" placeholder="Repository Name" ng-model="repo.name"
|
<input id="repoName" name="repoName" type="text" class="form-control" placeholder="Repository Name" ng-model="repo.name"
|
||||||
required autofocus data-trigger="manual" data-content="{{ createError }}" data-placement="right" ng-pattern="/^[.a-z0-9_-]+$/">
|
required autofocus data-trigger="manual" data-content="{{ createError }}" data-placement="right" ng-pattern="/^[.a-z0-9_-]+$/">
|
||||||
</span>
|
</span>
|
||||||
<span class="co-alert co-alert-warning co-alert-popin-warning" ng-show="!newRepoForm.repoName.$error.required && !newRepoForm.repoName.$valid">
|
<span class="co-alert co-alert-warning co-alert-popin-warning" ng-show="!creating && !newRepoForm.repoName.$error.required && !newRepoForm.repoName.$valid">
|
||||||
Repository names must match [a-z0-9_-]+
|
Repository names must match [a-z0-9_-]+
|
||||||
</span>
|
</span>
|
||||||
|
<span class="co-alert co-alert-danger co-alert-popin-warning" ng-show="!creating && createError">
|
||||||
|
{{ createError }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue