From f36e67c64667080c78a1d30f5aace683391d8a14 Mon Sep 17 00:00:00 2001 From: ShaabanEltanany Date: Mon, 12 Oct 2020 15:10:17 +0200 Subject: adding inputs and outputs attributes Issue-ID: CCSDK-2874 Signed-off-by: ShaabanEltanany Change-Id: I2135575105379be9dc464245ea3a74029d541baf --- .../action-attributes.component.ts | 36 +++++++++++++++++++++- .../packages/designer/designer.store.ts | 11 +++++++ 2 files changed, 46 insertions(+), 1 deletion(-) 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 8e8b6ad3e..ee4b19930 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 @@ -1,5 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {InputActionAttribute, OutputActionAttribute} from './models/InputActionAttribute'; +import {DesignerStore} from '../designer.store'; @Component({ selector: 'app-action-attributes', @@ -18,7 +19,7 @@ export class ActionAttributesComponent implements OnInit { outputOtherType = ''; inputOtherType = ''; - constructor() { + constructor(private designerStore: DesignerStore) { } @@ -67,6 +68,9 @@ export class ActionAttributesComponent implements OnInit { this.addInput(this.inputActionAttribute); this.addOutput(this.outputActionAttribute); this.clearFormInputs(); + console.log(this.storeInputs(this.inputs)); + this.designerStore.setInputsToSpecificWorkflow(this.storeInputs(this.inputs)); + console.log(this.storeOutputs(this.outputs)); } private clearFormInputs() { @@ -75,4 +79,34 @@ export class ActionAttributesComponent implements OnInit { this.outputOtherType = ''; this.inputOtherType = ''; } + + private storeInputs(InputActionAttributes: InputActionAttribute[]) { + + let inputs = ''; + InputActionAttributes.forEach(input => { + inputs += this.appendAttributes(input); + + }); + const returnedInputMap = new Map(); + returnedInputMap.set('inputs', inputs); + return returnedInputMap; + } + + private storeOutputs(OutputActionAttributes: OutputActionAttribute[]) { + let outputs = ''; + OutputActionAttributes.forEach(output => { + outputs += this.appendAttributes(output); + }); + const returnedOutputMap = new Map(); + returnedOutputMap.set('outputs', outputs); + return returnedOutputMap; + } + + private appendAttributes(output: OutputActionAttribute) { + return '"' + output.name + '":{\n' + + ' \'required\': ' + output.required + ',\n' + + ' \'type\': "' + output.type + '",\n' + + ' \'description\': "' + output.description + '"\n' + + ' }' + '\n'; + } } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts index e07fbb94d..923d59e91 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts @@ -145,6 +145,17 @@ export class DesignerStore extends Store { }); } + setInputsToSpecificWorkflow(inputs: Map) { + const mapOfWorkflows = this.state.template.workflows; + /*mapOfWorkflows.forEach(((value, key) => { + if (value.includes('resource-assignment')) { + value += inputs; + } + }));*/ + console.log('the new workflows'); + console.log(mapOfWorkflows); + } + clear() { this.setState(new DesignerDashboardState()); } -- cgit 1.2.3-korg