diff options
Diffstat (limited to 'catalog-ui/src/app/view-models')
3 files changed, 8 insertions, 18 deletions
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts index c20d9fc408..05045c1529 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts +++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts @@ -7,9 +7,9 @@ * 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. @@ -77,7 +77,6 @@ interface IPropertyFormViewModelScope extends ng.IScope { getValidationPattern(type:string):RegExp; validateIntRange(value:string):boolean; close():void; - onValueChange():void; onSchemaTypeChange():void; onTypeChange(resetSchema:boolean):void; showSchema():boolean; @@ -150,6 +149,7 @@ export class PropertyFormViewModel { private initResource = ():void => { this.$scope.editPropertyModel.property = new PropertyModel(this.property); this.$scope.editPropertyModel.property.type = this.property.type ? this.property.type : null; + this.$scope.editPropertyModel.property.value = this.property.value ? this.property.value : this.property.defaultValue; this.$scope.constraints = this.property.constraints && this.property.constraints[0] ? this.property.constraints[0]["validValues"] : null; this.initToscaGetFunction(); this.setMaxLength(); @@ -159,7 +159,7 @@ export class PropertyFormViewModel { this.$scope.editPropertyModel.hasGetFunctionValue = this.$scope.editPropertyModel.property.isToscaFunction(); this.$scope.editPropertyModel.isGetFunctionValid = true; } - + private isDataTypeForPropertyType = (property:PropertyModel):boolean=> { property.simpleType = ""; if (property.type && PROPERTY_DATA.TYPES.indexOf(property.type) > -1) { @@ -172,7 +172,7 @@ export class PropertyFormViewModel { } return true; }; - + private getTypeForDataTypeDerivedFromSimple = (dataTypeName:string):string => { if (!this.$scope.dataTypes[dataTypeName]) { return 'string'; @@ -438,15 +438,6 @@ export class PropertyFormViewModel { this.$uibModalInstance.close(); }; - // put default value when instance value is empty - this.$scope.onValueChange = ():void => { - if (!this.$scope.editPropertyModel.property.value) { - if (this.$scope.isPropertyValueOwner) { - this.$scope.editPropertyModel.property.value = this.$scope.editPropertyModel.property.defaultValue; - } - } - }; - // Add the done button at the footer. this.$scope.footerButtons = [ {'name': 'Save', 'css': 'blue', 'callback': this.$scope.save}, diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html index bfe7f49aaa..2840e86523 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html +++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view.html @@ -222,7 +222,7 @@ data-ng-pattern="getValidationPattern((editPropertyModel.property.simpleType||editPropertyModel.property.type))" data-ng-model-options="{ debounce: 200 }" data-ng-change="('json'==editPropertyModel.property.type && forms.editForm.value.$setValidity('pattern', validateJson(editPropertyModel.property.value))) - ||(!forms.editForm.value.$error.pattern && ('integer'==editPropertyModel.property.type && forms.editForm.value.$setValidity('pattern', validateIntRange(editPropertyModel.property.value)) || onValueChange()))" + ||(!forms.editForm.value.$error.pattern && ('integer'==editPropertyModel.property.type && forms.editForm.value.$setValidity('pattern', validateIntRange(editPropertyModel.property.value))))" autofocus/> <!-- Boolean --> <select class="i-sdc-form-select" @@ -230,7 +230,6 @@ ng-if="(editPropertyModel.property.simpleType||editPropertyModel.property.type) == 'boolean'" data-ng-disabled="editPropertyModel.property.readonly && !isPropertyValueOwner" name="value" - data-ng-change="onValueChange()" data-ng-model="editPropertyModel.property.value"> <option value="true">true</option> <option value="false">false</option> diff --git a/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view-model.ts index 6d108d7db4..1d57355aed 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/properties/properties-view-model.ts @@ -7,9 +7,9 @@ * 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. |