Skip to content

Commit

Permalink
use parameter.pattern in input and show error messages (eclipse-archi…
Browse files Browse the repository at this point in the history
…ved#2812)

* use parameter.pattern in input and show error messages

Signed-off-by: Aoun Bukhari <[email protected]>
  • Loading branch information
aounhaider1 authored and kaikreuzer committed Jan 31, 2017
1 parent 75d2dc3 commit 1121eca
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
<div class="includeConfig" ng-show="!expertMode" ng-init="isAdvanced=false">
<div ng-repeat="part in ['normal','advance']">
<md-button ng-show="part==='advance' && parameters.hasAdvanced" ng-class="{'advButton':parameters.length==1}" ng-click="isAdvanced=!isAdvanced">{{isAdvanced?'Show less':'Show more'}}</md-button>
<fieldset ng-show="(part==='normal' && group.advParam!==group.parameters.length) || (part==='advance' && isAdvanced && group.advParam>0)" ng-class="{borderhidden: parameters.length==1}" ng-repeat="group in parameters track by $index">
<fieldset ng-if="(part==='normal' && group.advParam!==group.parameters.length) || (part==='advance' && isAdvanced && group.advParam>0)" ng-class="{borderhidden: parameters.length==1}" ng-repeat="group in parameters track by $index">
<legend ng-if="parameters.length>1">{{group.groupLabel}}</legend>
<div ng-repeat="parameter in group.parameters track by $index">
<div ng-switch="parameter.element">
<div ng-if="parameter.element!='textarea' && parameter.element!='dayofweek'" ng-show="(part==='normal' && !parameter.advanced) || (part==='advance' && parameter.advanced && isAdvanced)" class="parameter col-sm-6 col-xs-12">
<div ng-switch-when="input">
<div ng-if="(parameter.type=='INTEGER' || parameter.type=='DECIMAL')">
<label class="config-textInput" for="{{parameter.name}}">{{parameter.label}}</label>
<md-input-container ng-class="{'md-input-invalid':form.configForm[parameter.name].$invalid}" class="col-xs-12 configContainer"> <input ng-init="focus=false" name="{{parameter.name}}" type="number" min="{{parameter.min}}" max="{{parameter.max}}" step="{{parameter.stepsize}}" ng-model="configuration[parameter.name]" ng-required="parameter.required" type="{{parameter.inputType}}" ng-focus="focus=true" ng-blur="focus=false">
<md-input-container ng-class="{'md-input-invalid':form.configForm[parameter.name].$invalid}" class="col-xs-12 configContainer"> <input ng-init="focus=false" ng-pattern="parameter.pattern" name="{{parameter.name}}" type="number" min="{{parameter.min}}" max="{{parameter.max}}" step="{{parameter.stepsize}}" ng-model="configuration[parameter.name]" ng-required="parameter.required" type="{{parameter.inputType}}" ng-focus="focus=true" ng-blur="focus=false">
<div ng-messages="form.configForm[parameter.name].$error" ng-show="focus">
<div ng-message="min">Minimum allowed number is {{parameter.min}}</div>
<div ng-message="max">Maximum allowed number is {{parameter.max}}</div>
<div ng-message="pattern">Input should satisfy expression {{parameter.pattern}}</div>
<div ng-message="required">Field is required</div>
</div>
<span>
Expand All @@ -25,10 +26,11 @@
</div>
<div ng-if="parameter.type=='TEXT'">
<label class="config-textInput" for="{{parameter.name}}">{{parameter.label}}</label>
<md-input-container ng-class="{'md-input-invalid':form.configForm[parameter.name].$invalid}" class="col-xs-12 configContainer"> <input ng-init="focus=false" name="{{parameter.name}}" ng-minlength="parameter.min" ng-maxlength="parameter.max" ng-model="configuration[parameter.name]" ng-required="parameter.required" type="{{parameter.inputType}}" ng-focus="focus=true" ng-blur="focus=false">
<md-input-container ng-class="{'md-input-invalid':form.configForm[parameter.name].$invalid}" class="col-xs-12 configContainer"> <input ng-init="focus=false" ng-pattern="parameter.pattern" name="{{parameter.name}}" ng-minlength="parameter.min" ng-maxlength="parameter.max" ng-model="configuration[parameter.name]" ng-required="parameter.required" type="{{parameter.inputType}}" ng-focus="focus=true" ng-blur="focus=false">
<div ng-messages="form.configForm[parameter.name].$error" ng-show="focus">
<div ng-message="minlength">Minimum length is {{parameter.min}}</div>
<div ng-message="maxlength">Maximum length is {{parameter.max}}</div>
<div ng-message="pattern">Input should satisfy expression {{parameter.pattern}}</div>
<div ng-message="required">Field is required</div>
</div>
<span>
Expand Down

0 comments on commit 1121eca

Please sign in to comment.