diff options
author | Arielk <Ariel.Kenan@amdocs.com> | 2018-07-31 12:59:36 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-08-02 08:56:34 +0000 |
commit | eaaf8019188ad99ad2b76e43519c7dae9f4ac592 (patch) | |
tree | 3f42e4ea4bee6c2735395f61bb9f6f1623f64570 /catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts | |
parent | decd2dff3b5b8aff53be52c825e45186d5c16e99 (diff) |
Enhance operations to associate workflows
Change-Id: Iacf74ee333a3bc2e76e764c28ae660322bc9e6e4
Issue-ID: SDC-1535
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 | 42 |
1 files changed, 24 insertions, 18 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 c58e1de135..010a1f9dda 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 @@ -1,11 +1,15 @@ import * as _ from "lodash"; import {Component, Input, ComponentRef, Inject} from '@angular/core'; import {Component as IComponent} from 'app/models/components/component'; + +import {ModalComponent} from 'app/ng2/components/ui/modal/modal.component'; import {ModalService} from 'app/ng2/services/modal.service'; import {ModalModel, ButtonModel, InputModel, OperationModel, CreateOperationResponse} from 'app/models'; -import {ModalComponent} from 'app/ng2/components/ui/modal/modal.component'; + import {ComponentServiceNg2} from 'app/ng2/services/component-services/component.service'; import {ComponentGenericResponse} from 'app/ng2/services/responses/component-generic-response'; +import {WorkflowServiceNg2} from 'app/ng2/services/workflow.service'; + import {OperationCreatorComponent} from './operation-creator/operation-creator.component'; @Component({ @@ -27,6 +31,7 @@ export class InterfaceOperationComponent { constructor( @Inject('$state') private $state:ng.ui.IStateService, private ComponentServiceNg2: ComponentServiceNg2, + private WorkflowServiceNg2: WorkflowServiceNg2, private ModalServiceNg2: ModalService, ) {} @@ -87,8 +92,15 @@ export class InterfaceOperationComponent { () => { this.modalInstance.instance.dynamicContent.instance.createInputParamList(); this.ModalServiceNg2.closeCurrentModal(); - const {operation} = this.modalInstance.instance.dynamicContent.instance; - this.openOperation = operation; + + const {operation, isAssociateWorkflow} = this.modalInstance.instance.dynamicContent.instance; + this.openOperation = {...operation}; + + if (!isAssociateWorkflow) { + operation.workflowId = null; + operation.workflowVersionId = null; + } + modalData.submitCallback(operation); }, this.getDisabled, @@ -103,6 +115,7 @@ export class InterfaceOperationComponent { ); this.modalInstance = this.ModalServiceNg2.createCustomModal(modalModel); + this.ModalServiceNg2.addDynamicContentToModal( this.modalInstance, OperationCreatorComponent, @@ -145,22 +158,15 @@ export class InterfaceOperationComponent { this.ComponentServiceNg2.createInterfaceOperation(this.component, operation).subscribe((response: CreateOperationResponse) => { this.openOperation = null; - const workflowId = response.artifactUUID; - const operationId = response.uniqueId; - const resourceId = this.component.uuid; - - const queryParams = { - id: workflowId, - operationID: operationId, - uuid: resourceId, - displayMode: 'create', - }; - - this.$state.go('workspace.plugins', { - path: 'workflowDesigner', - queryParams - }); + if (response.workflowId) { + const resourceId = this.component.uuid; + const operationId = response.uniqueId; + const workflowId = response.workflowId; + const versionId = response.workflowVersionId; + const artifactId = response.artifactUUID; + this.WorkflowServiceNg2.associateWorkflowArtifact(resourceId, operationId, workflowId, versionId, artifactId); + } }); } |