33fef0351e4a9646641c8c1eda6877fbc6c2f164
[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
17 <div data-ng-if="dataTypes" class="default-value-section i-sdc-form-item">
18     <label class="i-sdc-form-label">Default Value</label>
19     <div data-ng-if="isTypeDataType">
20              <select-fields-structure value-obj-ref="myValue"
21                           type-name="property.type"
22                           parent-form-obj="forms.editForm"
23                           fields-prefix-name="currentPropertyIndex"
24                           read-only="true"
25                           default-value="{{getDefaultValue()}}"
26                           path="{{property.name}}"
27                                       is-parent-already-input="false"
28                           expand-by-default="true"></select-fields-structure>
29
30     </div>
31     <div data-ng-if="!isTypeDataType" ng-switch="property.type">
32         <div ng-switch-when="map">
33
34             <select-type-map value-obj-ref="myValue"
35                  schema-property="property.schema.property"
36                  parent-form-obj="forms.editForm"
37                  fields-prefix-name="currentPropertyIndex"
38                  read-only="true"
39                  default-value="{{getDefaultValue()}}"
40                  max-length="maxLength"></select-type-map>
41         </div>
42         <div ng-switch-when="list">
43             <select-type-list value-obj-ref="myValue"
44                   schema-property="property.schema.property"
45                   parent-form-obj="forms.editForm"
46                   fields-prefix-name="currentPropertyIndex"
47                   read-only="true"
48                   default-value="{{getDefaultValue()}}"
49                   max-length="maxLength"></select-type-list>
50         </div>
51         <div ng-switch-default>
52             <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.value.$dirty && forms.editForm.value.$invalid)}">
53                 <input class="i-sdc-form-input"
54                        data-tests-id="defaultvalue"
55                        ng-if="!((property.simpleType||property.type) == 'boolean')"
56                        data-ng-maxlength="maxLength"
57                        data-ng-disabled="isReadOnly"
58                        maxlength="{{maxLength}}"
59                        data-ng-model="property.value"
60                        type="text"
61                        name="value"
62                        data-ng-pattern="getValidationPattern((property.simpleType||property.type))"
63                        data-ng-model-options="{ debounce: 200 }"
64                        data-ng-change="('json'==property.type && forms.editForm.value.$setValidity('pattern', validateJson(property.value)))
65                                         ||(!forms.editForm.value.$error.pattern && ('integer'==property.type && forms.editForm.value.$setValidity('pattern', validateIntRange(property.value)) || onValueChange()))"
66                        data-ng-change=""
67                        autofocus />
68                 <select class="i-sdc-form-select"
69                         data-tests-id="booleantype"
70                         ng-if="(property.simpleType||property.type) == 'boolean'"
71                         data-ng-disabled="isReadOnly"
72                         name="value"
73                         data-ng-change="onValueChange()"
74                         data-ng-model="property.value">
75                     <option value="true">true</option>
76                     <option value="false">false</option>
77                 </select>
78
79                 <div class="input-error" data-ng-show="forms.editForm.value.$dirty && forms.editForm.value.$invalid">
80                     <span ng-show="forms.editForm.value.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Property' }"></span>
81                     <span ng-show="forms.editForm.value.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{maxLength}}' }"></span>
82                     <span ng-show="forms.editForm.value.$error.pattern" translate="PROPERTY_EDIT_PATTERN"></span>
83                 </div>
84             </div>
85         </div>
86     </div>
87 </div>