From 87fb2140798d1aef9a3ba223b60f20a4ebb6e92d Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 12 May 2022 15:42:40 +0100 Subject: Fix edit operation artifact and data types Signed-off-by: MichaelMorris Issue-ID: SDC-4000 Change-Id: I62d1be04c4995ccf5385ec6c5fd6e5673ac5c85c --- .../interface-operations.component.ts | 3 ++- .../interface-operation-handler.component.ts | 26 +++++++++++++--------- .../interface-definition.page.component.ts | 2 ++ 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'catalog-ui/src/app') 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 b8de7b8559..ba19e266b7 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 @@ -243,7 +243,8 @@ export class InterfaceOperationsComponent { selectedInterface: interfaceModel ? interfaceModel : new UIInterfaceModel(), selectedInterfaceOperation: operation ? operation : new InterfaceOperationModel(), validityChangedCallback: this.enableOrDisableSaveButton, - isViewOnly: this.isViewOnly + isViewOnly: this.isViewOnly, + modelName: this.componentMetaData.model } ); this.modalInstance.instance.open(); 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 5cc7f691aa..fd745ff311 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 @@ -42,7 +42,6 @@ import {DataTypeModel} from "../../../../../models/data-types"; }) export class InterfaceOperationHandlerComponent { - @Input() private modelName: string; @Output('propertyChanged') emitter: EventEmitter = new EventEmitter(); @ViewChild('interfaceOperationDropDown') interfaceOperationDropDown: DropDownComponent; @@ -53,6 +52,7 @@ export class InterfaceOperationHandlerComponent { validityChangedCallback: Function; isViewOnly: boolean; isEdit: boolean; + modelName: string; }; dataTypeMap$: Observable>; @@ -74,6 +74,7 @@ export class InterfaceOperationHandlerComponent { interfaceOperationMap: Map> = new Map>(); interfaceOperationOptions: Array = []; selectedInterfaceOperation: DropDownOption = undefined; + modelName: string; toscaArtifactTypeSelected: string; toscaArtifactTypeProperties: Array = []; @@ -87,15 +88,7 @@ export class InterfaceOperationHandlerComponent { inputTypeOptions: any[]; constructor(private dataTypeService: DataTypeService, private componentServiceNg2: ComponentServiceNg2) { - this.dataTypeMap$ = new Observable>(subscriber => { - this.dataTypeService.findAllDataTypesByModel(this.modelName) - .then((dataTypesMap: Map) => { - subscriber.next(dataTypesMap); - }); - }); - this.dataTypeMap$.subscribe(value => { - this.dataTypeMap = value; - }); + } @@ -106,10 +99,21 @@ export class InterfaceOperationHandlerComponent { this.operationToUpdate = this.input.selectedInterfaceOperation; this.operationToUpdate.interfaceId = this.input.selectedInterface.uniqueId; this.operationToUpdate.interfaceType = this.input.selectedInterface.type; + this.modelName = this.input.modelName; this.initInputs(); this.removeImplementationQuote(); this.validityChanged(); this.loadInterfaceOperationImplementation(); + + this.dataTypeMap$ = new Observable>(subscriber => { + this.dataTypeService.findAllDataTypesByModel(this.modelName) + .then((dataTypesMap: Map) => { + subscriber.next(dataTypesMap); + }); + }); + this.dataTypeMap$.subscribe(value => { + this.dataTypeMap = value; + }); } private initInputs() { @@ -127,7 +131,7 @@ export class InterfaceOperationHandlerComponent { } private loadInterfaceType() { - this.componentServiceNg2.getInterfaceTypesByModel(undefined) + this.componentServiceNg2.getInterfaceTypesByModel(this.modelName) .subscribe(response => { if (response) { this.interfaceOperationMap = new Map>(); diff --git a/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts b/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts index c9a6d07057..35490b183c 100644 --- a/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts @@ -212,6 +212,7 @@ export class InterfaceDefinitionComponent { callback([]); } }); + this.loadToscaArtifacts(); } initInterfaces(interfaces: InterfaceModel[]): void { @@ -255,6 +256,7 @@ export class InterfaceDefinitionComponent { isViewOnly: this.isViewOnly, isEdit: isEdit, interfaceTypesMap: this.interfaceTypesMap, + modelName: this.component.model } ); this.modalInstance.instance.open(); -- cgit 1.2.3-korg