scope.$watchCollection('[typeName,fieldsPrefixName]', (newData: any): void => {
this.rerender(scope);
});
- let childProp = this.PropertiesUtils.convertAddPropertyBAToPropertyFE(scope.parentProperty);
- scope.subpropertyMap = new Map<string,PropertyDeclareAPIModel>();
- scope.showToscaFunction = new Map<string,boolean>();
- childProp.flattenedChildren.forEach(prop => {
- scope.showToscaFunction.set(prop.name,false);
- if (scope.parentProperty.subPropertyToscaFunctions != null) {
- scope.parentProperty.subPropertyToscaFunctions.forEach(SubPropertyToscaFunction => {
- if (SubPropertyToscaFunction.subPropertyPath.toString() == prop.name) {
- scope.showToscaFunction.set(prop.name,true);
- }
- });
- }
- scope.subpropertyMap.set(prop.name,new PropertyDeclareAPIModel(childProp, prop));
- });
scope.expandAndCollapse = (): void => {
if (!scope.expanded) {
this.initDataOnScope(scope, $attr);
}
scope.getToscaPathValue = (propertyName: string) : Array<string> => {
- const parentObj : PropertyDeclareAPIModel = scope.subpropertyMap.get(propertyName);
- if (parentObj.input instanceof DerivedFEProperty) {
- return parentObj.input.toscaPath;
- }
- return [propertyName];
+ let toscaPath = [propertyName];
+ if (scope.complexToscapath != null) {
+ toscaPath = [scope.complexToscapath,propertyName];
+ }
+ return toscaPath;
}
scope.onGetToscaFunction = (toscaGetFunction: ToscaGetFunction, key:string): void => {
- let toscaPath = key;
+ let toscaPath = scope.getToscaPathValue(key);
scope.valueObjRef[key] = "";
if (scope.parentProperty.subPropertyToscaFunctions != null) {
let toscaFlag : boolean = true
scope.parentProperty.subPropertyToscaFunctions.forEach(SubPropertyToscaFunction => {
- if (SubPropertyToscaFunction.subPropertyPath.toString() == toscaPath) {
+ if (SubPropertyToscaFunction.subPropertyPath.toString() == toscaPath.toString()) {
SubPropertyToscaFunction.toscaFunction = toscaGetFunction;
toscaFlag = false;
return;
if (toscaFlag) {
let subPropertyToscaFunction = new SubPropertyToscaFunction();
subPropertyToscaFunction.toscaFunction = toscaGetFunction;
- subPropertyToscaFunction.subPropertyPath = [toscaPath];
+ subPropertyToscaFunction.subPropertyPath = toscaPath;
scope.parentProperty.subPropertyToscaFunctions.push(subPropertyToscaFunction);
}
} else {
let subPropertyToscaFunction = new SubPropertyToscaFunction();
subPropertyToscaFunction.toscaFunction = toscaGetFunction;
- subPropertyToscaFunction.subPropertyPath = [toscaPath];
+ subPropertyToscaFunction.subPropertyPath = toscaPath;
scope.parentProperty.subPropertyToscaFunctions = [subPropertyToscaFunction];
}
}
scope.valueObjRef = {};
}
+ let childProp = this.PropertiesUtils.convertAddPropertyBAToPropertyFE(scope.parentProperty);
+ scope.subpropertyMap = new Map<string,PropertyDeclareAPIModel>();
+ scope.showToscaFunction = new Map<string,boolean>();
+ if (childProp.flattenedChildren.length > 0) {
+ childProp.flattenedChildren.forEach(prop => {
+ scope.showToscaFunction.set(prop.name,false);
+ if (scope.parentProperty.subPropertyToscaFunctions != null) {
+ scope.parentProperty.subPropertyToscaFunctions.forEach(SubPropertyToscaFunction => {
+ let toscaPath = scope.getToscaPathValue(prop.name);
+ if (SubPropertyToscaFunction.subPropertyPath.toString() == toscaPath.toString()) {
+ scope.showToscaFunction.set(prop.name,true);
+ }
+ });
+ }
+ scope.subpropertyMap.set(prop.name,new PropertyDeclareAPIModel(childProp, prop));
+ });
+ } else {
+ scope.dataTypeProperties.forEach(prop => {
+ scope.showToscaFunction.set(prop.name,false);
+ if (scope.parentProperty.subPropertyToscaFunctions != null) {
+ scope.parentProperty.subPropertyToscaFunctions.forEach(SubPropertyToscaFunction => {
+ let toscaPath = scope.getToscaPathValue(prop.name);
+ if (SubPropertyToscaFunction.subPropertyPath.toString() == toscaPath.toString()) {
+ scope.showToscaFunction.set(prop.name,true);
+ }
+ });
+ }
+ scope.subpropertyMap.set(prop.name,new PropertyDeclareAPIModel(childProp, prop));
+ });
+ }
+
_.forEach(scope.currentTypeDefaultValue, (value, key) => {
if (angular.isUndefined(scope.valueObjRef[key])) {
if (typeof scope.currentTypeDefaultValue[key] == 'object') {
InputsGroup,
InputModel
} from 'app/models';
+import {DataTypesService} from "app/services";
import {ToscaGetFunctionType} from "app/models/tosca-get-function-type";
import { CompositionService } from 'app/ng2/pages/composition/composition.service';
import { WorkspaceService } from 'app/ng2/pages/workspace/workspace.service';
constructor(private store: Store,
private workspaceService: WorkspaceService,
+ private DataTypesService:DataTypesService,
private compositionService: CompositionService,
private modalsHandler: ModalsHandler,
private topologyTemplateService: TopologyTemplateService,
ngOnInit() {
this.metadata = this.workspaceService.metadata;
+ this.DataTypesService.loadDataTypesCache(this.workspaceService.metadata.model);
this.isComponentInstanceSelected = this.componentType === SelectedComponentType.COMPONENT_INSTANCE;
this.getComponentInstancesPropertiesAndAttributes();
}
@Input() allowClear: boolean = true;
@Input() compositionMap: boolean = false;
@Input() compositionMapKey: string = "";
+ @Input() complexListKey: string = null;
@Output() onValidFunction: EventEmitter<ToscaGetFunction> = new EventEmitter<ToscaGetFunction>();
@Output() onValidityChange: EventEmitter<ToscaFunctionValidationEvent> = new EventEmitter<ToscaFunctionValidationEvent>();
private initToscaFunction(): void {
if (this.compositionMap && this.property.subPropertyToscaFunctions) {
let keyToFind = [this.compositionMapKey];
- let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, keyToFind));
+ if (this.complexListKey != null) {
+ keyToFind = [this.complexListKey,this.compositionMapKey];
+ }
+ let subPropertyToscaFunction;
+ this.property.subPropertyToscaFunctions.forEach(subToscaFunction => {
+ if (subToscaFunction.subPropertyPath.toString() == keyToFind.toString()) {
+ subPropertyToscaFunction = subToscaFunction;
+ }
+ });
if (subPropertyToscaFunction){
this.toscaFunction = subPropertyToscaFunction.toscaFunction;
if (this.isSubProperty()){
if ((this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty)
|| this.compositionMap) {
- if(this.isComplexType(this.property.schemaType) && !this.compositionMap){
+ if(this.isComplexType(this.property.schemaType)){
let mapChildProp : DerivedFEProperty = (<DerivedFEProperty> (<PropertyDeclareAPIModel> this.property).input);
let propertySchemaType = mapChildProp.type;
if (this.property.type == PROPERTY_TYPES.MAP || propertySchemaType == PROPERTY_TYPES.MAP) {
if ((this.property instanceof PropertyDeclareAPIModel && (<PropertyDeclareAPIModel> this.property).input instanceof DerivedFEProperty) || this.compositionMap) {
let childObject : DerivedFEProperty = (<DerivedFEProperty>(<PropertyDeclareAPIModel> this.property).input);
let childSchemaType = (this.property != null && this.property.schemaType != null) ? this.property.schemaType : childObject.type;
- if(this.isComplexType(childSchemaType) && !this.compositionMap){
+ if(this.isComplexType(childSchemaType)){
if (childObject.type == PROPERTY_TYPES.MAP && childObject.isChildOfListOrMap) {
return validPropertyType === PROPERTY_TYPES.STRING;
}