diff options
author | Eltanany Shaaban <shaaban.eltanany.ext@orange.com> | 2020-11-22 12:57:00 +0200 |
---|---|---|
committer | Eltanany Shaaban <shaaban.eltanany.ext@orange.com> | 2020-11-22 12:57:00 +0200 |
commit | 36db9a541fc469cd59649729243471cf7a8aef3e (patch) | |
tree | affd4929e3af500a86c242b199f0636dcebd2da7 /cds-ui | |
parent | cd4d989d174b6992742de5682fb8a36d9a9ea35a (diff) |
adding entry schema for list type
Issue-ID: CCSDK-2975
Signed-off-by: Eltanany Shaaban <shaaban.eltanany.ext@orange.com>
Change-Id: Ic2b7c8955ac7621f6064bb0d63ee9796433edb24
Diffstat (limited to 'cds-ui')
2 files changed, 36 insertions, 19 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 013fa8af9..23adaef46 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 @@ -149,17 +149,17 @@ <div class="col-sm-9"> <div class="list-group list-group-horizontal"> <button type="button" class="list-group-item list-group-item-action" - (click)="setInputType('String')"> + (click)="setInputType('string')"> String </button> <button type="button" class="list-group-item list-group-item-action" - (click)="setInputType('Integer')">Integer + (click)="setInputType('integer')">Integer </button> <button type="button" class="list-group-item list-group-item-action" - (click)="setInputType('Boolean')">Boolean + (click)="setInputType('boolean')">Boolean </button> <button type="button" class="list-group-item list-group-item-action" - (click)="setInputType('List')">List + (click)="setInputType('list')">List </button> <button type="button" class="list-group-item list-group-item-action" (click)="setInputType('Other')">Other @@ -225,18 +225,18 @@ <div class="col-sm-9"> <div class="list-group list-group-horizontal"> <button type="button" class="list-group-item list-group-item-action" - (click)="setOutputType('String')">String + (click)="setOutputType('string')">String </button> <button type="button" class="list-group-item list-group-item-action" - (click)="setOutputType('Integer')"> + (click)="setOutputType('integer')"> Integer </button> <button type="button" class="list-group-item list-group-item-action" - (click)="setOutputType('Boolean')"> + (click)="setOutputType('boolean')"> Boolean </button> <button type="button" class="list-group-item list-group-item-action" - (click)="setOutputType('List')"> + (click)="setOutputType('list')"> List </button> <button type="button" class="list-group-item list-group-item-action" 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 668aff9b5..95b53fb01 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 @@ -114,6 +114,7 @@ export class ActionAttributesComponent implements OnInit { } addInput(input: InputActionAttribute) { + console.log(input); if (input && input.type && input.name) { const insertedInputActionAttribute = Object.assign({}, input); this.newInputs.push(insertedInputActionAttribute); @@ -224,11 +225,21 @@ export class ActionAttributesComponent implements OnInit { } private appendAttributes(inputActionAttribute: InputActionAttribute) { - return '"' + inputActionAttribute.name + '" : {\n' + + const entrySchema: string = this.getEntrySchema(inputActionAttribute); + const input = '"' + inputActionAttribute.name + '" : {\n' + ' "required" : ' + inputActionAttribute.required + ',\n' + ' "type" : "' + inputActionAttribute.type + '",\n' + - ' "description" : "' + inputActionAttribute.description + '"\n' + - ' },'; + ' "description" : "' + inputActionAttribute.description + '"'; + return input + entrySchema; + } + + private getEntrySchema(inputActionAttribute: InputActionAttribute) { + return inputActionAttribute.type.includes('list') ? + ',\n\t' + '"entry_schema" : {\n' + + ' "type" : "string"\n' + + ' }\n},' + : + '\n },'; } setInputAndOutputs(targetName) { @@ -436,15 +447,17 @@ export class ActionAttributesComponent implements OnInit { } - private appendOutputAttributes(output: OutputActionAttribute) { - return '"' + output.name + '" : {\n' + - ' "required" : ' + output.required + ',\n' + - ' "type" : "' + output.type + '",\n' + - ' "description" : "' + output.description + '",\n' + + private appendOutputAttributes(outputActionAttribute: OutputActionAttribute) { + const entrySchema: string = this.getEntrySchema(outputActionAttribute); + const output = '"' + outputActionAttribute.name + '" : {\n' + + ' "required" : ' + outputActionAttribute.required + ',\n' + + ' "type" : "' + outputActionAttribute.type + '",\n' + + ' "description" : "' + outputActionAttribute.description + '",\n' + ' "value\" :' + '{\n' + - ' "get_attribute" : ' + output.value + '\n' + - ' }\n' + - ' },'; + ' "get_attribute" : ' + outputActionAttribute.value + '\n' + + ' }\n'; + + return output + entrySchema; } @@ -485,4 +498,8 @@ export class ActionAttributesComponent implements OnInit { this.designerState.template.workflows[this.actionName][attributeType] = {}; } } + + private checkIfTypeIsList(type: string) { + return type.includes('list'); + } } |