summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes
diff options
context:
space:
mode:
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-11-01 15:07:40 +0200
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-11-01 16:38:30 +0200
commita1ec53caf1953f26d32d01e1819a4b9239140f5b (patch)
tree7c193df75a60b845111c581464b50fb866f532fe /cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes
parent68b7d0df04387b709ed5a403a5a9f240b6dbffba (diff)
adding import inputs and outputs from functions into actions
Issue-ID: CCSDK-2779 Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com> Change-Id: I71ee51c6e641d05bb27cdf1807487e25b656e1cd
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html6
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts61
2 files changed, 63 insertions, 4 deletions
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 d23628bc7..ccf9ce072 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
@@ -19,7 +19,7 @@
<span>Custom Attribute</span>
</div>
<div class="col text-center">
- <button type="button" class="btn btn-secondary"><i class="icon-function-attribute" type="button"
+ <button (click)="printSomethings()" [disabled]="!isFunctionAttributeActive" type="button" class="btn btn-secondary"><i class="icon-function-attribute" type="button"
aria-hidden="true"></i></button>
<span>Function Attribute</span>
</div>
@@ -45,7 +45,7 @@
<label for="exampleFormControlTextarea1">{{input.name}}
<i [hidden]="!input.required" class="icon-required-star" type="button"
aria-hidden="true"></i>
- <i [hidden]="input.required" type="button" aria-hidden="true"></i>
+ <i [hidden]="input.required" class="icon-required-star optional-attribute" type="button" aria-hidden="true"></i>
</label>
<div class="attributeOptions">
<a data-toggle="modal" data-target="#exampleModalScrollable2"
@@ -81,7 +81,7 @@
<label for="exampleFormControlTextarea1">{{output.name}}
<i [hidden]="!output.required" class="icon-required-star" type="button"
aria-hidden="true"></i>
- <i [hidden]="output.required" class="optional-attribute" type="button"
+ <i [hidden]="output.required" class="icon-required-star optional-attribute" type="button"
aria-hidden="true"></i>
</label>
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');
+ }
}