summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/interfaceOperation.ts
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-02-09 19:00:35 +0000
committerMichael Morris <michael.morris@est.tech>2022-03-11 15:25:28 +0000
commitf13f58eb867c763e6ed1c3b674fd99b1081a0664 (patch)
treec0ccc70b8fdf4362bce26efa0a5bb1c435f98575 /catalog-ui/src/app/models/interfaceOperation.ts
parent767b122ea026099e17a2ffde30e6718d2abf150f (diff)
Support complex types in interface operation inputs
Issue-ID: SDC-3897 Change-Id: Ieac2d74ad340de1d9f6e4cd3ac830e2ec8c35d5b Signed-off-by: andre.schmid <andre.schmid@est.tech> Signed-off-by: vasraz <vasyl.razinkov@est.tech> Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'catalog-ui/src/app/models/interfaceOperation.ts')
-rw-r--r--catalog-ui/src/app/models/interfaceOperation.ts28
1 files changed, 27 insertions, 1 deletions
diff --git a/catalog-ui/src/app/models/interfaceOperation.ts b/catalog-ui/src/app/models/interfaceOperation.ts
index 109babb068..9d8ab366a2 100644
--- a/catalog-ui/src/app/models/interfaceOperation.ts
+++ b/catalog-ui/src/app/models/interfaceOperation.ts
@@ -20,21 +20,47 @@
'use strict';
import {ArtifactModel} from "./artifacts";
+import {SchemaPropertyGroupModel} from "./schema-property";
+import {PROPERTY_DATA, PROPERTY_TYPES} from "../utils/constants";
export class InputOperationParameter {
name: string;
type: string;
+ schema: SchemaPropertyGroupModel;
inputId: string;
toscaDefaultValue?: string;
+ value?: any;
constructor(param?: any) {
if (param) {
this.name = param.name;
this.type = param.type;
+ this.schema = param.schema;
this.inputId = param.inputId;
this.toscaDefaultValue = param.toscaDefaultValue;
+ this.value = param.value;
+ }
+ }
+
+ public getDefaultValue(): any {
+ if (this.isTypeNotSimple()) {
+ if (this.toscaDefaultValue) {
+ this.toscaDefaultValue = JSON.parse(this.toscaDefaultValue);
+ return JSON.parse(this.toscaDefaultValue);
+ }
+ switch (this.type) {
+ case PROPERTY_TYPES.LIST:
+ return [];
+ default:
+ return {};
+ }
}
- console.info("InputOperationParameter Constructor: ", param)
+
+ return this.toscaDefaultValue;
+ }
+
+ private isTypeNotSimple() {
+ return PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) == -1;
}
}