X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog-ui%2Fsrc%2Fapp%2Fng2%2Fservices%2Fcomponent-services%2Ftopology-template.service.ts;h=fce785e9e6312bedef64a23e026d97e0e81fee28;hb=0d9d05e705a6fbc9c4370fdd3a8ad543d04f8210;hp=0386a1577a7f204a13cdb8a3cd63c7dd14bf47d8;hpb=243e567a44b042d9792f3436dedff9eeda8f720f;p=sdc.git diff --git a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts index 0386a1577a..fce785e9e6 100644 --- a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts +++ b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts @@ -36,6 +36,7 @@ import { IFileDownload, InputBEModel, InstancePropertiesAPIMap, + InterfaceModel, OperationModel, PropertyModel, Requirement @@ -80,6 +81,12 @@ export class TopologyTemplateService { return this.http.put(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/toscaTemplate', file) } + putServiceToscaModel(componentId: string, componentType: string, file) { + let uploadData:FormData = new FormData(); + uploadData.append('upload', file); + return this.http.put(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/toscaModel', uploadData); + } + getFullComponent(componentType: string, uniqueId: string): Observable { return this.http.get(this.baseUrl + this.getServerTypeUrl(componentType) + uniqueId); } @@ -473,6 +480,10 @@ export class TopologyTemplateService { return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES]); } + getComponentInstancesAndInputsAndProperties(componentType: string, componentId: string): Observable { + return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES ,COMPONENT_FIELDS.COMPONENT_INSTANCES_INPUTS, COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES]); + } + findAllComponentInstanceAttributes(componentType: string, componentId: string): Observable { return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_ATTRIBUTES]); } @@ -666,4 +677,29 @@ export class TopologyTemplateService { .pipe(map(response => response && response.defaultCustomToscaFunction ? response.defaultCustomToscaFunction : [])); } + createComponentInstanceInterfaceOperation(componentMetaDataId: string, componentInstanceId: string, + operation: InterfaceOperationModel): Observable { + const operationList = { + interfaces: { + [operation.interfaceType]: { + type: operation.interfaceType, + operations: { + [operation.name]: new BEInterfaceOperationModel(operation) + } + } + } + }; + return this.http.post(this.baseUrl + 'services/' + componentMetaDataId + '/componentInstance/' + componentInstanceId + '/interfaceOperation', operationList) + .map((res: any) => { + const interf: InterfaceModel = _.find(res.interfaces, interf => interf.type === operation.interfaceType); + const newOperation: OperationModel = _.find(interf.operations, op => op.name === operation.name); + + return new InterfaceOperationModel({ + ...newOperation, + interfaceType: interf.type, + interfaceId: interf.uniqueId, + }); + }); + } + }