You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/11/04 03:07:44 UTC

[GitHub] [trafficcontrol] TaylorCFrey commented on a change in pull request #6325: Feature/tp refetch

TaylorCFrey commented on a change in pull request #6325:
URL: https://github.com/apache/trafficcontrol/pull/6325#discussion_r742505263



##########
File path: traffic_portal/app/src/common/modules/form/job/form.job.tpl.html
##########
@@ -47,14 +47,22 @@
                     <span ng-show="hasError(jobForm.regex)" class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>
-            <div class="form-group" ng-class="{'has-error': hasError(jobForm.ttl), 'has-feedback': hasError(jobForm.ttl)}">
+            <div class="form-group" ng-class="{'has-error': hasError(jobForm.ttlhours), 'has-feedback': hasError(jobForm.ttlhours)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">TTL (hours) *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input name="ttl" type="number" class="form-control" placeholder="Number of hours until the invalidation request expires" ng-model="job.ttl" ng-maxlength="3" ng-pattern="/^\d+$/" required autofocus>
-                    <small class="input-error" ng-show="hasPropertyError(jobForm.ttl, 'required')">Required Whole Number</small>
-                    <small class="input-error" ng-show="hasPropertyError(jobForm.ttl, 'maxlength')">Too Long</small>
-                    <small class="input-error" ng-show="hasPropertyError(jobForm.ttl, 'pattern')">Whole Number</small>
-                    <span ng-show="hasError(jobForm.ttl)" class="form-control-feedback"><i class="fa fa-times"></i></span>
+                    <input name="ttlhours" type="number" class="form-control" placeholder="Number of hours until the invalidation request expires" ng-model="job.ttlhours" ng-maxlength="3" ng-pattern="/^\d+$/" required autofocus>

Review comment:
       This is good stuff. I didn't know this. I honestly tried to touch as little as possible in this spot of the code, so what we see is the original markup. From what I am understanding, since it is `required` and `type="number"` we can do the following:
   - Remove the `ng-pattern` attribute
   - Replace the `ng-maxlength` with `max="999"` (Do/should we set a `min="0"` or `min="1"` as well?)
   
   As for the `parseInt()` call in the controller, I was to understand that was parsing the input as it was returned from the server, which until this time was the `parameters` field and a string ("TTL:36h"). Is it safe to assume that since the API has been changed to return an uint it is now a JavaScript number and doesn't need to be "parsed"?




-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org