aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-03-31 14:42:07 +0100
committerJEFF VAN DAM <jeff.van.dam@est.tech>2023-04-13 15:35:54 +0000
commitb6c9ed78e512e2d96f1725ca3748a5f02b31e7df (patch)
tree9723706e738bb041f339810cc233e2307d0c9018 /catalog-ui/src/app/ng2/pages/properties-assignment/tosca-function/tosca-function.component.ts
parentb06691c5ed1fb02760a6440383dd40ec4894a9e5 (diff)
UI support for custom functions
Issue-ID: SDC-4466 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I8ff794be8783dc31efecbd1f6abe2efefec6b819
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);
}