From: andre.schmid Date: Tue, 15 Mar 2022 16:06:34 +0000 (+0000) Subject: Fix unchecked artifact implementation being persisted X-Git-Tag: 1.10.3~4 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=c32663621faf571ce855a1dc84ec4fd013718359;p=sdc.git Fix unchecked artifact implementation being persisted Fixes the problem of an interface operation artifact implementation being persisted even if it is not selected. After checking that the interface operation has an artifact implementation and filling up the artifact information, the values were being persisted if the option is unchecked afterwards. There was no way to remove the artifact implementation information once it was persisted for the first time. Change-Id: I4fdf4027919fdc04d688805bcf0b37fa6869b2e8 Issue-ID: SDC-3918 Signed-off-by: andre.schmid --- diff --git a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts index b14d0dda65..17f697ecda 100644 --- a/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts @@ -238,15 +238,23 @@ export class InterfaceOperationsComponent { private updateInterfaceOperation() { this.isLoading = true; - const operationUpdated: InterfaceOperationModel = this.modalInstance.instance.dynamicContent.instance.operationToUpdate; + const interfaceOperationHandlerComponentInstance: InterfaceOperationHandlerComponent = this.modalInstance.instance.dynamicContent.instance; + const operationUpdated: InterfaceOperationModel = interfaceOperationHandlerComponentInstance.operationToUpdate; + const isArtifactChecked = interfaceOperationHandlerComponentInstance.enableAddArtifactImplementation; + if (!isArtifactChecked) { + let artifactName = interfaceOperationHandlerComponentInstance.artifactName; + artifactName = artifactName === undefined ? '' : artifactName; + operationUpdated.implementation = new ArtifactModel({'artifactName': artifactName} as ArtifactModel); + } this.topologyTemplateService.updateComponentInstanceInterfaceOperation( this.componentMetaData.uniqueId, this.componentMetaData.componentType, this.componentInstanceSelected.uniqueId, - operationUpdated).subscribe((updatedComponentInstance: ComponentInstance) => { - this.componentInstanceSelected = new ComponentInstance(updatedComponentInstance); - this.initComponentInstanceInterfaceOperations(); - }); + operationUpdated) + .subscribe((updatedComponentInstance: ComponentInstance) => { + this.componentInstanceSelected = new ComponentInstance(updatedComponentInstance); + this.initComponentInstanceInterfaceOperations(); + }); this.modalServiceNg2.closeCurrentModal(); this.isLoading = false; }