diff options
Diffstat (limited to 'cds-ui')
2 files changed, 215 insertions, 109 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 ff097111a..65703ee2c 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 @@ -14,13 +14,13 @@ <div class="row"> <div class="col pr-0 text-center"> <button type="button" data-toggle="modal" data-target="#exampleModalScrollable" - class="btn btn-secondary"><i class="icon-custom-attribute" type="button" - aria-hidden="true"></i></button> + class="btn btn-secondary"><i class="icon-custom-attribute" type="button" + aria-hidden="true"></i></button> <span>Custom Attribute</span> </div> <div class="col text-center"> <button (click)="printSomethings()" [disabled]="!isFunctionAttributeActive" type="button" - data-toggle="modal" data-target="#exampleModalScrollable3" class="btn btn-secondary"><i + data-toggle="modal" data-target="#exampleModalScrollable3" class="btn btn-secondary"><i class="icon-function-attribute" type="button" aria-hidden="true"></i></button> <span>Function Attribute</span> </div> @@ -33,7 +33,7 @@ <div class="card-header" id="headingOne"> <h2 class="mb-0"> <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" - aria-expanded="true" aria-controls="collapseOne"> + aria-expanded="true" aria-controls="collapseOne"> Inputs </button> </h2> @@ -45,16 +45,16 @@ <div class="form-group" *ngFor="let input of inputs"> <label for="exampleFormControlTextarea1">{{input.name}} <i [hidden]="!input.required" class="icon-required-star" type="button" - aria-hidden="true"></i> + aria-hidden="true"></i> <i [hidden]="input.required" class="icon-required-star optional-attribute" - type="button" aria-hidden="true"></i> + type="button" aria-hidden="true"></i> </label> <div class="attributeOptions"> <a data-toggle="modal" data-target="#exampleModalScrollable2" - class="accordion-delete editAttribute" tooltip="Edit Attribute" - placement="bottom"><i class="icon-edit"></i></a> + class="accordion-delete editAttribute" tooltip="Edit Attribute" + placement="bottom"><i class="icon-edit"></i></a> <a class="accordion-delete deleteAttribute" tooltip="Delete Attribute" - placement="bottom"><i class="icon-delete-sm"></i></a> + placement="bottom"><i class="icon-delete-sm"></i></a> </div> </div> </div> @@ -69,7 +69,7 @@ <div class="card-header" id="headingOne"> <h2 class="mb-0"> <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseTwo" - aria-expanded="true" aria-controls="collapseTwo"> + aria-expanded="true" aria-controls="collapseTwo"> Outputs </button> </h2> @@ -82,9 +82,9 @@ <div class="form-group" *ngFor="let output of outputs"> <label for="exampleFormControlTextarea1">{{output.name}} <i [hidden]="!output.required" class="icon-required-star" type="button" - aria-hidden="true"></i> + aria-hidden="true"></i> <i [hidden]="output.required" class="icon-required-star optional-attribute" - type="button" aria-hidden="true"></i> + type="button" aria-hidden="true"></i> </label> </div> @@ -97,14 +97,14 @@ </div> <!--Action - Add Custom Attribute - Modal--> <div class="modal fade" id="exampleModalScrollable" tabindex="-1" role="dialog" - aria-labelledby="exampleModalScrollableTitle" aria-hidden="true"> + aria-labelledby="exampleModalScrollableTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-scrollable" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalScrollableTitle"> Add Custom Attributes</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> - <img src="assets/img/icon-close.svg" /> + <img src="assets/img/icon-close.svg"/> </button> </div> <div class="modal-body createAttributeTabs"> @@ -112,29 +112,29 @@ <ul class="nav nav-tabs" id="myTab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" - aria-controls="home" aria-selected="true">Inputs</a> + aria-controls="home" aria-selected="true">Inputs</a> </li> <li class="nav-item"> <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" - aria-controls="profile" aria-selected="false">Outputs</a> + aria-controls="profile" aria-selected="false">Outputs</a> </li> </ul> <div class="tab-content" id="myTabContent"> <!--INPUTS Tab--> <div class="tab-pane fade show active create-form" id="home" role="tabpanel" - aria-labelledby="home-tab"> + aria-labelledby="home-tab"> <div class="form-group row"> <label for="inputEmail3" class="col-sm-3 col-form-label">Name <span>*</span></label> <div class="col-sm-9"> <input [(ngModel)]="inputActionAttribute.name" type="email" class="form-control" - id="inputEmail3" placeholder="Attribute name"> + id="inputEmail3" placeholder="Attribute name"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-3 col-form-label">Description</label> <div class="col-sm-9"> <input [(ngModel)]="inputActionAttribute.description" type="text" class="form-control" - id="inputPassword3" placeholder="Add some description"> + id="inputPassword3" placeholder="Add some description"> </div> </div> <div class="form-group row"> @@ -142,25 +142,26 @@ <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 + (click)="setInputType('Other')">Other </button> </div> <input [hidden]="!isInputOtherType" type="text" class="form-control mt-2 mb-2" - id="inputPassword4" placeholder="Add Other type name" [(ngModel)]="inputOtherType" - (change)="setInputType(inputOtherType)"> + id="inputPassword4" placeholder="Add Other type name" + [(ngModel)]="inputOtherType" + (change)="setInputType(inputOtherType)"> </div> </div> @@ -169,12 +170,12 @@ <div class="col-sm-9"> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInline1" name="customRadioInline1" - class="custom-control-input" (click)="setInputRequired(true)"> + class="custom-control-input" (click)="setInputRequired(true)"> <label class="custom-control-label" for="customRadioInline1">True</label> </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInline2" name="customRadioInline1" - class="custom-control-input" (click)="setInputRequired(false)"> + class="custom-control-input" (click)="setInputRequired(false)"> <label class="custom-control-label" for="customRadioInline2">False</label> </div> </div> @@ -186,14 +187,14 @@ <label for="inputEmail3" class="col-sm-3 col-form-label">Name <span>*</span></label> <div class="col-sm-9"> <input [(ngModel)]="outputActionAttribute.name" type="email" class="form-control" - id="inputEmail3" placeholder="Attribute name"> + id="inputEmail3" placeholder="Attribute name"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-3 col-form-label">Description</label> <div class="col-sm-9"> <input [(ngModel)]="outputActionAttribute.description" type="text" class="form-control" - id="inputPassword3" placeholder="Add some description"> + id="inputPassword3" placeholder="Add some description"> </div> </div> <div class="form-group row"> @@ -201,28 +202,29 @@ <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" - (click)="setOutputType('Other')"> + (click)="setOutputType('Other')"> Other </button> </div> <input [hidden]="!isOutputOtherType" type="text" class="form-control mt-2 mb-2" - id="inputPassword3" placeholder="Add Other type name" [(ngModel)]="outputOtherType" - (change)="setOutputType(outputOtherType)"> + id="inputPassword3" placeholder="Add Other type name" + [(ngModel)]="outputOtherType" + (change)="setOutputType(outputOtherType)"> </div> </div> <div class="form-group row"> @@ -230,14 +232,14 @@ <div class="col-sm-9"> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInline3" name="customRadioInline3" - class="custom-control-input" (click)="setOutputRequired(true)"> + class="custom-control-input" (click)="setOutputRequired(true)"> <label class="custom-control-label" for="customRadioInline3">True</label> </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInline4" name="customRadioInline3" - class="custom-control-input"> + class="custom-control-input"> <label class="custom-control-label" for="customRadioInline4" - (click)="setOutputRequired(false)">False</label> + (click)="setOutputRequired(false)">False</label> </div> </div> </div> @@ -254,35 +256,38 @@ <!--Action - Add Attribute From Function - Modal--> <div class="modal fade" id="exampleModalScrollable3" tabindex="-1" role="dialog" - aria-labelledby="exampleModalScrollableTitle3" aria-hidden="true"> + aria-labelledby="exampleModalScrollableTitle3" aria-hidden="true"> <div class="modal-dialog modal-dialog-scrollable" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalScrollableTitle3"> Add Attributes from Function</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> - <img src="assets/img/icon-close.svg" /> + <img src="assets/img/icon-close.svg"/> </button> </div> <div class="modal-body createAttributeTabs"> <!--Action - Inputs & Outputs Attribute--> <ul class="nav nav-tabs" id="myTab" role="tablist"> <li class="nav-item"> - <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" - aria-controls="home" aria-selected="true">Inputs</a> + <a class="nav-link active" id="home-tab" data-toggle="tab" href="#input" role="tab" + aria-controls="home" aria-selected="true">Inputs</a> </li> <li class="nav-item"> - <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" - aria-controls="profile" aria-selected="false">Outputs</a> + <a class="nav-link" id="profile-tab" data-toggle="tab" href="#output" role="tab" + aria-controls="profile" aria-selected="false">Outputs</a> </li> </ul> <div class="tab-content border-0 mt-2" id="myTabContent"> <!--INPUTS Tab--> - <div class="tab-pane fade show active create-form" id="home" role="tabpanel" - aria-labelledby="home-tab"> + <div class="tab-pane fade show active create-form" id="input" role="tabpanel" + aria-labelledby="input-tab"> <div class="form-group row"> <div class="col"> <input type="email" class="form-control" id="inputEmail3" placeholder="Attributes"> + <div class="container"> + <div *ngFor="let tempInput of tempInputs">{{tempInput}}</div> + </div> </div> </div> @@ -291,17 +296,14 @@ <b class="listBoxTitle">1. Choose Function Name</b> <div class="list-group addedFunctionsList" id="list-tab" role="tablist"> <input type="text" class="form-control input-search-controller" - placeholder="Functions"> - <div class="scrollWrapper"> + placeholder="Functions"> + <div class="scrollWrapper" *ngFor="let step of steps"> <a class="list-group-item list-group-item-action active" id="list-home-list" - data-toggle="list" href="#list-home" role="tab" aria-controls="home"><i + data-toggle="list" href="#list-home" role="tab" aria-controls="home"><i class="icon-resource_resolution mr-1" aria-hidden="true"></i> - resource-assignment <i class="icon-next_arrow" aria-hidden="true"></i></a> - <a class="list-group-item list-group-item-action" id="list-profile-list" - data-toggle="list" href="#list-profile" role="tab" - aria-controls="profile"><i class="icon-netconf_executer mr-1" - aria-hidden="true"></i> netconf-device <i class="icon-next_arrow" - aria-hidden="true"></i></a> + {{step}} <i class="icon-next_arrow" aria-hidden="true" (click)="setInputAndOutputs( + this.designerState.template.workflows[actionName]['steps'][step]['target'] + )"></i></a> </div> </div> </div> @@ -309,57 +311,84 @@ <b class="listBoxTitle">2. Choose Input Attribute Name</b> <div class="tab-content nestedAttributes mt-0 p-0" id="nav-tabContent"> <input type="text" class="form-control input-search-controller" - placeholder="Attributes"> + placeholder="Attributes"> <div class="tab-pane fade show active" id="list-home" role="tabpanel" - aria-labelledby="list-home-list"> + aria-labelledby="list-home-list"> <div class="scrollWrapper"> - <div class="btn-group btn-group-toggle" data-toggle="buttons"> - <label class="btn btn-secondary active"> - <input type="radio" name="options" id="option1" autocomplete="off" - checked> resolution-key - </label> - <label class="btn btn-secondary"> - <input type="radio" name="options" id="option2" autocomplete="off"> - occurrence - </label> - <label class="btn btn-secondary"> - <input type="radio" name="options" id="option3" autocomplete="off"> - store-result - </label> - <label class="btn btn-secondary"> - <input type="radio" name="options" id="option4" autocomplete="off"> - resource-type - </label> - <label class="btn btn-secondary"> - <input type="radio" name="options" id="option5" autocomplete="off"> - resolution-summary - </label> - <label class="btn btn-secondary"> - <input type="radio" name="options" id="option6" autocomplete="off"> - artifact-prefix-names - </label> - <label class="btn btn-secondary"> - <input type="radio" name="options" id="option7" autocomplete="off"> - request-id + <div *ngIf="suggestedInputs.length>0" class="btn-group btn-group-toggle" + data-toggle="buttons"> + <label class="btn btn-secondary active" + *ngFor="let suggestedInput of suggestedInputs" (click)="addTempInput(suggestedInput)"> + <input type="radio" name="options" [id]="suggestedInput" + autocomplete="off" + (click)="addTempInput(suggestedInput)"> {{suggestedInput}} </label> </div> + <div *ngIf="suggestedInputs.length == 0">you don't have data</div> </div> </div> - <div class="tab-pane fade" id="list-profile" role="tabpanel" - aria-labelledby="list-profile-list">2</div> </div> </div> </div> </div> <!--OUTPUTS Tab--> - <div class="tab-pane fade create-form" id="profile" role="tabpanel" aria-labelledby="profile-tab"> -d + <div class="tab-pane fade create-form" id="output" role="tabpanel" aria-labelledby="output-tab"> + <div class="form-group row"> + <div class="col"> + <input type="email" class="form-control" id="inputEmail3" placeholder="Attributes"> + <div class="container"> + <div *ngFor="let tempOutput of tempOutputs">{{tempOutput}}</div> + </div> + </div> + </div> + + <div class="row"> + <div class="col-6"> + <b class="listBoxTitle">1. Choose Function Name</b> + <div class="list-group addedFunctionsList" id="list-tab" role="tablist"> + <input type="text" class="form-control input-search-controller" + placeholder="Functions"> + <div class="scrollWrapper" *ngFor="let step of steps"> + <a class="list-group-item list-group-item-action active" id="list-home-list" + data-toggle="list" href="#list-home" role="tab" aria-controls="home"><i + class="icon-resource_resolution mr-1" aria-hidden="true"></i> + {{step}} <i class="icon-next_arrow" aria-hidden="true" + (click)="setInputAndOutputs( + this.designerState.template.workflows[actionName]['steps'][step]['target'] + )"></i></a> + </div> + </div> + </div> + <div class="col-6"> + <b class="listBoxTitle">2. Choose output Attribute Name</b> + <div class="tab-content nestedAttributes mt-0 p-0" id="nav-tabContent"> + <input type="text" class="form-control input-search-controller" + placeholder="Attributes"> + <div class="tab-pane fade show active" id="list-home" role="tabpanel" + aria-labelledby="list-home-list"> + <div class="scrollWrapper"> + <div *ngIf="suggestedOutputs.length > 0" class="btn-group btn-group-toggle" + data-toggle="buttons"> + <label class="btn btn-secondary active" + *ngFor="let suggestedOutput of suggestedOutputs"> + <input type="radio" name="options" [id]="suggestedOutput" + autocomplete="off" + (dblclick)="addTempOutput(suggestedOutput)"> {{suggestedOutput}} + </label> + + </div> + <div *ngIf="suggestedOutputs.length == 0">you don't have data</div> + </div> + </div> + </div> + </div> + </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-primary" (click)="submitAttributes()">Submit Attributes</button> + <button type="button" class="btn btn-primary" (click)="submitTempAttributes()">Submit Attributes</button> </div> </div> </div> @@ -367,14 +396,14 @@ d <!--Delete Action - Modal--> <div class="modal fade" id="exampleModalScrollable1" tabindex="-1" role="dialog" - aria-labelledby="exampleModalScrollableTitle1" aria-hidden="true"> + aria-labelledby="exampleModalScrollableTitle1" aria-hidden="true"> <div class="modal-dialog modal-dialog-scrollable" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalScrollableTitle1"> Delete Action</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> - <img src="assets/img/icon-close.svg" /> + <img src="assets/img/icon-close.svg"/> </button> </div> <div class="modal-body"> @@ -389,14 +418,14 @@ d </div> <!--Action - Edit Custom Attribute - Modal--> <div class="modal fade" id="exampleModalScrollable2" tabindex="-1" role="dialog" - aria-labelledby="exampleModalScrollableTitle2" aria-hidden="true"> + aria-labelledby="exampleModalScrollableTitle2" aria-hidden="true"> <div class="modal-dialog modal-dialog-scrollable" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalScrollableTitle2"> Edit Custom Attributes</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> - <img src="assets/img/icon-close.svg" /> + <img src="assets/img/icon-close.svg"/> </button> </div> <div class="modal-body createAttributeTabs"> @@ -405,15 +434,15 @@ d <label for="inputEmail3" class="col-sm-3 col-form-label">Name <span>*</span></label> <div class="col-sm-9"> <input type="email" class="form-control" id="inputEmail3" placeholder="Attribute name" - value="resource-assignment-properties"> + value="resource-assignment-properties"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-3 col-form-label">Description</label> <div class="col-sm-9"> <input type="text" class="form-control" id="inputPassword3" - placeholder="Add some description" - value="Dynamic PropertyDefinition for workflow(resource-assignment)."> + placeholder="Add some description" + value="Dynamic PropertyDefinition for workflow(resource-assignment)."> </div> </div> <div class="form-group row"> @@ -429,7 +458,7 @@ d </button> </div> <input type="text" class="form-control mt-2 mb-2" id="inputPassword3" - placeholder="Add Other type name" value="dt-resource-assignment-properties"> + placeholder="Add Other type name" value="dt-resource-assignment-properties"> </div> </div> <div class="form-group row"> @@ -437,12 +466,12 @@ d <div class="col-sm-9"> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInline1" name="customRadioInline1" - class="custom-control-input" checked> + class="custom-control-input" checked> <label class="custom-control-label" for="customRadioInline1">True</label> </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="customRadioInline2" name="customRadioInline1" - class="custom-control-input"> + class="custom-control-input"> <label class="custom-control-label" for="customRadioInline2">False</label> </div> </div> @@ -455,4 +484,4 @@ d </div> </div> </div> -</div>
\ No newline at end of file +</div> 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 a99ca02ef..11429ead6 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 @@ -26,6 +26,13 @@ export class ActionAttributesComponent implements OnInit { designerState: DesignerDashboardState; isFunctionAttributeActive = false; functions: FunctionsState; + steps: string[]; + suggestedInputs: string[] = []; + suggestedOutputs: string[] = []; + + tempInputs: string[] = []; + tempOutputs: string[] = []; + currentInterfaceName: string; constructor(private designerStore: DesignerStore, private functionsStore: FunctionsStore) { @@ -44,10 +51,13 @@ export class ActionAttributesComponent implements OnInit { } else { this.isFunctionAttributeActive = false; } - steps.forEach(step => { + this.steps = steps; + this.suggestedOutputs = []; + this.suggestedInputs = []; + /*steps.forEach(step => { const target = action.steps[step].target; this.getInputs(target); - }); + });*/ } @@ -92,6 +102,7 @@ export class ActionAttributesComponent implements OnInit { } addOutput(output: OutputActionAttribute) { + console.log(output); if (output && output.type && output.name) { const insertedOutputActionAttribute = Object.assign({}, output); this.outputs.push(insertedOutputActionAttribute); @@ -167,8 +178,11 @@ export class ActionAttributesComponent implements OnInit { ' },'; } - getInputs(targetName) { + setInputAndOutputs(targetName) { + console.log(targetName); const nodeTemplate = this.designerState.template.node_templates[targetName]; + console.log(this.designerState.template.node_templates); + console.log(nodeTemplate); /* tslint:disable:no-string-literal */ console.log(nodeTemplate['type']); this.functions.serverFunctions @@ -181,16 +195,25 @@ export class ActionAttributesComponent implements OnInit { const interfaces = Object.keys(currentFunction['definition']['interfaces']); if (interfaces && interfaces.length > 0) { const interfaceName = interfaces[0]; - if (nodeTemplate['interfaces'][interfaceName]['operations'] && + console.log(interfaceName); + this.currentInterfaceName = interfaceName; + + if (nodeTemplate['interfaces'] && + nodeTemplate['interfaces'][interfaceName]['operations'] && nodeTemplate['interfaces'][interfaceName]['operations']['process'] ) { + console.log('here'); if (nodeTemplate['interfaces'][interfaceName]['operations']['process']['inputs']) { /* tslint:disable:no-string-literal */ - console.log(Object.keys(nodeTemplate['interfaces'][interfaceName]['operations']['process']['inputs'])); + this.suggestedInputs = Object.keys(nodeTemplate['interfaces'] + [interfaceName]['operations']['process']['inputs']); + console.log(this.suggestedInputs); } if (nodeTemplate['interfaces'][interfaceName]['operations']['process']['outputs']) { /* tslint:disable:no-string-literal */ - console.log(Object.keys(nodeTemplate['interfaces'][interfaceName]['operations']['process']['outputs'])); + this.suggestedOutputs = Object.keys(nodeTemplate['interfaces'] + [interfaceName]['operations']['process']['outputs']); + console.log(this.suggestedInputs); } } @@ -203,4 +226,58 @@ export class ActionAttributesComponent implements OnInit { printSomethings() { console.log('something'); } + + addTempInput(suggestedInput: string) { + this.addAttribute(this.tempInputs, suggestedInput); + this.deleteAttribute(this.suggestedInputs, suggestedInput); + } + + addTempOutput(suggestedOutput: string) { + this.addAttribute(this.tempOutputs, suggestedOutput); + this.deleteAttribute(this.suggestedOutputs, suggestedOutput); + } + + deleteAttribute(container: string[], suggestedAttribute: string) { + if (container && suggestedAttribute && container.includes(suggestedAttribute)) { + const index: number = container.indexOf(suggestedAttribute); + if (index !== -1) { + container.splice(index, 1); + } + } + } + + addAttribute(container: string[], suggestedAttribute: string) { + if (container && suggestedAttribute && !container.includes(suggestedAttribute)) { + container.push(suggestedAttribute); + } + } + + + submitTempAttributes() { + if (this.tempInputs && this.tempInputs.length > 0) { + let newInputs = ''; + this.tempInputs.forEach(tempAttribute => { + const currentInputNode: string = this.designerState.template.node_templates[this.actionName]['interfaces'] + [this.currentInterfaceName]['operations']['process']['inputs'][tempAttribute]; + const currentInputNodeAsString = JSON.stringify(currentInputNode); + newInputs += '"' + tempAttribute + '": ' + currentInputNodeAsString + ','; + + }); + if (newInputs.endsWith(',')) { + newInputs = newInputs.substr(0, newInputs.length - 1); + } + const originalInputs = JSON.stringify(this.designerState.template.workflows[this.actionName]['inputs']); + console.log(originalInputs.substr(0, originalInputs.length - 1) + ',' + newInputs + '}'); + this.designerState.template.workflows[this.actionName]['inputs'] = + JSON.parse(originalInputs.substr(0, originalInputs.length - 1) + ',' + newInputs + '}'); + } + + if (this.tempOutputs && this.tempOutputs.length > 0) { + this.tempOutputs.forEach(tempAttribute => { + const currentOutputNode = this.designerState.template.node_templates[this.actionName]['interfaces'] + [this.currentInterfaceName]['operations']['process']['outputs'][tempAttribute]; + console.log(currentOutputNode); + }); + } + } } |