diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/services/component-services/component.service.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/services/component-services/component.service.ts | 46 |
1 files changed, 41 insertions, 5 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 3093e632fc..d406cf05f6 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 @@ -43,6 +43,7 @@ import { PolicyInstance } from "../../../models/graph/zones/policy-instance"; import { ConstraintObject } from "../../components/logic/service-dependencies/service-dependencies.component"; import { Requirement } from "../../../models/requirement"; import { Capability } from "../../../models/capability"; +import { OutputBEModel } from "app/models/attributes-outputs/output-be-model"; /* PLEASE DO NOT USE THIS SERVICE IN ANGULAR2! Use the topology-template.service instead @@ -59,7 +60,7 @@ export class ComponentServiceNg2 { protected getComponentDataByFieldsName(componentType:string, componentId:string, fields:Array<string>):Observable<ComponentGenericResponse> { let params: HttpParams = new HttpParams(); - _.forEach(fields, (field:string):void => { + fields.forEach((field:string):void => { params = params.append(API_QUERY_PARAMS.INCLUDE, field); }); @@ -109,6 +110,10 @@ export class ComponentServiceNg2 { return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]); } + getComponentResourceAttributesData(component:Component):Observable<ComponentGenericResponse> { + return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]); + } + getComponentResourceInstances(component:Component):Observable<ComponentGenericResponse> { return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES]); } @@ -208,8 +213,15 @@ export class ComponentServiceNg2 { return this.http.get<any>(this.baseUrl + 'interfaceLifecycleTypes') .map((res: any) => { const interfaceMap = {}; - _.forEach(res, (interf: any) => { - interfaceMap[interf.toscaPresentation.type] = _.keys(interf.toscaPresentation.operations); + if (!res) { + return interfaceMap; + } + Object.keys(res).forEach(interfaceName => { + const interface1 = res[interfaceName]; + if (!interface1.toscaPresentation.operations) { + return; + } + interfaceMap[interface1.toscaPresentation.type] = Object.keys(interface1.toscaPresentation.operations); }); return interfaceMap; }); @@ -297,7 +309,6 @@ export class ComponentServiceNg2 { return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/archive', {}) } - deleteInput(component:Component, input:InputBEModel):Observable<InputBEModel> { return this.http.delete<InputBEModel>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/delete/' + input.uniqueId + '/input') @@ -306,6 +317,14 @@ export class ComponentServiceNg2 { }) } + deleteOutput(component:Component, output:OutputBEModel):Observable<OutputBEModel> { + + return this.http.delete<OutputBEModel>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/delete/' + output.uniqueId + '/output') + .map((res) => { + return new OutputBEModel(res); + }) + } + updateComponentInputs(component:Component, inputs:InputBEModel[]):Observable<InputBEModel[]> { return this.http.post<InputBEModel[]>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/update/inputs', inputs) @@ -314,9 +333,26 @@ export class ComponentServiceNg2 { }) } + updateComponentOutputs(component:Component, outputs:OutputBEModel[]):Observable<OutputBEModel[]> { + + return this.http.post<OutputBEModel[]>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/update/outputs', outputs) + .map((res) => { + return res.map((output) => new OutputBEModel(output)); + }) + } + filterComponentInstanceProperties(component:Component, filterData:FilterPropertiesAssignmentData):Observable<InstanceBePropertiesMap> {//instance-property-be-map let params: HttpParams = new HttpParams(); - _.forEach(filterData.selectedTypes, (type:string) => { + filterData.selectedTypes.forEach((type:string) => { + params = params.append('resourceType', type); + }); + + return this.http.get<InstanceBePropertiesMap>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/filteredproperties/' + filterData.propertyName, {params: params}); + } + + filterComponentInstanceAttributes(component:Component, filterData:FilterPropertiesAssignmentData):Observable<InstanceBePropertiesMap> {//instance-property-be-map + let params: HttpParams = new HttpParams(); + filterData.selectedTypes.forEach((type:string) => { params = params.append('resourceType', type); }); |