From af3fdfce91aeea1804c76a8571c102b78dde3794 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Thu, 13 Apr 2023 08:28:45 +0100 Subject: UI support for default custom function names Issue-ID: SDC-4473 Signed-off-by: JvD_Ericsson Change-Id: Ie4d002989857029300f0cc88123a5616a453aef0 --- .../component-property-form/property-form-view-model.ts | 13 +++++++++++++ .../component-property-form/property-form-view.html | 1 + 2 files changed, 14 insertions(+) (limited to 'catalog-ui/src/app/view-models/forms') 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 4b41e7ab25..39f008a688 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 @@ -34,6 +34,8 @@ import {TopologyTemplateService} from "app/ng2/services/component-services/topol import {InstanceFeDetails} from "../../../../models/instance-fe-details"; import {ToscaGetFunction} from "../../../../models/tosca-get-function"; import {ToscaFunctionValidationEvent} from "../../../../ng2/pages/properties-assignment/tosca-function/tosca-function.component"; +import {CustomToscaFunction} from "../../../../models/default-custom-functions"; +import {ToscaFunctionType} from "../../../../models/tosca-function-type.enum"; export interface IEditPropertyModel { property:PropertyModel; @@ -56,6 +58,7 @@ interface IPropertyFormViewModelScope extends ng.IScope { commentValidationPattern:RegExp; editPropertyModel: IEditPropertyModel; componentInstanceMap: Map; + customToscaFunctions: Array; modalInstanceProperty:ng.ui.bootstrap.IModalServiceInstance; currentPropertyIndex:number; isLastProperty:boolean; @@ -228,6 +231,15 @@ export class PropertyFormViewModel { } } + private initCustomToscaFunctions() { + this.$scope.customToscaFunctions = []; + this.topologyTemplateService.getDefaultCustomFunction().toPromise().then((data) => { + for (let customFunction of data) { + this.$scope.customToscaFunctions.push(new CustomToscaFunction(customFunction)); + } + }); + } + private initEmptyComplexValue(type: string): any { switch (type) { case PROPERTY_TYPES.MAP: @@ -308,6 +320,7 @@ export class PropertyFormViewModel { this.initResource(); this.initForNotSimpleType(); this.initComponentInstanceMap(); + this.initCustomToscaFunctions(); this.$scope.validateJson = (json:string):boolean => { if (!json) { 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 b717d7a147..d0c3cc6f95 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 @@ -154,6 +154,7 @@