summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-07-07 17:17:52 +0100
committerMichael Morris <michael.morris@est.tech>2022-07-18 14:22:12 +0000
commit68733163804ed2efed8223a04ab0a7a0714a8b33 (patch)
tree013f4d25042aa776120971a612a52d64db52f7a7 /catalog-ui/src/app/models/properties-inputs/property-be-model.ts
parent4e4ec8e9c21acf7f9210aaebf8f13a60542737fc (diff)
Support for concat TOSCA function
Adds support for the concat TOSCA function in an instance property. Refactors the TOSCA function structure so it can be more generic to support other functions in the future. Change-Id: I338e4138d26afe21779da57c4eeb3f2d486c20a9 Issue-ID: SDC-4095 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-ui/src/app/models/properties-inputs/property-be-model.ts')
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-be-model.ts35
1 files changed, 23 insertions, 12 deletions
diff --git a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
index a5bf3cb7a0..ae7141353b 100644
--- a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
@@ -23,9 +23,10 @@ import {SchemaProperty, SchemaPropertyGroupModel} from '../schema-property';
import {ToscaPresentationData} from '../tosca-presentation';
import {PropertyInputDetail} from './property-input-detail';
import {Metadata} from '../metadata';
-import {ToscaGetFunctionType} from "../tosca-get-function-type";
-import {ToscaGetFunctionDto} from '../tosca-get-function-dto';
-import {PropertySource} from '../property-source';
+import {ToscaFunction} from "../tosca-function";
+import {ToscaGetFunction} from "../tosca-get-function";
+import {ToscaGetFunctionTypeConverter} from "../tosca-get-function-type-converter";
+import {ToscaGetFunctionDto} from "../tosca-get-function-dto";
export enum DerivedPropertyType {
SIMPLE,
@@ -68,9 +69,11 @@ export class PropertyBEModel {
inputPath: string;
toscaPresentation: ToscaPresentationData;
metadata: Metadata;
- //deprecated
- toscaGetFunctionType: ToscaGetFunctionType;
+ /**
+ * @deprecated Use toscaFunction instead
+ */
toscaGetFunction: ToscaGetFunctionDto;
+ toscaFunction: ToscaFunction;
constructor(property?: PropertyBEModel) {
if (property) {
@@ -96,12 +99,20 @@ export class PropertyBEModel {
this.getPolicyValues = property.getPolicyValues;
this.inputPath = property.inputPath;
this.metadata = property.metadata;
- if (property.toscaGetFunction) {
- this.toscaGetFunction = property.toscaGetFunction;
- } else if (property.toscaGetFunctionType) {
- this.toscaGetFunction = new ToscaGetFunctionDto();
- this.toscaGetFunction.functionType = property.toscaGetFunctionType;
- this.toscaGetFunction.propertySource = PropertySource.SELF;
+ if (property.toscaFunction) {
+ this.toscaFunction = property.toscaFunction;
+ } else if (property.toscaGetFunction) {
+ //support for legacy tosca function
+ const toscaGetFunction1 = new ToscaGetFunction();
+ toscaGetFunction1.type = ToscaGetFunctionTypeConverter.convertToToscaFunctionType(property.toscaGetFunction.functionType);
+ toscaGetFunction1.propertyUniqueId = property.toscaGetFunction.propertyUniqueId;
+ toscaGetFunction1.propertyName = property.toscaGetFunction.propertyName;
+ toscaGetFunction1.propertySource = property.toscaGetFunction.propertySource;
+ toscaGetFunction1.sourceUniqueId = property.toscaGetFunction.sourceUniqueId;
+ toscaGetFunction1.sourceName = property.toscaGetFunction.sourceName;
+ toscaGetFunction1.functionType = property.toscaGetFunction.functionType;
+ toscaGetFunction1.propertyPathFromSource = property.toscaGetFunction.propertyPathFromSource;
+ this.toscaFunction = toscaGetFunction1;
}
}
@@ -181,7 +192,7 @@ export class PropertyBEModel {
* Checks whether the property value is a tosca get function (e.g. get_input, get_property, get_attribute)
*/
public isToscaGetFunction(): boolean {
- return this.toscaGetFunction != null;
+ return this.toscaFunction != null;
}
}