import {BEOperationModel, InterfaceModel} from "../../../models/operation";
import {PropertyBEModel} from "../../../models/properties-inputs/property-be-model";
import {PolicyInstance} from "../../../models/graph/zones/policy-instance";
-import {
- ConstraintObject
-} from "../../components/logic/service-dependencies/service-dependencies.component";
import {OutputBEModel} from "app/models/attributes-outputs/output-be-model";
import {HttpHelperService} from '../http-hepler.service';
import {
BEInterfaceOperationModel,
InterfaceOperationModel
} from "../../../models/interfaceOperation";
+import {FilterConstraint} from "../../../models/filter-constraint";
/*
PLEASE DO NOT USE THIS SERVICE IN ANGULAR2! Use the topology-template.service instead
}
getComponentResourcePropertiesData(component: Component): Observable<ComponentGenericResponse> {
- return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]);
+ return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_INTERFACE_OPERATIONS, 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_INTERFACE_OPERATIONS]);
}
+
+
getInterfaceOperation(component: Component, operation: OperationModel): Observable<OperationModel> {
return this.http.get<OperationModel>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations/' + operation.uniqueId);
}
});
}
+ createComponentInterfaceOperation(componentMetaDataId: string,
+ componentMetaDataType: string,
+ operation: InterfaceOperationModel): Observable<InterfaceOperationModel> {
+ const operationList = {
+ interfaces: {
+ [operation.interfaceType]: {
+ type: operation.interfaceType,
+ operations: {
+ [operation.name]: new BEInterfaceOperationModel(operation)
+ }
+ }
+ }
+ };
+ console.log(operationList);
+ console.log(this.baseUrl + componentMetaDataType + componentMetaDataId + '/resource/interfaceOperation')
+ return this.http.post<any>(this.baseUrl + componentMetaDataType + componentMetaDataId + '/resource/interfaceOperation', operationList)
+ .map((res: any) => {
+ const interf: InterfaceModel = _.find(res.interfaces, interf => interf.type === operation.interfaceType);
+ const newOperation: OperationModel = _.find(interf.operations, op => op.name === operation.name);
+
+ return new InterfaceOperationModel({
+ ...newOperation,
+ interfaceType: interf.type,
+ interfaceId: interf.uniqueId,
+ });
+ });
+ }
+
deleteInterfaceOperation(component: Component, operation: OperationModel): Observable<OperationModel> {
return this.http.delete<OperationModel>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaces/' + operation.interfaceId + '/operations/' + operation.uniqueId);
}
getInterfaceTypes(component: Component): Observable<{ [id: string]: Array<string> }> {
- return this.http.get<any>(this.baseUrl + 'interfaceLifecycleTypes' + ((component && component.model) ? '?model=' + component.model : ''))
+ return this.getInterfaceTypesByModel(component && component.model);
+ }
+
+ getInterfaceTypesByModel(model: string): Observable<{ [id: string]: Array<string> }> {
+ return this.http.get<any>(this.baseUrl + 'interfaceLifecycleTypes' + ((model) ? '?model=' + model : ''))
.map((res: any) => {
const interfaceMap = {};
if (!res) {
return this.http.get<InstanceBePropertiesMap>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/filteredproperties/' + filterData.propertyName, {params: params});
}
+ deleteComponent(componentType: string, componentId: string) {
+ return this.http.delete(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + "?deleteAction=DELETE", {});
+ }
+
createServiceProperty(component: Component, propertyModel: PropertyBEModel): Observable<PropertyBEModel> {
let serverObject = {};
serverObject[propertyModel.name] = propertyModel;
return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [SERVICE_FIELDS.NODE_FILTER]);
}
- createServiceFilterConstraints(component: Component, componentInstance: ComponentInstance, constraint: ConstraintObject): Observable<any> {
+ createServiceFilterConstraints(component: Component, componentInstance: ComponentInstance, constraint: FilterConstraint): Observable<any> {
return this.http.post<any>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/resourceInstances/' + componentInstance.uniqueId + '/nodeFilter', constraint);
}
- updateServiceFilterConstraints(component: Component, componentInstance: ComponentInstance, constraints: ConstraintObject[]): Observable<any> {
+ updateServiceFilterConstraints(component: Component, componentInstance: ComponentInstance, constraints: FilterConstraint[]): Observable<any> {
return this.http.put<any>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/resourceInstances/' + componentInstance.uniqueId + '/nodeFilter/', constraints);
}