summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
authorArielk <Ariel.Kenan@amdocs.com>2019-05-13 15:30:27 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-05-13 14:50:55 +0000
commit3d5b80b9035b9832f86326858b4c6c2cecd952a3 (patch)
tree62109696bdc736bd2c7d3bfb68d730a2b44a3946 /catalog-ui/src/app/ng2/services
parent8364c2d4c986e37cc1ea7e4120f5d13d14b03067 (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/services')
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/component.service.ts26
1 files changed, 15 insertions, 11 deletions
diff --git a/catalog-ui/src/app/ng2/services/component-services/component.service.ts b/catalog-ui/src/app/ng2/services/component-services/component.service.ts
index c313a3fc2f..445e1231f9 100644
--- a/catalog-ui/src/app/ng2/services/component-services/component.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/component.service.ts
@@ -25,7 +25,7 @@ import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import {Response, URLSearchParams, Headers} from '@angular/http';
import { Component, ComponentInstance, InputBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData,
- PropertyBEModel, OperationModel, BEOperationModel, Capability, Requirement, PolicyInstance} from "app/models";
+ PropertyBEModel, InterfaceModel, OperationModel, BEOperationModel, Capability, Requirement, PolicyInstance} from "app/models";
import {COMPONENT_FIELDS, CommonUtils, SERVICE_FIELDS} from "app/utils";
import {downgradeInjectable} from '@angular/upgrade/static';
import {ComponentGenericResponse} from "../responses/component-generic-response";
@@ -156,12 +156,13 @@ export class ComponentServiceNg2 {
};
return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations', operationList)
.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);
+ const interf:InterfaceModel = _.find(res.json().interfaces, interf => interf.type === operation.interfaceType);
+ const newOperation:OperationModel = _.find(interf.operations, op => op.name === operation.name);
return new OperationModel({
...newOperation,
interfaceType: interf.type,
- interfaceId: interf.uniqueId
+ interfaceId: interf.uniqueId,
+ artifactFileName: operation.artifactFileName
});
});
}
@@ -179,12 +180,13 @@ export class ComponentServiceNg2 {
};
return this.http.put(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations', operationList)
.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);
+ const interf:InterfaceModel = _.find(res.json().interfaces, interf => interf.type === operation.interfaceType);
+ const newOperation:OperationModel = _.find(interf.operations, op => op.name === operation.name);
return new OperationModel({
...newOperation,
interfaceType: interf.type,
- interfaceId: interf.uniqueId
+ interfaceId: interf.uniqueId,
+ artifactFileName: operation.artifactFileName
});
});
}
@@ -207,12 +209,12 @@ export class ComponentServiceNg2 {
});
}
- uploadInterfaceOperationArtifact(component:Component, response:OperationModel, UIOperation:OperationModel) {
+ uploadInterfaceOperationArtifact(component:Component, newOperation:OperationModel, oldOperation:OperationModel) {
const payload = {
artifactType: "WORKFLOW",
- artifactName: UIOperation.artifactFile.name,
+ artifactName: oldOperation.artifactFileName,
description: "Workflow Artifact Description",
- payloadData: UIOperation.artifactData
+ payloadData: oldOperation.artifactData
};
const headers = new Headers();
@@ -221,10 +223,12 @@ export class ComponentServiceNg2 {
const md5Result = md5(payloadString).toLowerCase();
headers.append('Content-MD5', btoa(md5Result));
- return this.http.post(this.baseUrl + component.getTypeUrl() + component.uuid + '/interfaces/' + response.interfaceId + '/operations/' + response.uniqueId + '/artifacts/' + response.implementation.artifactUUID,
+ return this.http.post(this.baseUrl + component.getTypeUrl() + component.uuid + '/interfaces/' + newOperation.interfaceId + '/operations/' + newOperation.uniqueId + '/artifacts/' + newOperation.implementation.artifactUUID,
payload,
{headers}
).map((res: Response) => {
+ const fileName = res.json().artifactDisplayName || res.json().artifactName;
+ newOperation.artifactFileName = fileName;
return res.json();
});
}