ocket8888 commented on code in PR #6948:
URL: https://github.com/apache/trafficcontrol/pull/6948#discussion_r918132336
##########
traffic_portal/app/src/common/modules/form/server/form.server.tpl.html:
##########
@@ -110,14 +110,17 @@
<small ng-show="server.typeId"><a
ng-href="/#!/types/{{server.typeId}}" target="_blank">View
Details <i class="fa fs-xs fa-external-link"></i></a></small>
</div>
- <label for="profile" ng-class="{'has-error':
hasError(serverForm.profile)}">Profile *</label>
- <div ng-class="{'has-error': hasError(serverForm.profile),
'has-feedback': hasError(serverForm.profile)}">
- <select id="profile" name="profile" class="form-control"
ng-model="server.profileNames[0]" ng-options="profile.name as profile.name for
profile in profiles" required>
- <option hidden selected disabled
value="">Select...</option>
- </select>
- <small class="input-error"
ng-show="hasPropertyError(serverForm.profile, 'required')">Required</small>
- <small ng-show="server.profileNames.length>0"><a
ng-href="{{getProfileID(server.profileNames[0])}}" target="_blank">View
Details <i class="fa fs-xs fa-external-link"></i></a></small>
- </div>
+ <fieldset>
+ <legend>Profiles<button name="addProfileBtn" class="btn
btn-primary right-button btn-xs" type="button" title="add a new profile"
ng-click="addProfile(server.cdnId)"><i class="fa fa-plus"></i></button></legend>
+ <fieldset ng-repeat="profile in server.profileNames track by
$index">
+ <select id="profile" name="profile" class="form-control"
ng-model="server.profileNames[$index]" ng-options="profile.name as profile.name
for profile in profiles|excludeFilter:profile:server.profileNames" required>
Review Comment:
Even though this is `required`, because it's never set to a "falsey" value
the user can click the submit button without entering a value, which gives back
the cryptic error-level Alert
> json: cannot unmarshal object into Go struct field ServerV40.profileNames
of type string
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]