aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-06-02 17:02:18 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-29 14:54:21 +0000
commitcf0a8b21e85ec41260da802a2b923fabe89c9aaa (patch)
treeb6c67c2670d56da685d213ed7d738a3b80d51e7c /catalog-ui/src/app/models
parent1c9375a06ee65147418b17af2a382e0c6cdb64f1 (diff)
Fix unable to set tosca function on complex type on input operation
Issue-ID: SDC-4527 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: Icc7166978c13f3692dc25d9f33a7613d64f87f6a
Diffstat (limited to 'catalog-ui/src/app/models')
-rw-r--r--catalog-ui/src/app/models/interfaceOperation.ts3
-rw-r--r--catalog-ui/src/app/models/tosca-get-function.ts18
2 files changed, 13 insertions, 8 deletions
diff --git a/catalog-ui/src/app/models/interfaceOperation.ts b/catalog-ui/src/app/models/interfaceOperation.ts
index 20f73af3e7..a6279a589f 100644
--- a/catalog-ui/src/app/models/interfaceOperation.ts
+++ b/catalog-ui/src/app/models/interfaceOperation.ts
@@ -23,6 +23,7 @@ import {ArtifactModel} from "./artifacts";
import {SchemaPropertyGroupModel} from "./schema-property";
import {PROPERTY_DATA, PROPERTY_TYPES} from "../utils/constants";
import {ToscaFunction} from "./tosca-function";
+import {SubPropertyToscaFunction} from "./sub-property-tosca-function";
export class InputOperationParameter {
name: string;
@@ -32,8 +33,8 @@ export class InputOperationParameter {
toscaDefaultValue?: string;
value?: any;
toscaFunction?: ToscaFunction;
+ subPropertyToscaFunctions: SubPropertyToscaFunction[];
valid:boolean= true;
- subPropertyToscaFunctions: any;
constructor(param?: any) {
if (param) {
diff --git a/catalog-ui/src/app/models/tosca-get-function.ts b/catalog-ui/src/app/models/tosca-get-function.ts
index 784c7ea407..2eb47472da 100644
--- a/catalog-ui/src/app/models/tosca-get-function.ts
+++ b/catalog-ui/src/app/models/tosca-get-function.ts
@@ -71,19 +71,19 @@ export class ToscaGetFunction implements ToscaFunction, ToscaFunctionParameter {
private buildGetInputFunctionValue(): Object {
if (this.propertyPathFromSource.length === 1) {
- if (this.toscaIndexList) {
- return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource[0], this.toscaIndexList]};
+ if (this.isToscaIndexEmpty()) {
+ return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource[0], ...this.toscaIndexList]};
}
return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource[0]]};
}
- return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource, this.toscaIndexList]};
+ return {[this.functionType.toLowerCase()]: [this.propertyPathFromSource, ...this.toscaIndexList]};
}
private buildFunctionValueWithPropertySource(): Object {
if (this.propertySource == PropertySource.SELF) {
- if (this.toscaIndexList) {
+ if (this.isToscaIndexEmpty()) {
return {
- [this.functionType.toLowerCase()]: [PropertySource.SELF, ...this.propertyPathFromSource, this.toscaIndexList]
+ [this.functionType.toLowerCase()]: [PropertySource.SELF, ...this.propertyPathFromSource, ...this.toscaIndexList]
};
}
return {
@@ -91,9 +91,9 @@ export class ToscaGetFunction implements ToscaFunction, ToscaFunctionParameter {
};
}
if (this.propertySource == PropertySource.INSTANCE) {
- if (this.toscaIndexList) {
+ if (this.isToscaIndexEmpty()) {
return {
- [this.functionType.toLowerCase()]: [this.sourceName, ...this.propertyPathFromSource, this.toscaIndexList]
+ [this.functionType.toLowerCase()]: [this.sourceName, ...this.propertyPathFromSource, ...this.toscaIndexList]
};
}
return {
@@ -101,4 +101,8 @@ export class ToscaGetFunction implements ToscaFunction, ToscaFunctionParameter {
};
}
}
+
+ private isToscaIndexEmpty(): boolean {
+ return this.toscaIndexList && this.toscaIndexList.length > 0;
+ }
} \ No newline at end of file