From a1ba3abf29613ee9e576a7c96a76ceb921086044 Mon Sep 17 00:00:00 2001 From: imamSidero Date: Wed, 12 Apr 2023 16:02:46 +0100 Subject: Support for addition of INDEX token to tosca functions Providing the capability to add the index token to th tosca function of all types Issue-ID: SDC-4472 Signed-off-by: Imam hussain Change-Id: Ib7ac80f31710101f50de76bdb7c79abdc637cfe3 --- catalog-ui/src/app/models/tosca-get-function.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'catalog-ui/src/app/models/tosca-get-function.ts') diff --git a/catalog-ui/src/app/models/tosca-get-function.ts b/catalog-ui/src/app/models/tosca-get-function.ts index 7e6c5ad739..3bb207700b 100644 --- a/catalog-ui/src/app/models/tosca-get-function.ts +++ b/catalog-ui/src/app/models/tosca-get-function.ts @@ -34,7 +34,8 @@ export class ToscaGetFunction implements ToscaFunction, ToscaFunctionParameter { sourceName: string; functionType: ToscaGetFunctionType; propertyPathFromSource: Array; - value: any + value: any; + toscaIndex: string; constructor(toscaGetFunction?: ToscaGetFunction) { if (!toscaGetFunction) { @@ -48,6 +49,7 @@ export class ToscaGetFunction implements ToscaFunction, ToscaFunctionParameter { this.sourceUniqueId = toscaGetFunction.sourceUniqueId; this.sourceName = toscaGetFunction.sourceName; this.functionType = toscaGetFunction.functionType; + this.toscaIndex = toscaGetFunction.toscaIndex; if (toscaGetFunction.propertyPathFromSource) { this.propertyPathFromSource = [...toscaGetFunction.propertyPathFromSource]; } @@ -69,20 +71,20 @@ export class ToscaGetFunction implements ToscaFunction, ToscaFunctionParameter { private buildGetInputFunctionValue(): Object { if (this.propertyPathFromSource.length === 1) { - return {[this.functionType.toLowerCase()]: this.propertyPathFromSource[0]}; + return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource[0], this.toscaIndex]}; } - return {[this.functionType.toLowerCase()]: this.propertyPathFromSource}; + return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource, this.toscaIndex]}; } private buildFunctionValueWithPropertySource(): Object { if (this.propertySource == PropertySource.SELF) { return { - [this.functionType.toLowerCase()]: [PropertySource.SELF, ...this.propertyPathFromSource] + [this.functionType.toLowerCase()]: [PropertySource.SELF, ...this.propertyPathFromSource, this.toscaIndex] }; } if (this.propertySource == PropertySource.INSTANCE) { return { - [this.functionType.toLowerCase()]: [this.sourceName, ...this.propertyPathFromSource] + [this.functionType.toLowerCase()]: [this.sourceName, ...this.propertyPathFromSource,this.toscaIndex] }; } } -- cgit 1.2.3-korg