1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

update interger directive instead of doing awnodash

This commit is contained in:
John Mitchell 2015-08-04 00:14:32 -04:00
parent 992e0a7ae2
commit a1942e65cd
2 changed files with 9 additions and 5 deletions

View File

@ -293,8 +293,12 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
if (/^\-?\d*$/.test(viewValue)) { if (/^\-?\d*$/.test(viewValue)) {
// it is valid // it is valid
ctrl.$setValidity('integer', true); ctrl.$setValidity('integer', true);
if ( viewValue === '-' || viewValue === '' || viewValue === null) {
ctrl.$setValidity('integer', false);
return viewValue;
}
if (elm.attr('min') && if (elm.attr('min') &&
( viewValue === '' || viewValue === null || parseInt(viewValue,10) < parseInt(elm.attr('min'),10) ) ) { parseInt(viewValue,10) < parseInt(elm.attr('min'),10) ) {
ctrl.$setValidity('min', false); ctrl.$setValidity('min', false);
return viewValue; return viewValue;
} }

View File

@ -158,7 +158,7 @@
<div id="prompt-for-days" style="display:none"> <div id="prompt-for-days" style="display:none">
<form name="prompt_for_days_form" id="prompt_for_days_form"> <form name="prompt_for_days_form" id="prompt_for_days_form">
Set how many days of data should be retained. <br> Set how many days of data should be retained. <br>
<input type="integer" id="days_to_keep" name="days_to_keep" ng-model="days_to_keep" ng-required="true" class="form-control" min=0 aw-min=0 max=9999 aw-max=9999 aw-no-dash style="margin-top:10px;" integer> <input type="integer" id="days_to_keep" name="days_to_keep" ng-model="days_to_keep" ng-required="true" class="form-control" min=0 max=9999 style="margin-top:10px;" integer>
<div class="error" ng-show="prompt_for_days_form.days_to_keep.$dirty && (prompt_for_days_form.days_to_keep.$error.number || prompt_for_days_form.days_to_keep.$error.integer || <div class="error" ng-show="prompt_for_days_form.days_to_keep.$dirty && (prompt_for_days_form.days_to_keep.$error.number || prompt_for_days_form.days_to_keep.$error.integer ||
prompt_for_days_form.days_to_keep.$error.required || prompt_for_days_form.days_to_keep.$error.required ||
prompt_for_days_form.days_to_keep.$error.min || prompt_for_days_form.days_to_keep.$error.min ||
@ -181,7 +181,7 @@
</label> </label>
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
<input type="integer" id="keep_amount" name="keep_amount" ng-model="keep_amount" ng-required="true" class="form-control" min=0 aw-min=0 max=9999 aw-max=9999 aw-no-dash style="margin-top:10px;" integer></input> <input type="integer" id="keep_amount" name="keep_amount" ng-model="keep_amount" ng-required="true" class="form-control" min=0 max=9999 style="margin-top:10px;" integer></input>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<select id="keep_unit" name="keep_unit" ng-model="keep_unit" ng-options="type.label for type in keep_unit_choices track by type.value" ng-required="true" class="form-control" style="margin-top:10px;"></select> <select id="keep_unit" name="keep_unit" ng-model="keep_unit" ng-options="type.label for type in keep_unit_choices track by type.value" ng-required="true" class="form-control" style="margin-top:10px;"></select>
@ -201,7 +201,7 @@
</label> </label>
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
<input type="integer" id="granularity_keep_amount" name="granularity_keep_amount" ng-model="granularity_keep_amount" ng-required="true" class="form-control" min=0 aw-min=0 max=9999 aw-max=9999 aw-no-dash style="margin-top:10px;" integer></input> <input type="integer" id="granularity_keep_amount" name="granularity_keep_amount" ng-model="granularity_keep_amount" ng-required="true" class="form-control" min=0 max=9999 style="margin-top:10px;" integer></input>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<select id="granularity_keep_unit" name="granularity_keep_unit" ng-model="granularity_keep_unit" <select id="granularity_keep_unit" name="granularity_keep_unit" ng-model="granularity_keep_unit"