aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts')
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts21
1 files changed, 20 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
index ae778006ce..70df4eaced 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
@@ -18,7 +18,7 @@
*/
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {ComponentMetadata, PropertyBEModel} from 'app/models';
+import {ComponentMetadata, PropertyBEModel, PropertyDeclareAPIModel} from 'app/models';
import {TopologyTemplateService} from "../../../services/component-services/topology-template.service";
import {WorkspaceService} from "../../workspace/workspace.service";
import {ToscaGetFunctionType} from "../../../../models/tosca-get-function-type";
@@ -86,6 +86,21 @@ export class ToscaFunctionComponent implements OnInit {
}
private initToscaFunction() {
+ if (this.property instanceof PropertyDeclareAPIModel && this.property.subPropertyToscaFunctions && (<PropertyDeclareAPIModel> this.property).propertiesName){
+ let propertiesPath = (<PropertyDeclareAPIModel> this.property).propertiesName.split("#");
+ if (propertiesPath.length > 1){
+ propertiesPath = propertiesPath.slice(1);
+ let subPropertyToscaFunction = this.property.subPropertyToscaFunctions.find(subPropertyToscaFunction => this.areEqual(subPropertyToscaFunction.subPropertyPath, propertiesPath));
+
+ if (subPropertyToscaFunction){
+ this.toscaFunction = subPropertyToscaFunction.toscaFunction;
+ this.toscaFunctionForm.setValue(this.toscaFunction);
+ this.toscaFunctionTypeForm.setValue(this.toscaFunction.type);
+ }
+ return;
+ }
+ }
+
if (!this.property.isToscaFunction()) {
return;
}
@@ -93,6 +108,10 @@ export class ToscaFunctionComponent implements OnInit {
this.toscaFunctionTypeForm.setValue(this.property.toscaFunction.type);
}
+ private areEqual(array1: string[], array2: string[]): boolean {
+ return array1.length === array2.length && array1.every(function(value, index) { return value === array2[index]})
+ }
+
private loadToscaFunctions(): void {
this.toscaFunctions.push(ToscaFunctionType.GET_ATTRIBUTE);
this.toscaFunctions.push(ToscaFunctionType.GET_INPUT);