From 6cffd9e3eecb10281d880ea7d217f0ecddf8fb5a Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 31 Mar 2022 13:35:04 +0100 Subject: Update Interface definition on VFC Signed-off-by: aribeiro Change-Id: I13678c92ae6088016a78554ffaf0da47b82f7e65 Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3893 Signed-off-by: andre.schmid --- .../interface-operation-handler.component.ts | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts') 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 f357ddfc54..059708592e 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 @@ -49,6 +49,7 @@ export class InterfaceOperationHandlerComponent { selectedInterfaceOperation: InterfaceOperationModel; validityChangedCallback: Function; isViewOnly: boolean; + interfaceTypesMap: Map; }; dataTypeMap$: Observable>; @@ -63,6 +64,10 @@ export class InterfaceOperationHandlerComponent { isLoading: boolean = false; readonly: boolean; isViewOnly: boolean; + interfaceTypes: Array = []; + interfaceOperations: Array = []; + + interfaceTypesMap: Map; toscaArtifactTypeSelected: string; toscaArtifactTypeProperties: Array = []; @@ -71,6 +76,7 @@ export class InterfaceOperationHandlerComponent { toscaArtifactTypes: Array = []; enableAddArtifactImplementation: boolean; + propertyValueValid: boolean = true; inputTypeOptions: any[]; @@ -89,7 +95,7 @@ export class InterfaceOperationHandlerComponent { ngOnInit() { this.isViewOnly = this.input.isViewOnly; - this.interfaceType = this.input.selectedInterface.displayType(); + this.interfaceType = this.input.selectedInterface.type; this.operationToUpdate = this.input.selectedInterfaceOperation; this.operationToUpdate.interfaceId = this.input.selectedInterface.uniqueId; this.operationToUpdate.interfaceType = this.input.selectedInterface.type; @@ -105,7 +111,13 @@ export class InterfaceOperationHandlerComponent { listToscaDataDefinition: Array = []; } } + this.inputs = Array.from(this.operationToUpdate.inputs.listToscaDataDefinition); + this.interfaceTypesMap = this.input.interfaceTypesMap; + this.loadInterfaceTypesAndOperations(); + this.removeImplementationQuote(); + this.validityChanged(); + this.loadInterfaceOperationImplementation(); } private loadInterfaceOperationImplementation() { @@ -117,13 +129,13 @@ export class InterfaceOperationHandlerComponent { this.getArtifactTypesSelected(); } - onDescriptionChange= (value: any): void => { + onDescriptionChange = (value: any): void => { this.operationToUpdate.description = value; } onImplementationNameChange(value: any) { this.readonly = true - if (value) { + if (value || value === '') { let artifact = new ArtifactModel(); artifact.artifactName = value; this.operationToUpdate.implementation = artifact; @@ -141,6 +153,7 @@ export class InterfaceOperationHandlerComponent { this.toscaArtifactTypeSelected = undefined; this.artifactVersion = undefined; if (this.operationToUpdate.implementation.artifactType) { + this.operationToUpdate.implementation.artifactName = ''; this.artifactName = undefined; } this.toscaArtifactTypeProperties = undefined; @@ -281,7 +294,6 @@ export class InterfaceOperationHandlerComponent { if (changedProperty.value instanceof Object) { changedProperty.value = JSON.stringify(changedProperty.value); } - this.toscaArtifactTypeProperties.find(artifactProperty => artifactProperty.name == changedProperty.name); const property = this.toscaArtifactTypeProperties.find(artifactProperty => artifactProperty.name == changedProperty.name); property.value = changedProperty.value; } @@ -335,4 +347,12 @@ export class InterfaceOperationHandlerComponent { }); return inputList; } + + private loadInterfaceTypesAndOperations() { + console.log("loadInterfaceTypesAndOperations ", this.interfaceTypesMap.keys()); + + Array.from(this.interfaceTypesMap.keys()).forEach(value => this.interfaceTypes.push(new DropdownValue(value, value))); + console.log("loadInterfaceTypesAndOperations interfaceType ", this.interfaceTypes); + } + } -- cgit 1.2.3-korg