Fix some issues around validation in the config forms

This commit is contained in:
Joseph Schorr 2015-01-14 17:04:02 -05:00
parent 511c607bbb
commit cc453e7d10
4 changed files with 23 additions and 17 deletions

View file

@ -278,13 +278,6 @@
padding: 6px; padding: 6px;
} }
.config-setup-tool-element label {
padding-left: 10px;
padding-right: 10px;
margin: 4px;
cursor: pointer;
}
.config-file-field-element input { .config-file-field-element input {
display: inline-block; display: inline-block;
width: 78px; width: 78px;
@ -302,6 +295,7 @@
.co-checkbox label { .co-checkbox label {
position: relative; position: relative;
padding-left: 28px; padding-left: 28px;
cursor: pointer;
} }
.co-checkbox label:before { .co-checkbox label:before {

View file

@ -61,7 +61,8 @@
<td>Server Hostname:</td> <td>Server Hostname:</td>
<td> <td>
<span class="config-string-field" binding="config.SERVER_HOSTNAME" <span class="config-string-field" binding="config.SERVER_HOSTNAME"
placeholder="Hostname (and optional port if non-standard)"></span> placeholder="Hostname (and optional port if non-standard)"
pattern="^[a-zA-Z-0-9\.]+(:[0-9]+)?$"></span>
<div class="help-text"> <div class="help-text">
The HTTP host (and optionally the port number if a non-standard HTTP/HTTPS port) of the location The HTTP host (and optionally the port number if a non-standard HTTP/HTTPS port) of the location
where the registry will be accessible on the network where the registry will be accessible on the network
@ -119,7 +120,8 @@
<td>Redis Hostname:</td> <td>Redis Hostname:</td>
<td> <td>
<span class="config-string-field" binding="mapped.redis.host" <span class="config-string-field" binding="mapped.redis.host"
placeholder="The redis server hostname"></span> placeholder="The redis server hostname"
pattern="^[a-zA-Z-0-9\.]+(:[0-9]+)?$"></span>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -213,7 +215,8 @@
<td>SMTP Server:</td> <td>SMTP Server:</td>
<td> <td>
<span class="config-string-field" binding="config.MAIL_SERVER" <span class="config-string-field" binding="config.MAIL_SERVER"
placeholder="SMTP server for sending e-mail"></span> placeholder="SMTP server for sending e-mail"
pattern="^[a-zA-Z-0-9\.]+(:[0-9]+)?$"></span>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -235,8 +238,8 @@
<tr> <tr>
<td>Mail Sender:</td> <td>Mail Sender:</td>
<td> <td>
<span class="config-string-field" binding="config.DEFAULT_MAIL_SENDER" <input class="form-control" type="email" ng-model="config.DEFAULT_MAIL_SENDER"
placeholder="E-mail address"></span> placeholder="E-mail address"></span>
<div class="help-text"> <div class="help-text">
E-mail address from which all e-mails are sent. If not specified, E-mail address from which all e-mails are sent. If not specified,
<code>support@quay.io</code> will be used. <code>support@quay.io</code> will be used.
@ -374,7 +377,7 @@
<span class="config-string-field" <span class="config-string-field"
binding="config.GITHUB_LOGIN_CONFIG.GITHUB_ENDPOINT" binding="config.GITHUB_LOGIN_CONFIG.GITHUB_ENDPOINT"
placeholder="https://my.githubserver" placeholder="https://my.githubserver"
pattern="https?://([a-zA-Z0-9]+\.?\/?)+"> pattern="^https?://([a-zA-Z0-9]+\.?\/?)+$">
</span> </span>
<div class="help-text"> <div class="help-text">
The Github Enterprise endpoint. Must start with http:// or https://. The Github Enterprise endpoint. Must start with http:// or https://.
@ -506,7 +509,7 @@
<span class="config-string-field" <span class="config-string-field"
binding="config.GITHUB_TRIGGER_CONFIG.GITHUB_ENDPOINT" binding="config.GITHUB_TRIGGER_CONFIG.GITHUB_ENDPOINT"
placeholder="https://my.githubserver" placeholder="https://my.githubserver"
pattern="https?://([a-zA-Z0-9]+\.?\/?)+"> pattern="^https?://([a-zA-Z0-9]+\.?\/?)+$">
</span> </span>
<div class="help-text"> <div class="help-text">
The Github Enterprise endpoint. Must start with http:// or https://. The Github Enterprise endpoint. Must start with http:// or https://.

View file

@ -2924,7 +2924,7 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
$scope.creatingUser = false; $scope.creatingUser = false;
$scope.newUser = {}; $scope.newUser = {};
$scope.createdUser = resp; $scope.createdUser = resp;
$scope.loadUsers(); $scope.loadUsersInternal();
}, errorHandler) }, errorHandler)
}; };
@ -3028,12 +3028,16 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
}; };
$scope.createSuperUser = function() { $scope.createSuperUser = function() {
$scope.createSuperuserIssue = null;
$scope.configStep = 'creating-superuser'; $scope.configStep = 'creating-superuser';
ApiService.scCreateInitialSuperuser($scope.superUser, null).then(function(resp) { ApiService.scCreateInitialSuperuser($scope.superUser, null).then(function(resp) {
UserService.load(); UserService.load();
$('#createSuperuserModal').modal('hide'); $('#createSuperuserModal').modal('hide');
$scope.checkContainerStatus(); $scope.checkContainerStatus();
}, ApiService.errorDisplay('Could not create superuser')); }, function(resp) {
$scope.configStep = 'create-superuser';
$scope.createSuperuserIssue = ApiService.getErrorMessage(resp, 'Could not create superuser');
});
}; };
$scope.checkContainerStatus = function() { $scope.checkContainerStatus = function() {

View file

@ -292,7 +292,9 @@
<div class="form-group"> <div class="form-group">
<label>Password</label> <label>Password</label>
<input class="form-control" type="password" ng-model="superUser.password" required> <input class="form-control" type="password" ng-model="superUser.password"
ng-pattern="/^[^\s]+$/"
ng-minlength="8" required>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -302,6 +304,9 @@
</div> </div>
</div> </div>
<div class="modal-footer alert alert-warning" ng-show="createSuperuserIssue">
{{ createSuperuserIssue }}
</div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary" ng-disabled="!superuserForm.$valid" <button type="submit" class="btn btn-primary" ng-disabled="!superuserForm.$valid"
ng-show="configStep == 'create-superuser'"> ng-show="configStep == 'create-superuser'">