aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/property-types/data-type-fields-structure/data-type-fields-structure.html
blob: 78aa7bc7f46fba748bcc44be08f925f77d8d358c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!--
  ~ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->


<div class="data-type-fields-structure">
    <div class="open-close">
        <div class="open-close-button" data-ng-class="{'expand':expand,'collapse':!expand}" data-ng-click="expandAndCollapse()"></div>
        <span class="data-type-name">{{typeName.replace("org.openecomp.datatypes.heat.","")}}</span>
    </div>
    <div data-ng-show="expand" data-ng-repeat="property in dataTypeProperties" class="property">
        <div class="i-sdc-form-item property-name">
            <div tooltips tooltip-content="{{property.name}}">
                <input class="i-sdc-form-input"
                       type="text"
                       readonly="readonly"
                       value="{{property.name}}"/>
            </div>
        </div>
        <!--<div class="property-value">-->
        <div data-ng-if="dataTypesService.isDataTypeForDataTypePropertyType(property)" class="inner-structure">
            <fields-structure value-obj-ref="(valueObjRef[property.name])"
                              type-name="property.type"
                              parent-property="parentProperty"
                              component-instance-map="componentInstanceMap"
                              parent-form-obj="parentFormObj"
                              fields-prefix-name="fieldsPrefixName+property.name"
                              read-only="readOnly"
                              is-service="isService"
                              default-value="{{currentTypeDefaultValue[property.name]}}">

            </fields-structure>
        </div>
        <div data-ng-if="!dataTypesService.isDataTypeForDataTypePropertyType(property)" ng-switch="property.type">
            <div ng-switch-when="map">
                <type-map value-obj-ref="valueObjRef[property.name]"
                          schema-property="property.schema.property"
                          parent-property="property"
                          component-instance-map="componentInstanceMap"
                          parent-form-obj="parentFormObj"
                          fields-prefix-name="fieldsPrefixName+property.name"
                          read-only="readOnly"
                          default-value="{{currentTypeDefaultValue[property.name]}}"
                          is-service="isService"
                          types="types"></type-map>
            </div>
            <div ng-switch-when="list">
                <type-list value-obj-ref="valueObjRef[property.name]"
                           schema-property="property.schema.property"
                           parent-property="parentProperty"
                           component-instance-map="componentInstanceMap"
                           parent-form-obj="parentFormObj"
                           fields-prefix-name="fieldsPrefixName+property.name"
                           read-only="readOnly"
                           default-value="{{currentTypeDefaultValue[property.name]}}"
                           is-service="isService"
                           types="types"></type-list>
            </div>
            <div ng-switch-default class="primitive-value-field">
                <div class="i-sdc-form-item" data-ng-class="{error:(parentFormObj[fieldsPrefixName+property.name].$dirty && parentFormObj[fieldsPrefixName+property.name].$invalid)}">
                    <!-- Has Constraints -->

                    <!--<select class="i-sdc-form-select"-->
                    <!--ng-if="(property.constraints)"-->
                    <!--data-ng-disabled="readOnly"-->
                    <!--name="{{fieldsPrefixName+property.name}}"-->
                    <!--data-ng-change="onValueChange(property.name,'constraintsChange')"-->
                    <!--data-ng-model="valueObjRef[property.name]"-->
                    <!--&gt;-->
                    <!--&lt;!&ndash; Get the default value in case exist &ndash;&gt;-->
                    <!--<option value = "{{valueObjRef[property.name]}}" name = "{{valueObjRef[property.name]}}" hidden selected>-->
                    <!--{{valueObjRef[property.name]}}-->
                    <!--</option> -->
                    <!--&lt;!&ndash; add all constratint to Select list &ndash;&gt;-->
                    <!--<option ng-repeat='value in property.constraints[0].validValues' value="{{value}}" >-->
                    <!--{{value}}-->
                    <!--</option> -->
                    <!--</select>-->
                    <!-- Input without constraints -->
                    <input class="i-sdc-form-input"
                           data-tests-id="{{fieldsPrefixName+property.name}}"
                           ng-if="!((property.simpleType||property.type) == 'boolean')"
                           data-ng-maxlength="100"
                           data-ng-readonly="readOnly"
                           maxlength="{{(property.simpleType||property.type) == 'integer'? 10 : 100}}"
                           data-ng-model="valueObjRef[property.name]"
                           type="text"
                           name="{{fieldsPrefixName+property.name}}"
                           data-ng-pattern="getValidationPattern((property.simpleType||property.type))"
                           data-ng-model-options="{ debounce: 200 }"
                           data-ng-change="inputOnValueChange(property)"
                           autofocus
                    />
                    <select class="i-sdc-form-select"
                            data-tests-id="{{fieldsPrefixName+property.name}}"
                            ng-if="(property.simpleType||property.type) == 'boolean'"
                            data-ng-disabled="readOnly"
                            name="{{fieldsPrefixName+property.name}}"
                            data-ng-change="onValueChange(property.name,'boolean')"
                            data-ng-model="valueObjRef[property.name]"
                            data-ng-options="option.v as option.n for option in [{ n: '', v: undefined }, { n: 'false', v: false }, { n: 'true', v: true }]">
                    </select>

                    <div class="input-error" data-ng-show="parentFormObj[fieldsPrefixName+property.name].$dirty && parentFormObj[fieldsPrefixName+property.name].$invalid">
                        <span ng-show="parentFormObj[fieldsPrefixName+property.name].$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '100' }"></span>
                        <span ng-show="parentFormObj[fieldsPrefixName+property.name].$error.pattern" translate="PROPERTY_EDIT_PATTERN"></span>
                        <span ng-show="parentFormObj[fieldsPrefixName+property.name].$error.customValidation" translate="PROPERTY_EDIT_MAP_UNIQUE_KEYS"></span>
                    </div>
                </div>
            </div>
        </div>
        <!--</div>-->

    </div>
</div>