summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2019-03-18 14:15:03 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-03-18 11:38:42 +0000
commit4192e3caac2662624a7368252a3bc5619539caa7 (patch)
treec070e560ac56c9c246e059d4b4a510b9eec9320f /catalog-ui/src/app/ng2/services
parent2ca2fc5c0da1eb862fcd79d1f9345aa89e62b396 (diff)
Service Consumption FE
Service consumption feature frontend implementation Change-Id: I68e1b507b1d4379b271fe97428ff8ae86dc11b4c Issue-ID: SDC-1990 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/component.service.ts7
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/service.service.ts24
-rw-r--r--catalog-ui/src/app/ng2/services/responses/component-generic-response.ts16
3 files changed, 38 insertions, 9 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 46dfe01992..a25fb75a41 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,10 +25,9 @@ import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import {Response, URLSearchParams} from '@angular/http';
import { Component, ComponentInstance, InputBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData,
- PropertyBEModel, OperationModel, BEOperationModel, Capability, Requirement
-} from "app/models";
-import {downgradeInjectable} from '@angular/upgrade/static';
+ PropertyBEModel, OperationModel, BEOperationModel, Capability, Requirement} 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";
import {InstanceBePropertiesMap} from "../../../models/properties-inputs/property-fe-map";
import {API_QUERY_PARAMS} from "app/utils";
@@ -282,7 +281,7 @@ export class ComponentServiceNg2 {
})
}
- restoreComponent(componentType:string, componentId:string){
+ restoreComponent(componentType:string, componentId:string){
return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/restore', {})
}
diff --git a/catalog-ui/src/app/ng2/services/component-services/service.service.ts b/catalog-ui/src/app/ng2/services/component-services/service.service.ts
index 15e624b81f..406ac77ec4 100644
--- a/catalog-ui/src/app/ng2/services/component-services/service.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/service.service.ts
@@ -23,8 +23,7 @@ import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import { Response, URLSearchParams } from '@angular/http';
-import {Service} from "app/models";
-import { downgradeInjectable } from '@angular/upgrade/static';
+import {Service, OperationModel} from "app/models";
import { HttpService } from '../http.service';
import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config";
@@ -37,6 +36,7 @@ import {COMPONENT_FIELDS, SERVICE_FIELDS} from "app/utils/constants";
import {ComponentServiceNg2} from "./component.service";
import {ServiceGenericResponse} from "app/ng2/services/responses/service-generic-response";
import {ServicePathMapItem} from "app/models/graph/nodes-and-links-map";
+import {ConsumptionInput} from 'app/ng2/components/logic/service-consumption/service-consumption.component';
@Injectable()
@@ -110,6 +110,26 @@ export class ServiceServiceNg2 extends ComponentServiceNg2 {
});
}
+ getServiceConsumptionData(service: Service):Observable<ComponentGenericResponse> {
+ return this.getComponentDataByFieldsName(service.componentType, service.uniqueId, [
+ COMPONENT_FIELDS.COMPONENT_INSTANCES_INTERFACES,
+ COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES,
+ COMPONENT_FIELDS.COMPONENT_INSTANCES_INPUTS,
+ COMPONENT_FIELDS.COMPONENT_INPUTS
+ ]);
+ }
+
+ getServiceConsumptionInputs(service: Service, serviceInstanceId: String, interfaceId: string, operation: OperationModel): Observable<any> {
+ return this.http.get(this.baseUrl + service.getTypeUrl() + service.uniqueId + '/consumption/' + serviceInstanceId + '/interfaces/' + interfaceId + '/operations/' + operation.uniqueId + '/inputs')
+ .map(res => {
+ return res.json();
+ });
+ }
+
+ createOrUpdateServiceConsumptionInputs(service: Service, serviceInstanceId: String, consumptionInputsList: Array<{[id: string]: Array<ConsumptionInput>}>): Observable<any> {
+ return this.http.post(this.baseUrl + service.getTypeUrl() + service.uniqueId + '/consumption/' + serviceInstanceId, consumptionInputsList);
+ }
+
checkComponentInstanceVersionChange(service: Service, newVersionId: string):Observable<Array<string>> {
let instanceId = service.selectedInstance.uniqueId;
let queries = {componentInstanceId: instanceId, newComponentInstanceId: newVersionId};
diff --git a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
index 37ccf381c9..d297ea0874 100644
--- a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
+++ b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
@@ -22,11 +22,10 @@
* Created by ob0695 on 4/18/2017.
*/
-import { ArtifactGroupModel, PropertyModel, PropertiesGroup, AttributeModel, AttributesGroup, ComponentInstance, OperationModel,
- InputBEModel, Module, ComponentMetadata, RelationshipModel, RequirementsGroup, CapabilitiesGroup,InputFEModel} from "app/models";
+import { ArtifactGroupModel, PropertyModel, PropertiesGroup, InputsGroup, AttributeModel, AttributesGroup, ComponentInstance, OperationModel,
+ InputBEModel, Module, ComponentMetadata, RelationshipModel, RequirementsGroup, CapabilitiesGroup, InterfaceModel} from "app/models";
import {CommonUtils} from "app/utils";
import {Serializable} from "../utils/serializable";
-import {PropertyBEModel} from "../../../models/properties-inputs/property-be-model";
import { PolicyInstance } from "app/models/graph/zones/policy-instance";
import { GroupInstance } from "../../../models/graph/zones/group-instance";
@@ -37,9 +36,11 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR
public artifacts:ArtifactGroupModel;
public toscaArtifacts:ArtifactGroupModel;
public componentInstancesProperties:PropertiesGroup;
+ public componentInstancesInputs:InputsGroup;
public componentInstancesAttributes:AttributesGroup;
public componentInstancesRelations:Array<RelationshipModel>;
public componentInstances:Array<ComponentInstance>;
+ public componentInstancesInterfaces:Map<string,Array<InterfaceModel>>;
public inputs:Array<InputBEModel>;
public capabilities:CapabilitiesGroup;
public requirements:RequirementsGroup;
@@ -59,6 +60,9 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR
if(response.componentInstancesProperties) {
this.componentInstancesProperties = new PropertiesGroup(response.componentInstancesProperties);
}
+ if(response.componentInstancesInputs) {
+ this.componentInstancesInputs = response.componentInstancesInputs;
+ }
if(response.componentInstancesAttributes) {
this.componentInstancesAttributes = new AttributesGroup(response.componentInstancesAttributes);
}
@@ -96,6 +100,12 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR
this.interfaces = CommonUtils.initInterfaces(response.interfaces);
this.interfaceOperations = CommonUtils.initInterfaceOperations(response.interfaces);
}
+ if(response.componentInstancesInterfaces) {
+ this.componentInstancesInterfaces = new Map();
+ for (let resourceId in response.componentInstancesInterfaces) {
+ this.componentInstancesInterfaces[resourceId] = CommonUtils.initInterfaces(response.componentInstancesInterfaces[resourceId]);
+ }
+ }
if(response.metadata) {
this.metadata = new ComponentMetadata().deserialize(response.metadata);
}