Skip to content

Commit

Permalink
Merge pull request #2680 from jhadvig/sec-form
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Bug 1535976 - Fix input name in the create-secret form

Fixed wrong `input` names in the `create-secret.html` 
@jwforres PTAL
  • Loading branch information
openshift-merge-robot committed Jan 24, 2018
2 parents af52dc1 + 085c264 commit e92e0cf
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 27 deletions.
5 changes: 5 additions & 0 deletions app/scripts/directives/createSecret.js
Expand Up @@ -26,6 +26,11 @@ angular.module("openshiftConsole")
templateUrl: 'views/directives/create-secret.html',
link: function($scope) {
$scope.nameValidation = DNS1123_SUBDOMAIN_VALIDATION;
$scope.secretReferenceValidation = {
pattern: /^[a-zA-Z0-9\-_]+$/,
minLength: 8,
description: 'Secret reference key must consist of lower-case, upper-case letters, numbers, dash, and underscore.'
};

$scope.secretAuthTypeMap = {
image: {
Expand Down
38 changes: 25 additions & 13 deletions app/views/directives/create-secret.html
Expand Up @@ -12,10 +12,10 @@
<div ng-if="newSecret.type">
<div class="form-group">
<label for="secret-name" class="required">Secret Name</label>
<span ng-class="{'has-error': nameTaken || (secretForm.secretName.$invalid && secretForm.secretName.$touched)}">
<span ng-class="{'has-error': nameTaken || (secretForm.name.$invalid && secretForm.name.$touched)}">
<input class="form-control"
id="secret-name"
name="secret-name"
name="name"
ng-model="newSecret.data.secretName"
type="text"
autocorrect="off"
Expand All @@ -32,14 +32,14 @@
This name is already in use. Please choose a different name.
</span>
</div>
<div class="has-error" ng-show="secretForm.secretName.$invalid">
<div ng-show="secretForm.secretName.$error.pattern && secretForm.secretName.$touched" class="help-block">
<div class="has-error" ng-show="secretForm.name.$invalid">
<div ng-show="secretForm.name.$error.pattern && secretForm.name.$touched" class="help-block">
{{nameValidation.description}}
</div>
<div ng-show="secretForm.secretName.$error.required && secretForm.secretName.$touched" class="help-block">
<div ng-show="secretForm.name.$error.required && secretForm.name.$touched" class="help-block">
Name is required.
</div>
<div ng-show="secretForm.secretName.$error.maxlength && secretForm.secretName.$touched" class="help-block">
<div ng-show="secretForm.name.$error.maxlength && secretForm.name.$touched" class="help-block">
Can't be longer than {{nameValidation.maxlength}} characters.
</div>
</div>
Expand All @@ -51,11 +51,13 @@
<div ng-if="newSecret.type == 'webhook'">
<div class="form-group">
<label for="webhook-secret-key" class="required">Webhook Secret Key</label>
<div class="input-group">
<div class="input-group" ng-class="{ 'has-error': secretForm.webhookSecretKey.$invalid && secretForm.webhookSecretKey.$touched}">
<input class="form-control"
id="webhook-secret-key"
name="webhook-secret-key"
name="webhookSecretKey"
ng-model="newSecret.data.webhookSecretKey"
ng-pattern="secretReferenceValidation.pattern"
ng-minlength="secretReferenceValidation.minLength"
type="text"
autocorrect="off"
autocapitalize="none"
Expand All @@ -70,6 +72,16 @@
Value of the secret will be supplied when invoking the webhook.
<a ng-href="{{'webhooks' | helpLink}}" target="_blank"><span class="learn-more-inline">Learn More&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></span></a>
</div>
<div class="has-error" ng-show="secretForm.webhookSecretKey.$error.pattern && secretForm.webhookSecretKey.$touched">
<span class="help-block">
{{secretReferenceValidation.description}}
</span>
</div>
<div class="has-error" ng-show="secretForm.webhookSecretKey.$error.minlength && secretForm.webhookSecretKey.$touched">
<span class="help-block">
The key must have at least {{secretReferenceValidation.minLength}} characters.
</span>
</div>
</div>
</div>

Expand Down Expand Up @@ -105,7 +117,7 @@
<label ng-class="{ required: !add.cacert && !add.gitconfig }" for="password-token">Password or Token</label>
<input class="form-control"
id="password-token"
name="password-token"
name="passwordToken"
ng-model="newSecret.data.passwordToken"
autocorrect="off"
autocapitalize="none"
Expand Down Expand Up @@ -208,7 +220,7 @@
<div>
<input class="form-control"
id="docker-server"
name="docker-server"
name="dockerServer"
ng-model="newSecret.data.dockerServer"
type="text"
autocorrect="off"
Expand All @@ -228,7 +240,7 @@
<div>
<input class="form-control"
id="docker-username"
name="docker-username"
name="dockerUsername"
ng-model="newSecret.data.dockerUsername"
type="text"
autocorrect="off"
Expand All @@ -248,7 +260,7 @@
<div>
<input class="form-control"
id="docker-password"
name="docker-password"
name="dockerPassword"
ng-model="newSecret.data.dockerPassword"
type="password"
autocorrect="off"
Expand All @@ -268,7 +280,7 @@
<input class="form-control"
type="email"
id="docker-email"
name="docker-email"
name="dockerEmail"
ng-model="newSecret.data.dockerMail"
autocorrect="off"
autocapitalize="none"
Expand Down
6 changes: 5 additions & 1 deletion dist/scripts/scripts.js
Expand Up @@ -9057,7 +9057,11 @@ onCancel: "&"
},
templateUrl: "views/directives/create-secret.html",
link: function(l) {
l.nameValidation = i, l.secretAuthTypeMap = {
l.nameValidation = i, l.secretReferenceValidation = {
pattern: /^[a-zA-Z0-9\-_]+$/,
minLength: 8,
description: "Secret reference key must consist of lower-case, upper-case letters, numbers, dash, and underscore."
}, l.secretAuthTypeMap = {
image: {
label: "Image Secret",
authTypes: [ {
Expand Down
36 changes: 23 additions & 13 deletions dist/scripts/templates.js
Expand Up @@ -6076,22 +6076,22 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div ng-if=\"newSecret.type\">\n" +
"<div class=\"form-group\">\n" +
"<label for=\"secret-name\" class=\"required\">Secret Name</label>\n" +
"<span ng-class=\"{'has-error': nameTaken || (secretForm.secretName.$invalid && secretForm.secretName.$touched)}\">\n" +
"<input class=\"form-control\" id=\"secret-name\" name=\"secret-name\" ng-model=\"newSecret.data.secretName\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" aria-describedby=\"secret-name-help\" ng-pattern=\"nameValidation.pattern\" ng-maxlength=\"nameValidation.maxlength\" ng-change=\"nameChanged()\" required>\n" +
"<span ng-class=\"{'has-error': nameTaken || (secretForm.name.$invalid && secretForm.name.$touched)}\">\n" +
"<input class=\"form-control\" id=\"secret-name\" name=\"name\" ng-model=\"newSecret.data.secretName\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" aria-describedby=\"secret-name-help\" ng-pattern=\"nameValidation.pattern\" ng-maxlength=\"nameValidation.maxlength\" ng-change=\"nameChanged()\" required>\n" +
"</span>\n" +
"<div class=\"has-error\" ng-show=\"nameTaken\">\n" +
"<span class=\"help-block\">\n" +
"This name is already in use. Please choose a different name.\n" +
"</span>\n" +
"</div>\n" +
"<div class=\"has-error\" ng-show=\"secretForm.secretName.$invalid\">\n" +
"<div ng-show=\"secretForm.secretName.$error.pattern && secretForm.secretName.$touched\" class=\"help-block\">\n" +
"<div class=\"has-error\" ng-show=\"secretForm.name.$invalid\">\n" +
"<div ng-show=\"secretForm.name.$error.pattern && secretForm.name.$touched\" class=\"help-block\">\n" +
"{{nameValidation.description}}\n" +
"</div>\n" +
"<div ng-show=\"secretForm.secretName.$error.required && secretForm.secretName.$touched\" class=\"help-block\">\n" +
"<div ng-show=\"secretForm.name.$error.required && secretForm.name.$touched\" class=\"help-block\">\n" +
"Name is required.\n" +
"</div>\n" +
"<div ng-show=\"secretForm.secretName.$error.maxlength && secretForm.secretName.$touched\" class=\"help-block\">\n" +
"<div ng-show=\"secretForm.name.$error.maxlength && secretForm.name.$touched\" class=\"help-block\">\n" +
"Can't be longer than {{nameValidation.maxlength}} characters.\n" +
"</div>\n" +
"</div>\n" +
Expand All @@ -6102,8 +6102,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div ng-if=\"newSecret.type == 'webhook'\">\n" +
"<div class=\"form-group\">\n" +
"<label for=\"webhook-secret-key\" class=\"required\">Webhook Secret Key</label>\n" +
"<div class=\"input-group\">\n" +
"<input class=\"form-control\" id=\"webhook-secret-key\" name=\"webhook-secret-key\" ng-model=\"newSecret.data.webhookSecretKey\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" aria-describedby=\"webhook-secret-key-help\" required=\"true\">\n" +
"<div class=\"input-group\" ng-class=\"{ 'has-error': secretForm.webhookSecretKey.$invalid && secretForm.webhookSecretKey.$touched}\">\n" +
"<input class=\"form-control\" id=\"webhook-secret-key\" name=\"webhookSecretKey\" ng-model=\"newSecret.data.webhookSecretKey\" ng-pattern=\"secretReferenceValidation.pattern\" ng-minlength=\"secretReferenceValidation.minLength\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" aria-describedby=\"webhook-secret-key-help\" required=\"true\">\n" +
"<span class=\"input-group-btn\">\n" +
"<button type=\"button\" class=\"btn btn-default\" ng-click=\"generateWebhookSecretKey()\">Generate</button>\n" +
"</span>\n" +
Expand All @@ -6112,6 +6112,16 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"Value of the secret will be supplied when invoking the webhook.\n" +
"<a ng-href=\"{{'webhooks' | helpLink}}\" target=\"_blank\"><span class=\"learn-more-inline\">Learn More&nbsp;<i class=\"fa fa-external-link\" aria-hidden=\"true\"></i></span></a>\n" +
"</div>\n" +
"<div class=\"has-error\" ng-show=\"secretForm.webhookSecretKey.$error.pattern && secretForm.webhookSecretKey.$touched\">\n" +
"<span class=\"help-block\">\n" +
"{{secretReferenceValidation.description}}\n" +
"</span>\n" +
"</div>\n" +
"<div class=\"has-error\" ng-show=\"secretForm.webhookSecretKey.$error.minlength && secretForm.webhookSecretKey.$touched\">\n" +
"<span class=\"help-block\">\n" +
"The key must have at least {{secretReferenceValidation.minLength}} characters.\n" +
"</span>\n" +
"</div>\n" +
"</div>\n" +
"</div>\n" +
"<div ng-if=\"newSecret.type != 'webhook'\">\n" +
Expand All @@ -6134,7 +6144,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</div>\n" +
"<div class=\"form-group\" ng-class=\"{ 'has-error' : secretForm.passwordToken.$invalid && secretForm.passwordToken.$touched }\">\n" +
"<label ng-class=\"{ required: !add.cacert && !add.gitconfig }\" for=\"password-token\">Password or Token</label>\n" +
"<input class=\"form-control\" id=\"password-token\" name=\"password-token\" ng-model=\"newSecret.data.passwordToken\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" aria-describedby=\"password-token-help\" type=\"password\" ng-required=\"!add.cacert && !add.gitconfig\">\n" +
"<input class=\"form-control\" id=\"password-token\" name=\"passwordToken\" ng-model=\"newSecret.data.passwordToken\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" aria-describedby=\"password-token-help\" type=\"password\" ng-required=\"!add.cacert && !add.gitconfig\">\n" +
"</div>\n" +
"<div class=\"has-error\" ng-show=\"secretForm.passwordToken.$error.required && secretForm.passwordToken.$touched\">\n" +
"<div class=\"help-block\">\n" +
Expand Down Expand Up @@ -6207,7 +6217,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"form-group\" ng-class=\"{ 'has-error' : secretForm.dockerServer.$invalid && secretForm.dockerServer.$touched }\">\n" +
"<label for=\"docker-server\" class=\"required\">Image Registry Server Address</label>\n" +
"<div>\n" +
"<input class=\"form-control\" id=\"docker-server\" name=\"docker-server\" ng-model=\"newSecret.data.dockerServer\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"<input class=\"form-control\" id=\"docker-server\" name=\"dockerServer\" ng-model=\"newSecret.data.dockerServer\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"</div>\n" +
"</div>\n" +
"<div ng-show=\"secretForm.dockerServer.$error.required && secretForm.dockerServer.$touched\" class=\"has-error\">\n" +
Expand All @@ -6218,7 +6228,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"form-group\" ng-class=\"{ 'has-error' : secretForm.dockerUsername.$invalid && secretForm.dockerUsername.$touched }\">\n" +
"<label for=\"docker-username\" class=\"required\">Username</label>\n" +
"<div>\n" +
"<input class=\"form-control\" id=\"docker-username\" name=\"docker-username\" ng-model=\"newSecret.data.dockerUsername\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"<input class=\"form-control\" id=\"docker-username\" name=\"dockerUsername\" ng-model=\"newSecret.data.dockerUsername\" type=\"text\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"</div>\n" +
"</div>\n" +
"<div ng-show=\"secretForm.dockerUsername.$error.required && secretForm.dockerUsername.$touched\" class=\"has-error\">\n" +
Expand All @@ -6229,7 +6239,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"form-group\" ng-class=\"{ 'has-error' : secretForm.dockerPassword.$invalid && secretForm.dockerPassword.$touched }\">\n" +
"<label for=\"docker-password\" class=\"required\">Password</label>\n" +
"<div>\n" +
"<input class=\"form-control\" id=\"docker-password\" name=\"docker-password\" ng-model=\"newSecret.data.dockerPassword\" type=\"password\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"<input class=\"form-control\" id=\"docker-password\" name=\"dockerPassword\" ng-model=\"newSecret.data.dockerPassword\" type=\"password\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"</div>\n" +
"</div>\n" +
"<div ng-show=\"secretForm.dockerPassword.$error.required && secretForm.dockerPassword.$touched\" class=\"has-error\">\n" +
Expand All @@ -6240,7 +6250,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"form-group\" ng-class=\"{ 'has-error' : secretForm.dockerEmail.$invalid && secretForm.dockerEmail.$touched }\">\n" +
"<label for=\"docker-email\" class=\"required\">Email</label>\n" +
"<div>\n" +
"<input class=\"form-control\" type=\"email\" id=\"docker-email\" name=\"docker-email\" ng-model=\"newSecret.data.dockerMail\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"<input class=\"form-control\" type=\"email\" id=\"docker-email\" name=\"dockerEmail\" ng-model=\"newSecret.data.dockerMail\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\" required>\n" +
"</div>\n" +
"</div>\n" +
"<div class=\"has-error\" ng-show=\"secretForm.dockerEmail.$invalid\">\n" +
Expand Down

0 comments on commit e92e0cf

Please sign in to comment.