- getInterfaceTypes(component:Component):Observable<{[id:string]: Array<string>}> {
- return this.http.get(this.baseUrl + 'interfaceLifecycleTypes')
- .map((res:Response) => {
- const interfaceMap = {};
- _.forEach(res.json(), (interf:any) => {
- interfaceMap[interf.toscaPresentation.type] = _.keys(interf.toscaPresentation.operations);
- });
- return interfaceMap;
+ createComponentInterfaceOperation(componentMetaDataId: string,
+ componentMetaDataType: string,
+ operation: InterfaceOperationModel): Observable<InterfaceOperationModel> {
+ const operationList = {
+ interfaces: {
+ [operation.interfaceType]: {
+ type: operation.interfaceType,
+ operations: {
+ [operation.name]: new BEInterfaceOperationModel(operation)
+ }
+ }
+ }
+ };
+ console.log(operationList);
+ console.log(this.baseUrl + componentMetaDataType + componentMetaDataId + '/resource/interfaceOperation')
+ return this.http.post<any>(this.baseUrl + componentMetaDataType + componentMetaDataId + '/resource/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,