summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/component-services
diff options
context:
space:
mode:
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) => {