summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-05-30 14:57:47 +0100
committerJEFF VAN DAM <jeff.van.dam@est.tech>2023-06-01 14:10:01 +0000
commitbfd727385b9c55d079a5c213b425e88b88a67b7f (patch)
tree846a85428bbeff2297aafe8c6c4d33d771a16c2a /catalog-ui/src
parent57dfe38027308533391d437956e57ac5de0eddc3 (diff)
Fix formatting error for operation input of complex type
Issue-ID: SDC-4523 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I3dff94cee1d1dbcb26099d02505a679249a6b46e
Diffstat (limited to 'catalog-ui/src')
-rw-r--r--catalog-ui/src/app/models/interfaceOperation.ts2
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html3
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts25
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html1
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts2
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts3
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-get-function/tosca-get-function.component.ts2
7 files changed, 37 insertions, 1 deletions
diff --git a/catalog-ui/src/app/models/interfaceOperation.ts b/catalog-ui/src/app/models/interfaceOperation.ts
index 14715b77a7..20f73af3e7 100644
--- a/catalog-ui/src/app/models/interfaceOperation.ts
+++ b/catalog-ui/src/app/models/interfaceOperation.ts
@@ -33,6 +33,7 @@ export class InputOperationParameter {
value?: any;
toscaFunction?: ToscaFunction;
valid:boolean= true;
+ subPropertyToscaFunctions: any;
constructor(param?: any) {
if (param) {
@@ -44,6 +45,7 @@ export class InputOperationParameter {
this.value = param.value;
this.toscaFunction = param.toscaFunction;
this.valid = param.valid;
+ this.subPropertyToscaFunctions = param.subPropertyToscaFunctions;
}
}
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html
index 3824d75055..88a4d6b437 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.html
@@ -104,6 +104,7 @@
[dataTypeMap]="dataTypeMap"
[valueObjRef]="valueObjRef ? valueObjRef[property.name] : undefined"
[schema]="property.schema"
+ [toscaFunction]="getToscaFunction(property.name)"
[nestingLevel]="nestingLevel + 1"
[isViewOnly]="isViewOnly"
[showToscaFunctionOption]="showToscaFunctionOption"
@@ -130,6 +131,7 @@
[dataTypeMap]="dataTypeMap"
[valueObjRef]="valueObjRef[i]"
[schema]="buildSchemaGroupProperty()"
+ [toscaFunction]="getToscaFunction(i)"
[nestingLevel]="nestingLevel + 1"
[listIndex]="i"
[isListChild]="true"
@@ -162,6 +164,7 @@
[dataTypeMap]="dataTypeMap"
[valueObjRef]="valueObjRef[key]"
[schema]="buildSchemaGroupProperty()"
+ [toscaFunction]="getToscaFunction(key)"
[isMapChild]="true"
[nestingLevel]="nestingLevel + 1"
[isViewOnly]="isViewOnly"
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts
index 103fc5c4f1..61708ab948 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list-item/input-list-item.component.ts
@@ -25,6 +25,7 @@ import {SchemaProperty, SchemaPropertyGroupModel} from '../../../../../../../mod
import {PropertyBEModel} from '../../../../../../../models/properties-inputs/property-be-model';
import {PROPERTY_DATA, PROPERTY_TYPES} from '../../../../../../../utils/constants';
import {ToscaFunction} from '../../../../../../../models/tosca-function';
+import {ToscaFunctionType} from "../../../../../../../models/tosca-function-type.enum";
import {ToscaFunctionValidationEvent} from "../../../../../properties-assignment/tosca-function/tosca-function.component";
import {InstanceFeDetails} from "../../../../../../../models/instance-fe-details";
import {ToscaTypeHelper} from "app/utils/tosca-type-helper";
@@ -48,6 +49,7 @@ export class InputListItemComponent implements OnInit {
@Input() isMapChild: boolean = false;
@Input() showToscaFunctionOption: boolean = false;
@Input() listIndex: number;
+ @Input() subPropertyToscaFunctions: SubPropertyToscaFunctions[];
@Input() isViewOnly: boolean;
@Input() allowDeletion: boolean = false;
@Input() toscaFunction: ToscaFunction;
@@ -96,6 +98,24 @@ export class InputListItemComponent implements OnInit {
}
}
+ getToscaFunction(key: any): any {
+ if (this.subPropertyToscaFunctions) {
+ for (let subPropertyToscaFunction of this.subPropertyToscaFunctions) {
+ let found = subPropertyToscaFunction.subPropertyPath.find(value => value === key);
+ if (found) {
+ return subPropertyToscaFunction.toscaFunction;
+ }
+ }
+ }
+ if ((key && this.valueObjRef[key] && this.valueObjRef[key].type)) {
+ const type = this.valueObjRef[key].type;
+ if (type in ToscaFunctionType) {
+ return <ToscaFunction> this.valueObjRef[key];
+ }
+ }
+ return undefined;
+ }
+
isTypeSimple(typeName: string): boolean {
return ToscaTypeHelper.isTypeSimple(typeName) || this.isTypeDerivedFromSimple(typeName) && (this.isTypeWithoutProperties(typeName));
}
@@ -327,3 +347,8 @@ export class InputListItemComponent implements OnInit {
}
}
+
+export interface SubPropertyToscaFunctions {
+ subPropertyPath: string[];
+ toscaFunction: ToscaFunction;
+}
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html
index d4b70f9be5..64726f1268 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.html
@@ -32,6 +32,7 @@
[valueObjRef]="input.value"
[schema]="input.schema"
[toscaFunction]="input.toscaFunction"
+ [subPropertyToscaFunctions]="input.subPropertyToscaFunctions"
[showToscaFunctionOption]="showToscaFunctionOption"
[isViewOnly]="isViewOnly"
[allowDeletion]="allowDeletion"
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts
index 3230306e68..824592f58f 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/input-list/input-list.component.spec.ts
@@ -29,6 +29,7 @@ import {TranslateService} from '../../../../../shared/translator/translate.servi
import {ToscaFunction} from '../../../../../../models/tosca-function';
import {InstanceFeDetails} from "../../../../../../models/instance-fe-details";
import {CustomToscaFunction} from "../../../../../../models/default-custom-functions";
+import {SubPropertyToscaFunctions} from "./input-list-item/input-list-item.component";
@Component({selector: 'app-input-list-item', template: ''})
class InputListItemStubComponent {
@@ -36,6 +37,7 @@ class InputListItemStubComponent {
@Input() type: DataTypeModel;
@Input() dataTypeMap: any;
@Input() valueObjRef: any;
+ @Input() subPropertyToscaFunctions: SubPropertyToscaFunctions[];
@Input() schema: any;
@Input() allowDeletion: any;
@Input() isViewOnly: boolean;
diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
index 4ceaa78148..812490c12a 100644
--- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
@@ -303,6 +303,9 @@ export class InterfaceOperationHandlerComponent {
const inputOperationParameter = this.inputs.find(value => value.name == changedInput.name);
inputOperationParameter.toscaFunction = null;
inputOperationParameter.value = changedInput.value;
+ if (inputOperationParameter.subPropertyToscaFunctions) {
+ inputOperationParameter.subPropertyToscaFunctions = undefined;
+ }
if (changedInput.isToscaFunction()) {
inputOperationParameter.toscaFunction = changedInput.toscaFunction;
inputOperationParameter.value = changedInput.toscaFunction.buildValueString();
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 cbbc2d98c0..07058ea069 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
@@ -125,7 +125,7 @@ export class ToscaGetFunctionComponent implements OnInit, OnChanges {
this.loadPropertyDropdown(() => {
this.selectedProperty
.setValue(this.propertyDropdownList.find(property => property.propertyName === this.toscaGetFunction.propertyName));
- if (this.toscaGetFunction.toscaIndexList.length > 0) {
+ if (this.toscaGetFunction.toscaIndexList && this.toscaGetFunction.toscaIndexList.length > 0) {
let tempSelectedProperty : PropertyDropdownValue = this.selectedProperty.value;
this.toscaGetFunction.toscaIndexList.forEach((indexValue: string, index) => {
let tempIndexFlag = false;