From feaa237cda579079b40f3014634387bf493cc2da Mon Sep 17 00:00:00 2001 From: ShaabanEltanany Date: Sun, 11 Oct 2020 11:32:55 +0200 Subject: adding attributes for inputs and outputs Issue-ID: CCSDK-2874 Signed-off-by: ShaabanEltanany Change-Id: I633a724c7101874ec4db6013762a90bc9daec317 --- .../action-attributes.component.html | 17 ++++++--- .../action-attributes.component.ts | 40 ++++++++++++++++------ .../models/InputActionAttribute.ts | 2 +- 3 files changed, 43 insertions(+), 16 deletions(-) (limited to 'cds-ui/designer-client/src/app') diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html index 7f1c9f35a..ba4fba69a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html @@ -83,10 +83,11 @@
@@ -162,8 +163,12 @@ - + +
@@ -224,8 +229,10 @@ Other
- +
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 f4f74a9fd..8e8b6ad3e 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 @@ -13,6 +13,10 @@ export class ActionAttributesComponent implements OnInit { actionAttributesSideBar: boolean; inputActionAttribute = new InputActionAttribute(); outputActionAttribute = new OutputActionAttribute(); + isInputOtherType: boolean; + isOutputOtherType: boolean; + outputOtherType = ''; + inputOtherType = ''; constructor() { @@ -21,20 +25,23 @@ export class ActionAttributesComponent implements OnInit { ngOnInit() { } - _toggleSidebar2() { - this.actionAttributesSideBar = !this.actionAttributesSideBar; - } - addInput(input: InputActionAttribute) { - this.inputs.push(input); + if (input && input.type && input.name) { + const insertedInputActionAttribute = Object.assign({}, input); + this.inputs.push(insertedInputActionAttribute); + } } addOutput(output: OutputActionAttribute) { - this.outputs.push(output); + if (output && output.type && output.name) { + const insertedOutputActionAttribute = Object.assign({}, output); + this.outputs.push(insertedOutputActionAttribute); + } } - setInputType(type) { + setInputType(type: string) { this.inputActionAttribute.type = type; + this.isInputOtherType = this.checkIfTypeIsOther(type); } setInputRequired(isRequired) { @@ -45,14 +52,27 @@ export class ActionAttributesComponent implements OnInit { this.outputActionAttribute.required = isRequired; } - setOutputType(type) { + setOutputType(type: string) { this.outputActionAttribute.type = type; + this.isOutputOtherType = this.checkIfTypeIsOther(type); + } + + checkIfTypeIsOther(type) { + return type.includes('Other'); } submitAttributes() { console.log(this.inputActionAttribute); console.log(this.outputActionAttribute); - this.inputs.push(this.inputActionAttribute); - this.outputs.push(this.outputActionAttribute); + this.addInput(this.inputActionAttribute); + this.addOutput(this.outputActionAttribute); + this.clearFormInputs(); + } + + private clearFormInputs() { + this.inputActionAttribute = new InputActionAttribute(); + this.outputActionAttribute = new OutputActionAttribute(); + this.outputOtherType = ''; + this.inputOtherType = ''; } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/models/InputActionAttribute.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/models/InputActionAttribute.ts index 3aa370360..b4cce3484 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/models/InputActionAttribute.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/models/InputActionAttribute.ts @@ -8,7 +8,7 @@ export class InputActionAttribute { this.name = ''; this.description = ''; this.type = ''; - this.required = false; + this.required = true; } } -- cgit 1.2.3-korg