Skip to content

Commit c607b86

Browse files
author
OpenShift Bot
authored
Merge pull request #1865 from spadgett/deploy-image-name-minlength
Merged by openshift-bot
2 parents 7b414b3 + 73890f5 commit c607b86

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

app/scripts/directives/deployImage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ angular.module("openshiftConsole")
2424
},
2525
templateUrl: 'views/directives/deploy-image.html',
2626
link: function($scope) {
27+
$scope.forms = {};
28+
2729
// Pick from an image stream tag or Docker image name.
2830
$scope.mode = "istag"; // "istag" or "dockerImage"
2931

app/views/directives/deploy-image.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ <h2>
109109

110110
<div class="row" ng-if-end>
111111
<div class="col-sm-12">
112-
<form name="form" class="osc-form">
112+
<ng-form name="forms.deployImage" class="osc-form">
113113
<div class="form-group">
114114
<label for="name" class="required">Name</label>
115-
<div ng-class="{'has-error': form.name.$invalid || nameTaken}">
115+
<div ng-class="{'has-error': (forms.deployImage.name.$invalid && forms.deployImage.name.$touched) || nameTaken}">
116116
<input type="text"
117117
required
118118
select-on-focus
@@ -128,19 +128,19 @@ <h2>
128128
spellcheck="false">
129129
</div>
130130
<div class="help-block">Identifies the resources created for this image.</div>
131-
<div class="has-error" ng-show="form.name.$invalid">
132-
<div class="help-block" ng-show="form.name.$error.required">
131+
<div class="has-error" ng-show="forms.deployImage.name.$invalid && forms.deployImage.name.$touched">
132+
<div class="help-block" ng-show="forms.deployImage.name.$error.required">
133133
A name is required.
134134
</div>
135-
<div class="help-block" ng-show="form.name.$error.pattern">
135+
<div class="help-block" ng-show="forms.deployImage.name.$error.pattern">
136136
Name must be an alphanumeric (a-z, 0-9) string with a maximum length
137137
of 24 characters where the first character is a letter (a-z). The '-'
138138
character is allowed anywhere except the first or last character.
139139
</div>
140-
<div class="help-block" ng-show="form.name.$error.minlength">
140+
<div class="help-block" ng-show="forms.deployImage.name.$error.minlength">
141141
Name must have at least 2 characters.
142142
</div>
143-
<div class="help-block" ng-show="form.name.$error.maxlength">
143+
<div class="help-block" ng-show="forms.deployImage.name.$error.maxlength">
144144
Name can't have more than 24 characters.
145145
</div>
146146
</div>
@@ -188,10 +188,10 @@ <h2>
188188
class="btn btn-primary btn-lg"
189189
ng-click="create()"
190190
value=""
191-
ng-disabled="form.$invalid || nameTaken || disableInputs">Create</button>
191+
ng-disabled="forms.deployImage.$invalid || nameTaken || disableInputs">Create</button>
192192
<a class="btn btn-default btn-lg" href="#" back>Cancel</a>
193193
</div>
194-
</form>
194+
</ng-form>
195195
</div>
196196
</div>
197197

dist/scripts/scripts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13049,7 +13049,7 @@ labels: e,
1304913049
pullSecrets: n.pullSecrets
1305013050
});
1305113051
}
13052-
n.mode = "istag", n.istag = {}, n.app = {}, n.env = [], n.labels = [ {
13052+
n.forms = {}, n.mode = "istag", n.istag = {}, n.app = {}, n.env = [], n.labels = [ {
1305313053
name: "app",
1305413054
value: ""
1305513055
} ], n.pullSecrets = [ {

dist/scripts/templates.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6336,24 +6336,24 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
63366336
"</div>\n" +
63376337
"<div class=\"row\" ng-if-end>\n" +
63386338
"<div class=\"col-sm-12\">\n" +
6339-
"<form name=\"form\" class=\"osc-form\">\n" +
6339+
"<ng-form name=\"forms.deployImage\" class=\"osc-form\">\n" +
63406340
"<div class=\"form-group\">\n" +
63416341
"<label for=\"name\" class=\"required\">Name</label>\n" +
6342-
"<div ng-class=\"{'has-error': form.name.$invalid || nameTaken}\">\n" +
6342+
"<div ng-class=\"{'has-error': (forms.deployImage.name.$invalid && forms.deployImage.name.$touched) || nameTaken}\">\n" +
63436343
"<input type=\"text\" required select-on-focus minlength=\"2\" maxlength=\"24\" pattern=\"[a-z]([-a-z0-9]*[a-z0-9])?\" ng-model=\"app.name\" id=\"name\" name=\"name\" class=\"form-control\" autocorrect=\"off\" autocapitalize=\"none\" spellcheck=\"false\">\n" +
63446344
"</div>\n" +
63456345
"<div class=\"help-block\">Identifies the resources created for this image.</div>\n" +
6346-
"<div class=\"has-error\" ng-show=\"form.name.$invalid\">\n" +
6347-
"<div class=\"help-block\" ng-show=\"form.name.$error.required\">\n" +
6346+
"<div class=\"has-error\" ng-show=\"forms.deployImage.name.$invalid && forms.deployImage.name.$touched\">\n" +
6347+
"<div class=\"help-block\" ng-show=\"forms.deployImage.name.$error.required\">\n" +
63486348
"A name is required.\n" +
63496349
"</div>\n" +
6350-
"<div class=\"help-block\" ng-show=\"form.name.$error.pattern\">\n" +
6350+
"<div class=\"help-block\" ng-show=\"forms.deployImage.name.$error.pattern\">\n" +
63516351
"Name must be an alphanumeric (a-z, 0-9) string with a maximum length of 24 characters where the first character is a letter (a-z). The '-' character is allowed anywhere except the first or last character.\n" +
63526352
"</div>\n" +
6353-
"<div class=\"help-block\" ng-show=\"form.name.$error.minlength\">\n" +
6353+
"<div class=\"help-block\" ng-show=\"forms.deployImage.name.$error.minlength\">\n" +
63546354
"Name must have at least 2 characters.\n" +
63556355
"</div>\n" +
6356-
"<div class=\"help-block\" ng-show=\"form.name.$error.maxlength\">\n" +
6356+
"<div class=\"help-block\" ng-show=\"forms.deployImage.name.$error.maxlength\">\n" +
63576357
"Name can't have more than 24 characters.\n" +
63586358
"</div>\n" +
63596359
"</div>\n" +
@@ -6370,10 +6370,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
63706370
"</label-editor>\n" +
63716371
"<alerts alerts=\"alerts\"></alerts>\n" +
63726372
"<div ng-if=\"!isDialog\" class=\"button-group gutter-bottom\" ng-class=\"{'gutter-top': !alerts.length}\">\n" +
6373-
"<button type=\"submit\" class=\"btn btn-primary btn-lg\" ng-click=\"create()\" value=\"\" ng-disabled=\"form.$invalid || nameTaken || disableInputs\">Create</button>\n" +
6373+
"<button type=\"submit\" class=\"btn btn-primary btn-lg\" ng-click=\"create()\" value=\"\" ng-disabled=\"forms.deployImage.$invalid || nameTaken || disableInputs\">Create</button>\n" +
63746374
"<a class=\"btn btn-default btn-lg\" href=\"#\" back>Cancel</a>\n" +
63756375
"</div>\n" +
6376-
"</form>\n" +
6376+
"</ng-form>\n" +
63776377
"</div>\n" +
63786378
"</div>\n" +
63796379
"<div ng-if=\"!loading && import.error\" class=\"empty-state-message text-center\">\n" +

0 commit comments

Comments
 (0)