diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment')
4 files changed, 20 insertions, 8 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts index 8dd4ca96ec..6a27622638 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts @@ -181,6 +181,8 @@ export class PropertiesUtils { property.childPropUpdated(childProp); }); + } else if (property.derivedDataType === DerivedPropertyType.RANGE) { + property.valueObj = JSON.stringify(property.getValueObj()); } } property.updateValueObjOrig(); diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html index 898b189746..65a024cde4 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.html @@ -43,6 +43,7 @@ </div> <div *ngIf="isGetFunctionSelected()"> <app-tosca-get-function [property]="property" [toscaGetFunction]="toscaFunction" + [overridingType] = "overridingType" [componentInstanceMap]="componentInstanceMap" [functionType]="toscaFunctionTypeForm.value" [compositionMap]="compositionMap" diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts index 81696944c7..ecaff252d3 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts @@ -30,7 +30,7 @@ import {ToscaGetFunctionValidationEvent} from "./tosca-get-function/tosca-get-fu import {ToscaFunction} from "../../../../models/tosca-function"; import {ToscaConcatFunctionValidationEvent} from "./tosca-concat-function/tosca-concat-function.component"; import {ToscaCustomFunctionValidationEvent} from "./tosca-custom-function/tosca-custom-function.component"; -import {PROPERTY_TYPES, PROPERTY_DATA} from "../../../../utils/constants"; +import {PROPERTY_TYPES} from "../../../../utils/constants"; import {YamlFunctionValidationEvent} from "./yaml-function/yaml-function.component"; import {ToscaConcatFunction} from "../../../../models/tosca-concat-function"; import {ToscaCustomFunction} from "../../../../models/tosca-custom-function"; @@ -45,6 +45,8 @@ import {CustomToscaFunction} from "../../../../models/default-custom-functions"; export class ToscaFunctionComponent implements OnInit, OnChanges { @Input() property: PropertyBEModel; + @Input() overridingType: PROPERTY_TYPES; + @Input() inToscaFunction: ToscaFunction; @Input() componentInstanceMap: Map<string, InstanceFeDetails> = new Map<string, InstanceFeDetails>(); @Input() customToscaFunctions: Array<CustomToscaFunction> = []; @Input() allowClear: boolean = true; @@ -74,7 +76,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { ngOnInit(): void { this.componentMetadata = this.workspaceService.metadata; - this.toscaFunction = this.property.toscaFunction ? this.property.toscaFunction : undefined; + this.toscaFunction = this.inToscaFunction ? this.inToscaFunction : this.property.toscaFunction ? this.property.toscaFunction : undefined; this.loadToscaFunctions(); this.formGroup.valueChanges.subscribe(() => { if (!this.isInitialized) { @@ -93,7 +95,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { ngOnChanges(changes: SimpleChanges): void { if (changes.property) { this.resetForm(); - this.toscaFunction = this.property.toscaFunction ? this.property.toscaFunction : undefined; + this.toscaFunction = this.inToscaFunction ? this.inToscaFunction : this.property.toscaFunction ? this.property.toscaFunction : undefined; this.initToscaFunction(); this.loadToscaFunctions(); this.emitValidityChange(); @@ -130,11 +132,11 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { return; } } - if (!this.property.isToscaFunction()) { return; } - this.toscaFunctionForm.setValue(this.property.toscaFunction); + + this.toscaFunctionForm.setValue(this.inToscaFunction ? this.inToscaFunction : this.property.toscaFunction); let type = this.property.toscaFunction.type; if (type == ToscaFunctionType.CUSTOM) { let name = (this.property.toscaFunction as ToscaCustomFunction).name; @@ -145,7 +147,7 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { this.toscaFunctionTypeForm.setValue("other"); } } else { - this.toscaFunctionTypeForm.setValue(type); + this.toscaFunctionTypeForm.setValue(this.inToscaFunction ? this.inToscaFunction.type : type); } } @@ -159,6 +161,9 @@ export class ToscaFunctionComponent implements OnInit, OnChanges { this.toscaFunctions.push(ToscaFunctionType.GET_INPUT); this.toscaFunctions.push(ToscaFunctionType.GET_PROPERTY); if (this.property.type === PROPERTY_TYPES.STRING || this.property.type === PROPERTY_TYPES.ANY) { + this.toscaFunctions.push(ToscaFunctionType.CUSTOM); + } + if ((this.property.type === PROPERTY_TYPES.STRING || this.property.type === PROPERTY_TYPES.ANY) && this.overridingType === undefined) { this.toscaFunctions.push(ToscaFunctionType.CONCAT); } this.loadCustomToscaFunctions(); diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts index fe6f2f143c..284c559c55 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts @@ -42,6 +42,7 @@ import {ToscaGetFunctionTypeConverter} from "../../../../../models/tosca-get-fun export class ToscaGetFunctionComponent implements OnInit, OnChanges { @Input() property: PropertyBEModel; + @Input() overridingType: PROPERTY_TYPES; @Input() toscaGetFunction: ToscaGetFunction; @Input() componentInstanceMap: Map<string, InstanceFeDetails> = new Map<string, InstanceFeDetails>(); @Input() functionType: ToscaGetFunctionType; @@ -243,13 +244,13 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges { const properties: Array<PropertyBEModel | AttributeBEModel> = this.extractProperties(response); if (!properties || properties.length === 0) { const msgCode = this.getNotFoundMsgCode(); - this.dropDownErrorMsg = this.translateService.translate(msgCode, {type: this.propertyTypeToString()}); + this.dropDownErrorMsg = this.translateService.translate(msgCode, {type: this.overridingType != undefined ? this.overridingType : this.propertyTypeToString()}); return; } this.addPropertiesToDropdown(properties); if (this.propertyDropdownList.length == 0) { const msgCode = this.getNotFoundMsgCode(); - this.dropDownErrorMsg = this.translateService.translate(msgCode, {type: this.propertyTypeToString()}); + this.dropDownErrorMsg = this.translateService.translate(msgCode, {type: this.overridingType != undefined ? this.overridingType : this.propertyTypeToString()}); } }, (error) => { console.error('An error occurred while loading properties.', error); @@ -403,6 +404,9 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges { } private hasSameType(property: PropertyBEModel | AttributeBEModel): boolean { + if (this.overridingType != undefined) { + return property.type === this.overridingType; + } if (this.property.type === PROPERTY_TYPES.ANY) { return true; } |