Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/scripts/directives/createSecret.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -9093,7 +9093,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
Original file line number Diff line number Diff line change
Expand Up @@ -6074,22 +6074,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 @@ -6100,8 +6100,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 @@ -6110,6 +6110,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 @@ -6132,7 +6142,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 @@ -6205,7 +6215,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 @@ -6216,7 +6226,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 @@ -6227,7 +6237,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 @@ -6238,7 +6248,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