d22741f81af664bdcf4b09007ae267f82215d458
[sdc.git] /
1 <!--
2   ~ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
3   ~
4   ~ Licensed under the Apache License, Version 2.0 (the "License");
5   ~ you may not use this file except in compliance with the License.
6   ~ You may obtain a copy of the License at
7   ~
8   ~      http://www.apache.org/licenses/LICENSE-2.0
9   ~
10   ~ Unless required by applicable law or agreed to in writing, software
11   ~ distributed under the License is distributed on an "AS IS" BASIS,
12   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   ~ See the License for the specific language governing permissions and
14   ~ limitations under the License.
15 -->
16 <div data-ng-if="dataTypes" class="default-value-section i-sdc-form-item">
17     <label class="i-sdc-form-label">Default Value</label>
18     <div data-ng-if="isTypeDataType">
19              <select-fields-structure value-obj-ref="myValue"
20                           type-name="property.type"
21                           parent-form-obj="forms.editForm"
22                           fields-prefix-name="currentPropertyIndex"
23                           read-only="true"
24                           default-value="{{getDefaultValue()}}"
25                           path="{{property.name}}"
26                                       is-parent-already-input="false"
27                           expand-by-default="true"></select-fields-structure>
28
29     </div>
30     <div data-ng-if="!isTypeDataType" ng-switch="property.type">
31         <div ng-switch-when="map">
32
33             <select-type-map value-obj-ref="myValue"
34                  schema-property="property.schema.property"
35                  parent-form-obj="forms.editForm"
36                  fields-prefix-name="currentPropertyIndex"
37                  read-only="true"
38                  default-value="{{getDefaultValue()}}"
39                  max-length="maxLength"></select-type-map>
40         </div>
41         <div ng-switch-when="list">
42             <select-type-list value-obj-ref="myValue"
43                   schema-property="property.schema.property"
44                   parent-form-obj="forms.editForm"
45                   fields-prefix-name="currentPropertyIndex"
46                   read-only="true"
47                   default-value="{{getDefaultValue()}}"
48                   max-length="maxLength"></select-type-list>
49         </div>
50         <div ng-switch-default>
51             <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.value.$dirty && forms.editForm.value.$invalid)}">
52                 <input class="i-sdc-form-input"
53                        data-tests-id="defaultvalue"
54                        ng-if="!((property.simpleType||property.type) == 'boolean')"
55                        data-ng-maxlength="maxLength"
56                        data-ng-disabled="isReadOnly"
57                        maxlength="{{maxLength}}"
58                        data-ng-model="property.value"
59                        type="text"
60                        name="value"
61                        data-ng-pattern="getValidationPattern((property.simpleType||property.type))"
62                        data-ng-model-options="{ debounce: 200 }"
63                        data-ng-change="('json'==property.type && forms.editForm.value.$setValidity('pattern', validateJson(property.value)))
64                                         ||(!forms.editForm.value.$error.pattern && ('integer'==property.type && forms.editForm.value.$setValidity('pattern', validateIntRange(property.value)) || onValueChange()))"
65                        data-ng-change=""
66                        autofocus />
67                 <select class="i-sdc-form-select"
68                         data-tests-id="booleantype"
69                         ng-if="(property.simpleType||property.type) == 'boolean'"
70                         data-ng-disabled="isReadOnly"
71                         name="value"
72                         data-ng-change="onValueChange()"
73                         data-ng-model="property.value">
74                     <option value="true">true</option>
75                     <option value="false">false</option>
76                 </select>
77
78                 <div class="input-error" data-ng-show="forms.editForm.value.$dirty && forms.editForm.value.$invalid">
79                     <span ng-show="forms.editForm.value.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Property' }"></span>
80                     <span ng-show="forms.editForm.value.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{maxLength}}' }"></span>
81                     <span ng-show="forms.editForm.value.$error.pattern" translate="PROPERTY_EDIT_PATTERN"></span>
82                 </div>
83             </div>
84         </div>
85     </div>
86 </div>