aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/component-services
diff options
context:
space:
mode:
authorTalio <tali.orenbach@amdocs.com>2019-01-31 18:00:36 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-02-04 11:00:09 +0000
commit0953785bfd6a3af5e506f8a55a8520c0fb7ef358 (patch)
tree2f900e3f09a60a5a9a75ddcdd30930d3164eeeed /catalog-ui/src/app/ng2/services/component-services
parent47c8af4d7241f20755ea97a6119bae2f500cfffa (diff)
Add property mapping feature to ONAP
Add service property assignment Change-Id: I29748ce12bacab06b8bc27f8875b39d80ffe5af7 Issue-ID: SDC-1988 Signed-off-by: Talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/services/component-services')
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/component.service.ts43
1 files changed, 40 insertions, 3 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 97e62daba7..69871abe04 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
@@ -24,7 +24,7 @@ import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import {Response, URLSearchParams} from '@angular/http';
-import { Component, InputBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData, OperationModel, BEOperationModel, CreateOperationResponse} from "app/models";
+import { Component, InputBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData, PropertyBEModel, OperationModel, BEOperationModel, CreateOperationResponse} from "app/models";
import {downgradeInjectable} from '@angular/upgrade/static';
import {COMPONENT_FIELDS, CommonUtils} from "app/utils";
import {ComponentGenericResponse} from "../responses/component-generic-response";
@@ -205,8 +205,9 @@ export class ComponentServiceNg2 {
return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_GROUPS]);
}
- createInput(component:Component, inputsToCreate:InstancePropertiesAPIMap):Observable<any> {
- return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/create/inputs', inputsToCreate)
+ createInput(component:Component, inputsToCreate:InstancePropertiesAPIMap, isSelf:boolean):Observable<any> {
+ let inputs = isSelf ? { serviceProperties: inputsToCreate.componentInstanceProperties } : inputsToCreate;
+ return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/create/inputs', inputs)
.map(res => {
return res.json();
})
@@ -247,6 +248,42 @@ export class ComponentServiceNg2 {
});
}
+ createServiceProperty(component: Component, propertyModel:PropertyBEModel): Observable<PropertyBEModel> {
+ let serverObject = {};
+ serverObject[propertyModel.name] = propertyModel;
+ return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/properties', serverObject)
+ .map(res => {
+ let property:PropertyBEModel = new PropertyBEModel(res.json());
+ return property;
+ })
+ }
+
+ getServiceProperties(component: Component): Observable<Array<PropertyBEModel>> {
+ return this.http.get(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/properties')
+ .map((res: Response) => {
+ if (!res.text()){
+ return new Array<PropertyBEModel>();
+ }
+ return CommonUtils.initBeProperties(res.json());
+ });
+ }
+
+ updateServiceProperties(component: Component, properties: PropertyBEModel[]) {
+ return this.http.put( this.baseUrl + component.getTypeUrl() + component.uniqueId + '/properties', properties)
+ .map((res: Response) => {
+ const resJson = res.json();
+ return _.map(resJson,
+ (resValue:PropertyBEModel) => new PropertyBEModel(resValue));
+ });
+ }
+
+ deleteServiceProperty(component:Component, property:PropertyBEModel):Observable<string> {
+ return this.http.delete(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/properties/' + property.uniqueId )
+ .map((res:Response) => {
+ return property.uniqueId;
+ })
+ }
+
getDependencies(componentType:string, componentId: string):Observable<Array<IDependenciesServerResponse>> {
return this.http.get(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/dependencies')
.map((res:Response) => {