diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2023-04-13 08:28:45 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-05-04 15:43:18 +0000 |
commit | af3fdfce91aeea1804c76a8571c102b78dde3794 (patch) | |
tree | 208b175c5a4b4d9522bdd7577a34722daab25137 /catalog-ui/src/app/view-models | |
parent | c4de5390c2a396e9ea88061454e40a92cea57ce1 (diff) |
UI support for default custom function names
Issue-ID: SDC-4473
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: Ie4d002989857029300f0cc88123a5616a453aef0
Diffstat (limited to 'catalog-ui/src/app/view-models')
2 files changed, 14 insertions, 0 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 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<string, InstanceFeDetails>; + customToscaFunctions: Array<CustomToscaFunction>; 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 @@ <div data-ng-if="editPropertyModel.hasGetFunctionValue"> <tosca-function [property]="editPropertyModel.property" [component-instance-map]="componentInstanceMap" + [custom-tosca-functions]="customToscaFunctions" [allow-clear]="false" (on-valid-function)="onGetFunctionValidFunction($event)" (on-validity-change)="onToscaFunctionValidityChange($event)" |