From e0c98681f9fcbae59eab32822784ae95c4768d40 Mon Sep 17 00:00:00 2001 From: Arielk Date: Thu, 28 Feb 2019 16:37:57 +0200 Subject: fix artifact delivery id implementation Change-Id: Ib2dc33852ff86ec0fd789b74e6a1fd7d9a50e798 Issue-ID: SDC-2084 Signed-off-by: Arielk --- catalog-ui/src/app/models/operation.ts | 14 +++----------- .../interface-operation.page.component.ts | 4 ++-- .../operation-creator/operation-creator.component.html | 2 +- .../ng2/services/component-services/component.service.ts | 10 +++++----- catalog-ui/src/app/ng2/services/workflow.service.ts | 6 +++--- catalog-ui/src/assets/languages/en_US.json | 1 + 6 files changed, 15 insertions(+), 22 deletions(-) (limited to 'catalog-ui/src') diff --git a/catalog-ui/src/app/models/operation.ts b/catalog-ui/src/app/models/operation.ts index d36b72a140..d9d0858870 100644 --- a/catalog-ui/src/app/models/operation.ts +++ b/catalog-ui/src/app/models/operation.ts @@ -38,6 +38,8 @@ export class BEOperationModel { workflowId: string; workflowVersionId: string; + implementation?: { artifactUUID: string; }; + constructor(operation?: any) { if (operation) { this.name = operation.name; @@ -50,6 +52,7 @@ export class BEOperationModel { this.workflowAssociationType = operation.workflowAssociationType; this.workflowId = operation.workflowId; this.workflowVersionId = operation.workflowVersionId; + this.implementation = operation.implementation; } } @@ -87,17 +90,6 @@ export class OperationModel extends BEOperationModel { } } -export class CreateOperationResponse extends OperationModel { - artifactUUID: string; - - constructor(operation?: any) { - super(operation); - if (operation) { - this.artifactUUID = operation.artifactUUID; - } - } -} - export class InterfaceModel { type: string; uniqueId: string; 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 f04ccd9085..9035b3ff50 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 @@ -9,7 +9,7 @@ import {Observable} from "rxjs/Observable"; import {ModalComponent} from 'app/ng2/components/ui/modal/modal.component'; import {ModalService} from 'app/ng2/services/modal.service'; -import {ModalModel, ButtonModel, InputBEModel, OperationModel, InterfaceModel, CreateOperationResponse, WORKFLOW_ASSOCIATION_OPTIONS} from 'app/models'; +import {ModalModel, ButtonModel, InputBEModel, OperationModel, InterfaceModel, WORKFLOW_ASSOCIATION_OPTIONS} from 'app/models'; import {IModalConfig, IModalButtonComponent} from "sdc-ui/lib/angular/modals/models/modal-config"; import {SdcUiComponents} from "sdc-ui/lib/angular"; @@ -301,7 +301,7 @@ export class InterfaceOperationComponent { } private createOperation = (operation: OperationModel): void => { - this.ComponentServiceNg2.createInterfaceOperation(this.component, operation).subscribe((response: CreateOperationResponse) => { + this.ComponentServiceNg2.createInterfaceOperation(this.component, operation).subscribe((response: OperationModel) => { this.openOperation = null; let curInterf = _.find( this.interfaces, diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html index 7abc1a52c0..9f78088609 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html @@ -85,7 +85,7 @@
{ + createInterfaceOperation(component:Component, operation:OperationModel):Observable { const operationList = { 'interfaces': { [operation.interfaceType]: { @@ -154,7 +154,7 @@ export class ComponentServiceNg2 { .map((res:Response) => { const interf = _.find(res.json().interfaces, (interf: any) => interf.type === operation.interfaceType); const newOperation = _.find(interf.operations, (op:OperationModel) => op.name === operation.name); - return new CreateOperationResponse({ + return new OperationModel({ ...newOperation, interfaceType: interf.type, interfaceId: interf.uniqueId @@ -162,7 +162,7 @@ export class ComponentServiceNg2 { }); } - updateInterfaceOperation(component:Component, operation:OperationModel):Observable { + updateInterfaceOperation(component:Component, operation:OperationModel):Observable { const operationList = { 'interfaces': { [operation.interfaceType]: { @@ -177,7 +177,7 @@ export class ComponentServiceNg2 { .map((res:Response) => { const interf = _.find(res.json().interfaces, (interf: any) => interf.type === operation.interfaceType); const newOperation = _.find(interf.operations, (op:OperationModel) => op.name === operation.name); - return new CreateOperationResponse({ + return new OperationModel({ ...newOperation, interfaceType: interf.type, interfaceId: interf.uniqueId diff --git a/catalog-ui/src/app/ng2/services/workflow.service.ts b/catalog-ui/src/app/ng2/services/workflow.service.ts index 36d56d6fa7..81a2ea3b7f 100644 --- a/catalog-ui/src/app/ng2/services/workflow.service.ts +++ b/catalog-ui/src/app/ng2/services/workflow.service.ts @@ -3,7 +3,7 @@ import { Response } from "@angular/http"; import { Observable } from "rxjs/Observable"; import { HttpService } from "./http.service"; import { SdcConfigToken, ISdcConfig } from "../config/sdc-config.config"; -import { Component, CreateOperationResponse } from "app/models"; +import { Component, OperationModel } from "app/models"; interface WorkflowOutputParameter { name: string, @@ -30,9 +30,9 @@ export class WorkflowServiceNg2 { this.catalogBaseUrl = sdcConfig.api.POST_workflow_artifact; } - public associateWorkflowArtifact(component: Component, operation: CreateOperationResponse): Observable { + public associateWorkflowArtifact(component: Component, operation: OperationModel): Observable { return this.http.post(this.baseUrl + '/workflows/' + operation.workflowId + '/versions/' + operation.workflowVersionId + '/artifact-deliveries', { - endpoint: this.catalogBaseUrl + '/' + component.getTypeUrl() + component.uuid + '/interfaces/' + operation.interfaceId + '/operations/' + operation.uniqueId + '/artifacts/' + operation.artifactUUID, + endpoint: this.catalogBaseUrl + '/' + component.getTypeUrl() + component.uuid + '/interfaces/' + operation.interfaceId + '/operations/' + operation.uniqueId + '/artifacts/' + operation.implementation.artifactUUID, method: 'POST' }) .map((res:Response) => { diff --git a/catalog-ui/src/assets/languages/en_US.json b/catalog-ui/src/assets/languages/en_US.json index 1c68091a28..41f543aae8 100644 --- a/catalog-ui/src/assets/languages/en_US.json +++ b/catalog-ui/src/assets/languages/en_US.json @@ -480,6 +480,7 @@ "OPERATION_WORKFLOW_ASSIGNMENT": "Workflow Assignment", "OPERATION_WORKFLOW": "Workflow", "OPERATION_NO_WORKFLOW_ERROR": "No Certified Versions Available", + "OPERATION_NO_WORKFLOW_CONNECTION": "Failed to Load Workflows", "OPERATION_WORKFLOW_ARCHIVED": "Archived", "OPERATION_WORKFLOW_VERSION": "Workflow Version", "OPERATION_ADD_PARAMS": "Add Paramaters", -- cgit 1.2.3-korg