2 ~ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
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
8 ~ http://www.apache.org/licenses/LICENSE-2.0
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.
16 <ng1-modal modal="modalInstanceProperty" type="classic" class="sdc-edit-property-container" buttons="footerButtons" header="{{isNew ? 'Add' : 'Update' }} Property" show-close-button="true" data-tests-id="sdc-edit-property-container">
17 <loader data-display="isLoading" relative="false" size="medium"></loader>
18 <div class="sdc-modal-top-bar" data-ng-if="!isNew">
19 <div class="sdc-modal-top-bar-buttons">
20 <span ng-click="delete(editPropertyModel.property)" data-ng-class="{'disabled' : isPropertyValueOwner || editPropertyModel.property.readonly || propertyOwnerType == 'group' || propertyOwnerType == 'policy'}" class="sprite-new delete-btn" data-tests-id="delete_property" sdc-smart-tooltip="">Delete</span>
21 <span class="delimiter"></span>
22 <span data-ng-click="getPrev()" data-ng-class="{'disabled' : !currentPropertyIndex }" class="sprite-new left-arrow" data-tests-id="get-prev" sdc-smart-tooltip="">Previous</span>
23 <span data-ng-click="getNext()" data-ng-class="{'disabled' : isLastProperty }" class="sprite-new right-arrow" data-tests-id="get-next" sdc-smart-tooltip="">Next</span>
27 <div class="sdc-edit-property-form-container" >
28 <perfect-scrollbar scroll-y-margin-offset="0" include-padding="true" class="scrollbar-container">
29 <form novalidate class="w-sdc-form two-columns" name="forms.editForm" >
31 <div class="w-sdc-form-columns-wrapper">
33 <div class="w-sdc-form-column">
36 <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.propertyName.$dirty && forms.editForm.propertyName.$invalid)}">
37 <label class="i-sdc-form-label" ng-class="{'required': !componentMetadata.isService}">Name</label>
38 <input class="i-sdc-form-input"
39 data-tests-id="propertyName"
40 data-ng-maxlength="nameMaxLength"
41 data-ng-disabled="!isNew || editPropertyModel.property.readonly"
42 maxlength="{{nameMaxLength}}"
43 data-ng-model="editPropertyModel.property.name"
46 data-ng-pattern="propertyNameValidationPattern"
48 data-ng-model-options="{ debounce: 200 }"
51 <div class="input-error" data-ng-show="forms.editForm.propertyName.$dirty && forms.editForm.propertyName.$invalid">
52 <span ng-show="forms.editForm.propertyName.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Property name' }"></span>
53 <span ng-show="forms.editForm.propertyName.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{nameMaxLength}}' }"></span>
54 <span ng-show="forms.editForm.propertyName.$error.pattern" translate="VALIDATION_ERROR_SPECIAL_CHARS_NOT_ALLOWED"></span>
59 <div class="w-sdc-form-column">
60 <div class="w-sdc-form-columns-wrapper">
61 <div class="w-sdc-form-column">
63 <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.type.$dirty && forms.editForm.type.$invalid)}">
64 <label class="i-sdc-form-label" ng-class="{'required': !componentMetadata.isService}">Type</label>
65 <select class="i-sdc-form-select"
66 data-tests-id="propertyType"
68 data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly"
70 data-ng-change="onTypeChange()"
71 data-ng-model="editPropertyModel.property.type">
72 <option value="">Choose Type</option>
73 <option data-ng-repeat="type in editPropertyModel.types"
74 value="{{type}}">{{type}}</option>
75 <option data-ng-repeat="type in nonPrimitiveTypes"
76 value="{{type}}">{{type.replace("org.openecomp.datatypes.heat.","")}}</option>
79 <div class="input-error" data-ng-show="forms.editForm.type.$dirty && forms.editForm.type.$invalid">
80 <span ng-show="forms.editForm.type.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Type' }"></span>
84 <div class="w-sdc-form-column" data-ng-if="showSchema()">
86 <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.schemaType.$dirty && forms.editForm.schemaType.$invalid)}">
87 <label class="i-sdc-form-label required">{{'PROPERTY_ENTRY_SCHEMA' | translate}}</label>
88 <select class="i-sdc-form-select"
90 data-tests-id="schema-type"
91 data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly"
93 data-ng-change="onSchemaTypeChange()"
94 data-ng-model="editPropertyModel.property.schema.property.type">
95 <option value="">{{'PROPERTY_ENTRY_SCHEMA_CHOOSE_OPTION' | translate}}</option>
96 <option data-ng-repeat="type in editPropertyModel.types"
97 value="{{type}}">{{type}}</option>
98 <option data-ng-repeat="type in nonPrimitiveTypes"
99 value="{{type}}">{{type.replace("org.openecomp.datatypes.heat.","")}}</option>
102 <div class="input-error" data-ng-show="forms.editForm.schemaType.$dirty && forms.editForm.schemaType.$invalid">
103 <span ng-show="forms.editForm.schemaType.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Entry schema' }"></span>
109 <!-- Constraints by type -->
110 <div class="i-sdc-form-item" data-ng-if="false">
111 <label class="i-sdc-form-label required">Constraints by type</label>
113 Should be constraints by type(TBD)
121 <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.description.$dirty && forms.editForm.description.$invalid)}">
122 <label class="i-sdc-form-label">Description</label>
123 <textarea class="i-sdc-form-textarea"
124 data-ng-maxlength="400"
125 data-ng-disabled="isPropertyValueOwner || editPropertyModel.property.readonly"
127 data-ng-pattern="commentValidationPattern"
129 data-ng-model="editPropertyModel.property.description"
130 data-ng-model-options="{ debounce: 200 }"
131 data-tests-id="description"
134 <div class="input-error" data-ng-show="forms.editForm.description.$dirty && forms.editForm.description.$invalid">
135 <span ng-show="forms.editForm.description.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '256' }"></span>
136 <span ng-show="forms.editForm.description.$error.pattern" translate="VALIDATION_ERROR_SPECIAL_CHARS_NOT_ALLOWED"></span>
137 <span ng-show="forms.editForm.description.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Description' }"></span>
140 <!-- Default value -->
142 <div class="default-value-section i-sdc-form-item">
143 <label class="i-sdc-form-label">Default Value</label>
144 <ng-container ng-if="!componentMetadata.isVfc">
145 <input type="hidden" ng-model="editPropertyModel.isGetFunctionValid" required="required"/>
146 <input type="radio" name="hasGetFunctionValue"
147 ng-model="editPropertyModel.hasGetFunctionValue"
149 ng-change="onValueTypeChange()"/> {{(editPropertyModel.property.type == 'map' || editPropertyModel.property.type == 'list') ? 'Entries' : 'Value'}}
150 <input type="radio" name="hasGetFunctionValue"
151 ng-model="editPropertyModel.hasGetFunctionValue"
153 ng-change="onValueTypeChange()"/> {{'TOSCA_FUNCTION_LABEL' | translate}}
154 <div data-ng-if="editPropertyModel.hasGetFunctionValue">
155 <tosca-function [property]="editPropertyModel.property"
156 [component-instance-map]="componentInstanceMap"
157 [allow-clear]="false"
158 (on-valid-function)="onGetFunctionValidFunction($event)"
159 (on-validity-change)="onToscaFunctionValidityChange($event)"
164 <div data-ng-if="!editPropertyModel.hasGetFunctionValue">
165 <div data-ng-if="isTypeDataType">
166 <fields-structure value-obj-ref="myValue"
167 type-name="editPropertyModel.property.type"
168 parent-form-obj="forms.editForm"
169 fields-prefix-name="currentPropertyIndex"
170 read-only="editPropertyModel.property.readonly && !isPropertyValueOwner"
171 default-value="{{getDefaultValue()}}"
173 expand-by-default="true"></fields-structure>
176 <div data-ng-if="!isTypeDataType" ng-switch="editPropertyModel.property.type">
177 <div ng-switch-when="map">
178 <type-map value-obj-ref="myValue"
179 schema-property="editPropertyModel.property.schema.property"
180 parent-property="editPropertyModel.property"
181 component-instance-map="componentInstanceMap"
182 parent-form-obj="forms.editForm"
183 fields-prefix-name="currentPropertyIndex"
184 read-only="(editPropertyModel.property.readonly && !isPropertyValueOwner) || isVnfConfiguration"
185 default-value="{{getDefaultValue()}}"
186 max-length="maxLength"
188 constraints="editPropertyModel.property.constraints && editPropertyModel.property.constraints[0].validValues">
192 <div ng-switch-when="list">
193 <type-list value-obj-ref="myValue"
194 schema-property="editPropertyModel.property.schema.property"
195 parent-property="editPropertyModel.property"
196 component-instance-map="componentInstanceMap"
197 parent-form-obj="forms.editForm"
198 fields-prefix-name="currentPropertyIndex"
199 read-only="editPropertyModel.property.readonly && !isPropertyValueOwner"
200 default-value="{{getDefaultValue()}}"
201 max-length="maxLength"
203 constraints="editPropertyModel.property.constraints && editPropertyModel.property.constraints[0].validValues"></type-list>
206 <div ng-switch-default>
207 <div class="i-sdc-form-item"
208 data-ng-class="{error:(forms.editForm.value.$dirty && forms.editForm.value.$invalid), 'input-group' : editPropertyModel.property.addOn}">
209 <span ng-if="editPropertyModel.property.addOn"
210 class="input-group-addon">{{editPropertyModel.property.addOn}}</span>
212 <!-- Constraints any NOT Boolean -->
213 <input class="i-sdc-form-input"
214 data-tests-id="defaultvalue"
215 ng-if="!((editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean')"
216 data-ng-maxlength="maxLength"
217 data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner"
218 maxlength="{{maxLength}}"
219 data-ng-model="editPropertyModel.property.value"
222 data-ng-pattern="getValidationPattern((editPropertyModel.property.simpleType||editPropertyModel.property.type))"
223 data-ng-model-options="{ debounce: 200 }"
224 data-ng-change="('json'==editPropertyModel.property.type && forms.editForm.value.$setValidity('pattern', validateJson(editPropertyModel.property.value)))
225 ||(!forms.editForm.value.$error.pattern && ('integer'==editPropertyModel.property.type && forms.editForm.value.$setValidity('pattern', validateIntRange(editPropertyModel.property.value)) || onValueChange()))"
228 <select class="i-sdc-form-select"
229 data-tests-id="booleantype"
230 ng-if="(editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean'"
231 data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner"
233 data-ng-change="onValueChange()"
234 data-ng-model="editPropertyModel.property.value">
235 <option value="true">true</option>
236 <option value="false">false</option>
239 <div class="input-error" data-ng-show="forms.editForm.value.$dirty && forms.editForm.value.$invalid">
240 <span ng-show="forms.editForm.value.$error.required" translate="VALIDATION_ERROR_REQUIRED"
241 translate-values="{'field': 'Property' }"></span>
242 <span ng-show="forms.editForm.value.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH"
243 translate-values="{'max': '{{maxLength}}' }"></span>
244 <span ng-show="forms.editForm.value.$error.pattern" translate="PROPERTY_EDIT_PATTERN"></span>
251 <div class="constraints-section i-sdc-form-item" data-ng-if="editPropertyModel.property.constraints || !(isViewOnly || componentMetadata.isService)">
252 <label class="i-sdc-form-label">Constraints</label>
254 <app-constraints [property-constraints]="editPropertyModel.property.constraints"
255 [is-view-only]="isViewOnly || componentMetadata.isService"
256 [property-type]="editPropertyModel.property.type"
257 (on-constraint-change)="onConstraintChange($event)">
261 <span class="w-sdc-form-note" data-ng-show="forms.editForm.$invalid && false" translate="LABEL_ALL_FIELDS_ARE_MANDATORY"></span>