- console.log('createOperationCallback', operationToUpdate);
- console.log('this.component', this.component);
- this.componentServiceNg2.createComponentInterfaceOperation(this.component.uniqueId, this.component.getTypeUrl(), operationToUpdate)
- .subscribe((newOperation: InterfaceOperationModel) => {
- const foundInterface = this.interfaces.find(value => value.type === newOperation.interfaceType);
- if (foundInterface) {
- foundInterface.operations.push(new UIOperationModel(new OperationModel(newOperation)));
- } else {
- const uiInterfaceModel = new UIInterfaceModel();
- uiInterfaceModel.type = newOperation.interfaceType;
- uiInterfaceModel.uniqueId = newOperation.interfaceType;
- uiInterfaceModel.operations = [];
- uiInterfaceModel.operations.push(new UIOperationModel(new OperationModel(newOperation)));
- this.interfaces.push(uiInterfaceModel);
- }
- }, error => {
- this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
- }, () => {
- this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
- this.modalServiceNg2.closeCurrentModal();
- });
+ if (this.component.componentType === ComponentType.SERVICE) {
+ this.topologyTemplateService.createComponentInstanceInterfaceOperation(this.component.uniqueId, this.selectedInstanceData.uniqueId, operationToUpdate)
+ .subscribe((newOperation: InterfaceOperationModel) => {
+ const foundInterface = this.interfaces.find(value => value.type === newOperation.interfaceType);
+ if (foundInterface) {
+ foundInterface.operations.push(new UIOperationModel(new OperationModel(newOperation)));
+ } else {
+ const uiInterfaceModel = new UIInterfaceModel();
+ uiInterfaceModel.type = newOperation.interfaceType;
+ uiInterfaceModel.uniqueId = newOperation.interfaceType;
+ uiInterfaceModel.operations = [];
+ uiInterfaceModel.operations.push(new UIOperationModel(new OperationModel(newOperation)));
+ this.interfaces.push(uiInterfaceModel);
+ }
+ }, () => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ this.modalServiceNg2.closeCurrentModal();
+ }, () => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ this.modalServiceNg2.closeCurrentModal();
+ });
+ } else {
+ this.componentServiceNg2.createComponentInterfaceOperation(this.component.uniqueId, this.component.getTypeUrl(), operationToUpdate)
+ .subscribe((newOperation: InterfaceOperationModel) => {
+ const foundInterface = this.interfaces.find(value => value.type === newOperation.interfaceType);
+ if (foundInterface) {
+ foundInterface.operations.push(new UIOperationModel(new OperationModel(newOperation)));
+ } else {
+ const uiInterfaceModel = new UIInterfaceModel();
+ uiInterfaceModel.type = newOperation.interfaceType;
+ uiInterfaceModel.uniqueId = newOperation.interfaceType;
+ uiInterfaceModel.operations = [];
+ uiInterfaceModel.operations.push(new UIOperationModel(new OperationModel(newOperation)));
+ this.interfaces.push(uiInterfaceModel);
+ }
+ }, () => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ this.modalServiceNg2.closeCurrentModal();
+ }, () => {
+ this.modalServiceNg2.currentModal.instance.dynamicContent.instance.isLoading = false;
+ this.modalServiceNg2.closeCurrentModal();
+ });
+ }