diff options
author | 2019-05-13 15:30:27 +0300 | |
---|---|---|
committer | 2019-05-13 14:50:55 +0000 | |
commit | 3d5b80b9035b9832f86326858b4c6c2cecd952a3 (patch) | |
tree | 62109696bdc736bd2c7d3bfb68d730a2b44a3946 /catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts | |
parent | 8364c2d4c986e37cc1ea7e4120f5d13d14b03067 (diff) |
operation artifact optional and fixes
Change-Id: Ibce96d60248b26716ed518747444836b437f209f
Issue-ID: SDC-2249
Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts index 7c0f23291b..9db24b6071 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts @@ -315,10 +315,12 @@ export class InterfaceOperationComponent { private createOperation = (operation: OperationModel): void => { this.ComponentServiceNg2.createInterfaceOperation(this.component, operation).subscribe((response: OperationModel) => { this.openOperation = null; + let curInterf = _.find( this.interfaces, interf => interf.type === operation.interfaceType ); + if (!curInterf) { curInterf = new UIInterfaceModel({ type: response.interfaceType, @@ -327,11 +329,13 @@ export class InterfaceOperationComponent { }); this.interfaces.push(curInterf); } - curInterf.operations.push(new UIOperationModel(response)); + + const newOpModel = new UIOperationModel(response); + curInterf.operations.push(newOpModel); this.sortInterfaces(); - if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXTERNAL) { - this.ComponentServiceNg2.uploadInterfaceOperationArtifact(this.component, response, operation).subscribe(); + if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXTERNAL && operation.artifactData) { + this.ComponentServiceNg2.uploadInterfaceOperationArtifact(this.component, newOpModel, operation).subscribe(); } else if (response.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) { this.WorkflowServiceNg2.associateWorkflowArtifact(this.component, response).subscribe(); } else if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.NEW) { @@ -341,7 +345,7 @@ export class InterfaceOperationComponent { } private updateOperation = (operation: OperationModel): void => { - this.ComponentServiceNg2.updateInterfaceOperation(this.component, operation).subscribe(newOperation => { + this.ComponentServiceNg2.updateInterfaceOperation(this.component, operation).subscribe((newOperation: OperationModel) => { this.openOperation = null; let oldOpIndex, oldInterf; @@ -356,11 +360,12 @@ export class InterfaceOperationComponent { oldInterf.operations.splice(oldOpIndex, 1); const newInterf = _.find(this.interfaces, interf => interf.type === operation.interfaceType); - newInterf.operations.push(new UIOperationModel(newOperation)); + const newOpModel = new UIOperationModel(newOperation); + newInterf.operations.push(newOpModel); this.sortInterfaces(); - if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXTERNAL) { - this.ComponentServiceNg2.uploadInterfaceOperationArtifact(this.component, newOperation, operation).subscribe(); + if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXTERNAL && operation.artifactData) { + this.ComponentServiceNg2.uploadInterfaceOperationArtifact(this.component, newOpModel, operation).subscribe(); } else if (newOperation.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) { this.WorkflowServiceNg2.associateWorkflowArtifact(this.component, newOperation).subscribe(); } |