From 4ecc0b9bd5892f80c86cb9415c58213121eb425d Mon Sep 17 00:00:00 2001 From: Ahmedeldeeb50 Date: Sun, 27 Dec 2020 14:50:56 +0200 Subject: [PATCH] Add create script modal in script tab. Issue-ID: CCSDK-3051 Signed-off-by: Ahmedeldeeb50 Change-Id: I34f5e40a9871c003df03028a17f7c2f237c76fca --- .../action-attributes.component.ts | 7 +- .../functions-attribute.component.ts | 9 +- .../scripts-tab/scripts-tab.component.html | 147 +++++++++++++-------- 3 files changed, 102 insertions(+), 61 deletions(-) diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts index 5dd123103..15f2ce456 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts @@ -75,7 +75,6 @@ export class ActionAttributesComponent implements OnInit { this.suggestedOutputs = []; this.suggestedInputs = []; } - this.inputs = []; if (action.inputs) { const namesOfInput = Object.keys(action.inputs); @@ -393,6 +392,12 @@ export class ActionAttributesComponent implements OnInit { this.convertToObject(originalAttributes.substr(0, originalAttributes.length - 1) + newAttributes + '}'); } + const action = this.designerState.template.workflows[this.actionName] as Action; + this.inputs = []; + if (action.inputs) { + const namesOfInput = Object.keys(action.inputs); + this.inputs = this.extractFields(namesOfInput, action.inputs); + } /* console.log(originalAttributes.substr(0, originalAttributes.length - 1) + ',' + newAttributes + '}'); this.designerState.template.workflows[this.actionName][attributeType] = this.convertToObject(originalAttributes.substr(0, originalAttributes.length - 1) diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts index 8780621ea..a86ade0fa 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts @@ -139,7 +139,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { if (inputs) { for (const [key, value] of Object.entries(inputs)) { console.log(key + ' - ' + value); - if (this.isValidJson(value)) { + if (typeof value === 'object' || this.isValidJson(value)) { this.currentFuncion.inputs[key] = JSON.stringify(value); } else { this.currentFuncion.inputs[key] = value; @@ -156,10 +156,13 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { } isValidJson(val) { + console.log(val); try { - JSON.parse(val); + JSON.parse(val + ''); return true; - } catch (e) { } + } catch (e) { + console.log(e); + } return false; } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html index 3a614c95c..a38027ff5 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/scripts-tab/scripts-tab.component.html @@ -9,62 +9,9 @@ -
-
-
-
-
Create Script File
-
-
-
- -
- -
-
- -
- - - -
-
-
-
- - -
-
-
- -
-
-
-
+ +
+ \ No newline at end of file -- 2.16.6