Fix edit operation artifact and data types 55/129255/1
authorMichaelMorris <michael.morris@est.tech>
Thu, 12 May 2022 14:42:40 +0000 (15:42 +0100)
committerMichaelMorris <michael.morris@est.tech>
Thu, 12 May 2022 14:42:53 +0000 (15:42 +0100)
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-4000
Change-Id: I62d1be04c4995ccf5385ec6c5fd6e5673ac5c85c

catalog-ui/src/app/ng2/pages/composition/interface-operatons/interface-operations.component.ts
catalog-ui/src/app/ng2/pages/composition/interface-operatons/operation-creator/interface-operation-handler.component.ts
catalog-ui/src/app/ng2/pages/interface-definition/interface-definition.page.component.ts

index b8de7b8..ba19e26 100644 (file)
@@ -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();
index 5cc7f69..fd745ff 100644 (file)
@@ -42,7 +42,6 @@ import {DataTypeModel} from "../../../../../models/data-types";
 })
 export class InterfaceOperationHandlerComponent {
 
-    @Input() private modelName: string;
     @Output('propertyChanged') emitter: EventEmitter<PropertyFEModel> = new EventEmitter<PropertyFEModel>();
     @ViewChild('interfaceOperationDropDown') interfaceOperationDropDown: DropDownComponent;
 
@@ -53,6 +52,7 @@ export class InterfaceOperationHandlerComponent {
         validityChangedCallback: Function;
         isViewOnly: boolean;
         isEdit: boolean;
+        modelName: string;
     };
 
     dataTypeMap$: Observable<Map<string, DataTypeModel>>;
@@ -74,6 +74,7 @@ export class InterfaceOperationHandlerComponent {
     interfaceOperationMap: Map<string, Array<string>> = new Map<string, Array<string>>();
     interfaceOperationOptions: Array<DropDownOption> = [];
     selectedInterfaceOperation: DropDownOption = undefined;
+    modelName: string;
 
     toscaArtifactTypeSelected: string;
     toscaArtifactTypeProperties: Array<PropertyBEModel> = [];
@@ -87,15 +88,7 @@ export class InterfaceOperationHandlerComponent {
     inputTypeOptions: any[];
 
     constructor(private dataTypeService: DataTypeService, private componentServiceNg2: ComponentServiceNg2) {
-        this.dataTypeMap$ = new Observable<Map<string, DataTypeModel>>(subscriber => {
-            this.dataTypeService.findAllDataTypesByModel(this.modelName)
-            .then((dataTypesMap: Map<string, DataTypeModel>) => {
-                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<Map<string, DataTypeModel>>(subscriber => {
+            this.dataTypeService.findAllDataTypesByModel(this.modelName)
+            .then((dataTypesMap: Map<string, DataTypeModel>) => {
+                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<string, Array<string>>();
index c9a6d07..35490b1 100644 (file)
@@ -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();