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.ts20
1 files changed, 19 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 d46ac2eb10..6783f5b13c 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
@@ -29,9 +29,11 @@ import {ToscaFunctionType} from "../../../../models/tosca-function-type.enum";
import {ToscaGetFunctionValidationEvent} from "./tosca-get-function/tosca-get-function.component";
import {ToscaFunction} from "../../../../models/tosca-function";
import {ToscaConcatFunctionValidationEvent} from "./tosca-concat-function/tosca-concat-function.component";
+import {ToscaCustomFunctionValidationEvent} from "./tosca-custom-function/tosca-custom-function.component";
import {PROPERTY_TYPES, PROPERTY_DATA} from "../../../../utils/constants";
import {YamlFunctionValidationEvent} from "./yaml-function/yaml-function.component";
import {ToscaConcatFunction} from "../../../../models/tosca-concat-function";
+import {ToscaCustomFunction} from "../../../../models/tosca-custom-function";
import {YamlFunction} from "../../../../models/yaml-function";
@Component({
@@ -142,7 +144,8 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
this.toscaFunctions.push(ToscaFunctionType.GET_ATTRIBUTE);
this.toscaFunctions.push(ToscaFunctionType.GET_INPUT);
this.toscaFunctions.push(ToscaFunctionType.GET_PROPERTY);
- if (this.property.type === PROPERTY_TYPES.STRING) {
+ this.toscaFunctions.push(ToscaFunctionType.CUSTOM);
+ if (this.property.type === PROPERTY_TYPES.STRING || this.property.type === PROPERTY_TYPES.ANY) {
this.toscaFunctions.push(ToscaFunctionType.CONCAT);
}
this.toscaFunctions.push(ToscaFunctionType.YAML);
@@ -169,6 +172,10 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
return this.formGroup.get('toscaFunctionType').value === ToscaFunctionType.CONCAT;
}
+ isCustomSelected(): boolean {
+ return this.formGroup.get('toscaFunctionType').value === ToscaFunctionType.CUSTOM;
+ }
+
isGetFunctionSelected(): boolean {
return this.isGetInputSelected() || this.isGetPropertySelected() || this.isGetAttributeSelected();
}
@@ -193,6 +200,14 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
}
}
+ onCustomFunctionValidityChange(validationEvent: ToscaCustomFunctionValidationEvent): void {
+ if (validationEvent.isValid) {
+ this.toscaFunctionForm.setValue(validationEvent.toscaCustomFunction);
+ } else {
+ this.toscaFunctionForm.setValue(undefined);
+ }
+ }
+
onGetFunctionValidityChange(validationEvent: ToscaGetFunctionValidationEvent): void {
if (validationEvent.isValid) {
this.toscaFunctionForm.setValue(validationEvent.toscaGetFunction);
@@ -229,6 +244,9 @@ export class ToscaFunctionComponent implements OnInit, OnChanges {
if (this.isConcatSelected()) {
return new ToscaConcatFunction(this.toscaFunctionForm.value);
}
+ if (this.isCustomSelected()) {
+ return new ToscaCustomFunction(this.toscaFunctionForm.value);
+ }
if (this.isGetFunctionSelected()) {
return new ToscaGetFunction(this.toscaFunctionForm.value);
}