diff options
author | 2020-11-02 02:27:18 +0000 | |
---|---|---|
committer | 2020-11-02 02:27:18 +0000 | |
commit | 5cde17a4286c827f650811516e40936c7127c1d9 (patch) | |
tree | 247bd7c2b2720e85959c0df8ae694bfbd30cbae9 /cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts | |
parent | 1bd149f476f2a8780f8f9e16e9aa3c8d7139adda (diff) | |
parent | a1ec53caf1953f26d32d01e1819a4b9239140f5b (diff) |
Merge "adding import inputs and outputs from functions into actions"
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts | 61 |
1 files changed, 60 insertions, 1 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 752f0502d..a99ca02ef 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 @@ -3,6 +3,8 @@ import {InputActionAttribute, OutputActionAttribute} from './models/InputActionA import {DesignerStore} from '../designer.store'; import {DesignerDashboardState} from '../model/designer.dashboard.state'; import {Action} from './models/Action'; +import {FunctionsStore} from '../functions.store'; +import {FunctionsState} from '../model/functions.state'; @Component({ selector: 'app-action-attributes', @@ -22,8 +24,10 @@ export class ActionAttributesComponent implements OnInit { inputOtherType = ''; actionName = ''; designerState: DesignerDashboardState; + isFunctionAttributeActive = false; + functions: FunctionsState; - constructor(private designerStore: DesignerStore) { + constructor(private designerStore: DesignerStore, private functionsStore: FunctionsStore) { } @@ -33,6 +37,20 @@ export class ActionAttributesComponent implements OnInit { if (this.designerState && this.designerState.actionName) { this.actionName = this.designerState.actionName; const action = this.designerState.template.workflows[this.actionName] as Action; + if (action.steps) { + const steps = Object.keys(action.steps); + if (steps && steps.length > 0) { + this.isFunctionAttributeActive = true; + } else { + this.isFunctionAttributeActive = false; + } + steps.forEach(step => { + const target = action.steps[step].target; + this.getInputs(target); + }); + } + + this.inputs = []; if (action.inputs) { const namesOfInput = Object.keys(action.inputs); @@ -45,6 +63,10 @@ export class ActionAttributesComponent implements OnInit { } } }); + + this.functionsStore.state$.subscribe(functions => { + this.functions = functions; + }); } @@ -144,4 +166,41 @@ export class ActionAttributesComponent implements OnInit { ' "description" : "' + output.description + '"\n' + ' },'; } + + getInputs(targetName) { + const nodeTemplate = this.designerState.template.node_templates[targetName]; + /* tslint:disable:no-string-literal */ + console.log(nodeTemplate['type']); + this.functions.serverFunctions + /* tslint:disable:no-string-literal */ + .filter(currentFunction => currentFunction.modelName.includes(nodeTemplate['type'])) + .forEach(currentFunction => { + console.log(currentFunction); + /* tslint:disable:no-string-literal */ + if (currentFunction['definition'] && currentFunction['definition']['interfaces']) { + const interfaces = Object.keys(currentFunction['definition']['interfaces']); + if (interfaces && interfaces.length > 0) { + const interfaceName = interfaces[0]; + if (nodeTemplate['interfaces'][interfaceName]['operations'] && + nodeTemplate['interfaces'][interfaceName]['operations']['process'] + ) { + if (nodeTemplate['interfaces'][interfaceName]['operations']['process']['inputs']) { + /* tslint:disable:no-string-literal */ + console.log(Object.keys(nodeTemplate['interfaces'][interfaceName]['operations']['process']['inputs'])); + } + if (nodeTemplate['interfaces'][interfaceName]['operations']['process']['outputs']) { + /* tslint:disable:no-string-literal */ + console.log(Object.keys(nodeTemplate['interfaces'][interfaceName]['operations']['process']['outputs'])); + } + + } + } + } + }); + console.log(nodeTemplate); + } + + printSomethings() { + console.log('something'); + } } |