summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/designer-client')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.html71
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/action-attributes/action-attributes.component.ts127
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts65
3 files changed, 175 insertions, 88 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 5a0c9aaad..013fa8af9 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,8 +14,8 @@
<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" (click)="clearFormInputs()"><i class="icon-custom-attribute" type="button"
+ aria-hidden="true" ></i></button>
<span>Create Custom</span>
</div>
<div class="col text-center">
@@ -43,7 +43,7 @@
<div class="row">
<div class="col">
<div class="form-group" *ngFor="let input of inputs">
- <label for="exampleFormControlTextarea1">{{input.name}}
+ <label >{{input.name}}
<i [hidden]="!input.required" class="icon-required-star" type="button"
aria-hidden="true"></i>
<i [hidden]="input.required" class="icon-required-star optional-attribute"
@@ -52,7 +52,7 @@
<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>
+ placement="bottom" (click)="editAttribute(input)"><i class="icon-edit"></i></a>
<a class="accordion-delete deleteAttribute" tooltip="Delete Attribute"
placement="bottom"><i class="icon-delete-sm"></i></a>
</div>
@@ -80,13 +80,20 @@
<div class="row">
<div class="col">
<div class="form-group" *ngFor="let output of outputs">
- <label for="exampleFormControlTextarea1">{{output.name}}
+ <label >{{output.name}}
<i [hidden]="!output.required" class="icon-required-star" type="button"
aria-hidden="true"></i>
<i [hidden]="output.required" class="icon-required-star optional-attribute"
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" (click)="editAttribute(output)"><i class="icon-edit"></i></a>
+ <a class="accordion-delete deleteAttribute" tooltip="Delete Attribute"
+ placement="bottom"><i class="icon-delete-sm"></i></a>
+ </div>
</div>
</div>
</div>
@@ -277,11 +284,6 @@
)"></i></a>
</div>
</div>
- <div class="carousel__snapper" [hidden]="!isNotComponentResourceResolution">
- <a href="#carousel__slide4" [hidden]="isParametersHidden"
- class="carousel__prev">Parameters</a>
- <a href="#carousel__slide2" class="carousel__next">Attributes</a>
- </div>
</li>
<!--Attribute-->
<li id="carousel__slide2" tabindex="1" class="carousel__slide">
@@ -294,13 +296,13 @@
<div class="scrollWrapper">
<div *ngIf="suggestedAttributes.length>0"
class="btn-group btn-group-toggle" data-toggle="buttons">
- <label class="btn btn-secondary active"
+ <label class="btn btn-secondary"
*ngFor="let suggestedAttribute of suggestedAttributes"
[id]="suggestedAttribute"
(click)="addTempOutputAttr(suggestedAttribute)">
<input type="radio" name="options"
[id]="suggestedAttribute+'.,.'"
- autocomplete="off">
+ autocomplete="off" [checked]="suggestedAttributes[0].includes(suggestedAttribute)">
{{suggestedAttribute}}
</label>
@@ -311,11 +313,6 @@
</div>
</div>
</div>
- <div class="carousel__snapper"></div>
- <a href="#carousel__slide1" class="carousel__prev">Functions</a>
- <a href="#carousel__slide3" [hidden]="!isNotComponentResourceResolution"
- class="carousel__next">Artifacts</a>
-
</li>
<!--Artifact-->
<li id="carousel__slide3" [hidden]="isNotComponentResourceResolution" tabindex="2"
@@ -329,12 +326,14 @@
<div class="scrollWrapper">
<div *ngIf="currentArtifacts.length>0"
class="btn-group btn-group-toggle" data-toggle="buttons">
- <label class="btn btn-secondary active"
+ <label class="btn btn-secondary"
*ngFor="let suggestedArtifact of currentArtifacts"
(click)="addArtifactFile(suggestedArtifact)">
<input type="radio" name="options" [id]="suggestedArtifact"
autocomplete="off"
- (click)="addTempOutputAttr(suggestedArtifact)">
+ (click)="addArtifactFile(suggestedArtifact)"
+ [checked]="currentArtifacts[0].includes(suggestedArtifact)"
+ >
{{suggestedArtifact}}
</label>
@@ -345,11 +344,6 @@
</div>
</div>
</div>
- <div class="carousel__snapper" [hidden]="!isNotComponentResourceResolution">
- <a href="#carousel__slide2" class="carousel__prev">Attributes</a>
- <a href="#carousel__slide4" [hidden]="isParametersHidden"
- class="carousel__next">Parmeters</a>
- </div>
</li>
<!--Parameter-->
<li id="carousel__slide4"
@@ -362,29 +356,28 @@
<div class="tab-pane fade show active" id="list-home" role="tabpanel"
aria-labelledby="list-home-list">
<div class="scrollWrapper">
- <div *ngIf="suggestedAttributes.length>0"
+ <div *ngIf="suggestedMappingParameters.length>0"
class="btn-group btn-group-toggle" data-toggle="buttons">
- <label class="btn btn-secondary active"
- *ngFor="let suggestedAttribute of suggestedAttributes"
- (click)="addTempOutputAttr(suggestedAttribute)">
- <input type="radio" name="options" [id]="suggestedAttribute"
+ <label class="btn btn-secondary"
+ *ngFor="let suggestedMappingParameter of suggestedMappingParameters"
+ (click)="addSuggestedMappingParameter(suggestedMappingParameter)">
+ <!--[class]="suggestedMappingParameters[0].includes(suggestedMappingParameter)?'btn btn-secondary active':'btn btn-secondary'">
+ --> <input type="radio" name="options" [id]="suggestedMappingParameter"
autocomplete="off"
- (click)="addTempOutputAttr(suggestedAttribute)">
- {{suggestedAttribute}}
+ (click)="addSuggestedMappingParameter(suggestedMappingParameter)"
+ [checked]="suggestedMappingParameters[0].includes(suggestedMappingParameter)"
+
+ >
+ {{suggestedMappingParameter}}
</label>
</div>
- <div *ngIf="suggestedAttributes.length == 0">
+ <div *ngIf="suggestedMappingParameters.length == 0">
<p class="noAttributes">No Attributes Available</p>
</div>
</div>
</div>
</div>
- <div class="carousel__snapper"></div>
- <a href="#carousel__slide3" [hidden]="isNotComponentResourceResolution"
- class="carousel__prev">Artifacts</a>
- <a href="#carousel__slide1" class="carousel__next">Functions</a>
-
</li>
</ol>
<aside class="carousel__navigation">
@@ -434,11 +427,11 @@
<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="#input" 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="#output" role="tab"
- aria-controls="profile" aria-selected="false">Outputs</a>
+ aria-controls="profile" aria-selected="false" >Outputs</a>
</li>
</ul>
<div class="tab-content border-0 mt-2" id="myTabContent">
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 babfec772..668aff9b5 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
@@ -5,6 +5,8 @@ import {DesignerDashboardState} from '../model/designer.dashboard.state';
import {Action} from './models/Action';
import {FunctionsStore} from '../functions.store';
import {FunctionsState} from '../model/functions.state';
+import {PackageCreationStore} from '../../package-creation/package-creation.store';
+import {CBAPackage} from '../../package-creation/mapping-models/CBAPacakge.model';
@Component({
selector: 'app-action-attributes',
@@ -44,8 +46,14 @@ export class ActionAttributesComponent implements OnInit {
isNotComponentResourceResolution = true;
currentArtifacts: string[] = [];
isParametersHidden = true;
+ cbaPackage: CBAPackage;
+ suggestedMappingParameters: string[] = [];
+ selectedParameterList: string[] = [];
+ currentSuggestedArtifact: string;
- constructor(private designerStore: DesignerStore, private functionsStore: FunctionsStore) {
+ constructor(private designerStore: DesignerStore,
+ private functionsStore: FunctionsStore,
+ private packageCreationStore: PackageCreationStore) {
}
@@ -82,6 +90,12 @@ export class ActionAttributesComponent implements OnInit {
this.functionsStore.state$.subscribe(functions => {
this.functions = functions;
});
+
+ this.packageCreationStore.state$
+ .subscribe(cbaPackage => {
+ this.cbaPackage = cbaPackage;
+
+ });
}
@@ -139,23 +153,47 @@ export class ActionAttributesComponent implements OnInit {
submitAttributes() {
this.addInput(this.inputActionAttribute);
if (this.selectedFunctionName && this.selectedAttributeName) {
+ console.log(this.getValue());
this.outputActionAttribute.value =
- '["' + this.selectedFunctionName + '","' + this.selectedAttributeName + '"]';
+ this.getValue();
}
this.addOutput(this.outputActionAttribute);
this.clearFormInputs();
this.storeOutputs(this.newOutputs);
this.storeInputs((this.newInputs));
this.newInputs.forEach(input => {
- this.inputs.push(input);
+ if (!this.inputs.includes(input)) {
+ this.inputs.push(input);
+ }
});
this.newOutputs.forEach(output => {
- this.outputs.push(output);
+ if (!this.outputs.includes(output)) {
+ this.outputs.push(output);
+ }
});
}
- private clearFormInputs() {
+ private getValue() {
+ let value = '["' + this.selectedFunctionName + '", "' + '","' + this.selectedAttributeName;
+
+ if (!this.isParametersHidden) {
+ let currentSelected = '';
+ for (const selectedParameter of this.selectedParameterList) {
+ currentSelected += '"' + selectedParameter + '",';
+ }
+ value += '","' + this.currentSuggestedArtifact + '",'
+ + currentSelected.substr(0, currentSelected.length - 2) + '';
+ } else if (!this.isNotComponentResourceResolution && this.currentSuggestedArtifact) {
+ value += '","' + this.currentSuggestedArtifact + '';
+
+ }
+
+ return value += '"]';
+ }
+
+ public clearFormInputs() {
+ console.log('trying to clear ');
this.inputActionAttribute = new InputActionAttribute();
this.outputActionAttribute = new OutputActionAttribute();
this.outputOtherType = '';
@@ -167,9 +205,11 @@ export class ActionAttributesComponent implements OnInit {
let inputs = '';
InputActionAttributes.forEach(input => {
inputs += this.appendAttributes(input);
-
+ console.log(inputs);
});
- this.writeAttribute(inputs, 'inputs');
+ if (inputs.length > 0) {
+ this.writeAttribute(inputs, 'inputs');
+ }
}
private storeOutputs(OutputActionAttributes: OutputActionAttribute[]) {
@@ -177,7 +217,10 @@ export class ActionAttributesComponent implements OnInit {
OutputActionAttributes.forEach(output => {
outputs += this.appendOutputAttributes(output);
});
- this.writeAttribute(outputs, 'outputs');
+ if (outputs.length > 0) {
+ this.writeAttribute(outputs, 'outputs');
+ }
+
}
private appendAttributes(inputActionAttribute: InputActionAttribute) {
@@ -307,15 +350,28 @@ export class ActionAttributesComponent implements OnInit {
private writeAttribute(newAttributes: string, attributeType: string) {
newAttributes = this.removeTheLastComma(newAttributes);
- const originalAttributes = this.convertToString(this.designerState.template.workflows[this.actionName]
+ console.log(newAttributes);
+ let originalAttributes = this.convertToString(this.designerState.template.workflows[this.actionName]
+ [attributeType]);
+ this.createAttributeTypeIfNotExisted(originalAttributes, attributeType);
+ originalAttributes = this.convertToString(this.designerState.template.workflows[this.actionName]
[attributeType]);
- console.log(originalAttributes.substr(0, originalAttributes.length - 1) + ',' + newAttributes + '}');
- this.designerState.template.workflows[this.actionName][attributeType] =
- this.convertToObject(originalAttributes.substr(0, originalAttributes.length - 1)
- + ',' + newAttributes + '}');
+ if (originalAttributes.length > 2) {
+ this.designerState.template.workflows[this.actionName][attributeType] =
+ this.convertToObject(originalAttributes.substr(0, originalAttributes.length - 1)
+ + ',' + newAttributes + '}');
+ } else {
+ this.designerState.template.workflows[this.actionName][attributeType] =
+ this.convertToObject(originalAttributes.substr(0, originalAttributes.length - 1)
+ + newAttributes + '}');
+ }
+ /* console.log(originalAttributes.substr(0, originalAttributes.length - 1) + ',' + newAttributes + '}');
+ this.designerState.template.workflows[this.actionName][attributeType] =
+ this.convertToObject(originalAttributes.substr(0, originalAttributes.length - 1)
+ + ',' + newAttributes + '}');*/
}
- private removeTheLastComma = (newInputs: string) => {
+ private removeTheLastComma(newInputs: string): string {
if (newInputs.endsWith(',')) {
newInputs = newInputs.substr(0, newInputs.length - 1);
}
@@ -332,16 +388,15 @@ export class ActionAttributesComponent implements OnInit {
getAttributesAndOutputs(functionName: string) {
this.suggestedAttributes = [];
console.log(functionName);
- if (functionName.includes('component-resource-resolution')) {
+
+ const nodeTemplate = this.designerState.template.node_templates[functionName];
+ if (nodeTemplate['type'].includes('component-resource-resolution')) {
this.isNotComponentResourceResolution = false;
this.isParametersHidden = true;
} else {
this.isNotComponentResourceResolution = true;
this.isParametersHidden = true;
}
- const nodeTemplate = this.designerState.template.node_templates[functionName];
- console.log(this.designerState.template.node_templates);
- console.log(nodeTemplate);
/* tslint:disable:no-string-literal */
console.log(nodeTemplate['type']);
this.functions.serverFunctions
@@ -394,8 +449,40 @@ export class ActionAttributesComponent implements OnInit {
}
addArtifactFile(suggestedArtifact: string) {
- console.log(suggestedArtifact);
+ this.currentSuggestedArtifact = suggestedArtifact;
this.isParametersHidden = !this.selectedAttributeName.includes('assignment-map');
- console.log('assignement map ' + this.isParametersHidden);
+ if (!this.isParametersHidden) {
+ this.suggestedMappingParameters = this.getSuggestedMappingParameters(suggestedArtifact);
+ }
+ }
+
+ private getSuggestedMappingParameters(suggestedArtifact: string) {
+ const suggestedMappingParameters = [];
+
+ this.cbaPackage.mapping.files.forEach(((value, key) => {
+ if (key.includes(suggestedArtifact)) {
+
+ JSON.parse(value).forEach(value2 => {
+ suggestedMappingParameters.push(value2['name']);
+ });
+ }
+ }));
+ return suggestedMappingParameters;
+ }
+
+ addSuggestedMappingParameter(suggestedMappingParameter: string) {
+ this.addAttribute(this.selectedParameterList, suggestedMappingParameter);
+ this.deleteAttribute(this.suggestedMappingParameters, suggestedMappingParameter);
+
+ }
+
+ editAttribute(input: any) {
+ console.log(input);
+ }
+
+ private createAttributeTypeIfNotExisted(originalAttributes: string, attributeType: string) {
+ if (!originalAttributes) {
+ this.designerState.template.workflows[this.actionName][attributeType] = {};
+ }
}
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
index 88f28b780..ff6406c28 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
@@ -25,33 +25,33 @@ limitations under the License.
import dagre from 'dagre';
import graphlib from 'graphlib';
-import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
+import {Component, OnDestroy, OnInit, ViewEncapsulation} from '@angular/core';
import * as joint from 'jointjs';
import './jointjs/elements/palette.function.element';
import './jointjs/elements/action.element';
import './jointjs/elements/board.function.element';
-import { DesignerStore } from './designer.store';
-import { ActionElementTypeName } from 'src/app/common/constants/app-constants';
-import { GraphUtil } from './graph.util';
-import { GraphGenerator } from './graph.generator.util';
-import { FunctionsStore } from './functions.store';
-import { Subject } from 'rxjs';
-import { distinctUntilChanged, takeUntil } from 'rxjs/operators';
-import { BluePrintDetailModel } from '../model/BluePrint.detail.model';
-import { ActivatedRoute, Router } from '@angular/router';
-import { DesignerService } from './designer.service';
-import { FilesContent, FolderNodeElement } from '../package-creation/mapping-models/metadata/MetaDataTab.model';
-import { PackageCreationModes } from '../package-creation/creationModes/PackageCreationModes';
-import { PackageCreationBuilder } from '../package-creation/creationModes/PackageCreationBuilder';
-import { PackageCreationStore } from '../package-creation/package-creation.store';
-import { PackageCreationService } from '../package-creation/package-creation.service';
-import { PackageCreationUtils } from '../package-creation/package-creation.utils';
+import {DesignerStore} from './designer.store';
+import {ActionElementTypeName} from 'src/app/common/constants/app-constants';
+import {GraphUtil} from './graph.util';
+import {GraphGenerator} from './graph.generator.util';
+import {FunctionsStore} from './functions.store';
+import {Subject} from 'rxjs';
+import {distinctUntilChanged, takeUntil} from 'rxjs/operators';
+import {BluePrintDetailModel} from '../model/BluePrint.detail.model';
+import {ActivatedRoute, Router} from '@angular/router';
+import {DesignerService} from './designer.service';
+import {FilesContent, FolderNodeElement} from '../package-creation/mapping-models/metadata/MetaDataTab.model';
+import {PackageCreationModes} from '../package-creation/creationModes/PackageCreationModes';
+import {PackageCreationBuilder} from '../package-creation/creationModes/PackageCreationBuilder';
+import {PackageCreationStore} from '../package-creation/package-creation.store';
+import {PackageCreationService} from '../package-creation/package-creation.service';
+import {PackageCreationUtils} from '../package-creation/package-creation.utils';
import * as JSZip from 'jszip';
-import { PackageCreationExtractionService } from '../package-creation/package-creation-extraction.service';
-import { CBAPackage } from '../package-creation/mapping-models/CBAPacakge.model';
-import { TopologyTemplate } from './model/designer.topologyTemplate.model';
-import { ToastrService } from 'ngx-toastr';
-import { DesignerDashboardState } from './model/designer.dashboard.state';
+import {PackageCreationExtractionService} from '../package-creation/package-creation-extraction.service';
+import {CBAPackage} from '../package-creation/mapping-models/CBAPacakge.model';
+import {TopologyTemplate} from './model/designer.topologyTemplate.model';
+import {ToastrService} from 'ngx-toastr';
+import {DesignerDashboardState} from './model/designer.dashboard.state';
@Component({
selector: 'app-designer',
@@ -75,7 +75,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
paletteGraph: joint.dia.Graph;
palettePaper: joint.dia.Paper;
ngUnsubscribe = new Subject();
- opt = { tx: 100, ty: 100 };
+ opt = {tx: 100, ty: 100};
filesData: any = [];
folder: FolderNodeElement = new FolderNodeElement();
zipFile: JSZip = new JSZip();
@@ -122,7 +122,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
publishBluePrint() {
this.create();
- this.zipFile.generateAsync({ type: 'blob' })
+ this.zipFile.generateAsync({type: 'blob'})
.then(blob => {
const formData = new FormData();
formData.append('file', blob);
@@ -169,7 +169,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
this.packageCreationService.downloadPackage(this.viewedPackage.artifactName + '/'
+ this.viewedPackage.artifactVersion)
.subscribe(response => {
- const blob = new Blob([response], { type: 'application/octet-stream' });
+ const blob = new Blob([response], {type: 'application/octet-stream'});
this.packageCreationExtractionService.extractBlobToStore(blob);
});
}
@@ -232,7 +232,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
setLinkVertices: false,
marginX: 10,
marginY: 10,
- clusterPadding: { top: 100, left: 30, right: 10, bottom: 100 },
+ clusterPadding: {top: 100, left: 30, right: 10, bottom: 100},
rankDir: 'TB'
});
this.actions = [];
@@ -240,6 +240,13 @@ export class DesignerComponent implements OnInit, OnDestroy {
for (const workflowsKey in topologtTemplate.workflows) {
if (workflowsKey && !this.actions.includes(workflowsKey)) {
this.actions.push(workflowsKey);
+ /* tslint:disable:no-string-literal */
+ if (!this.designerState.template.workflows[workflowsKey]['inputs']) {
+ this.designerState.template.workflows[workflowsKey]['inputs'] = {};
+ }
+ if (!this.designerState.template.workflows[workflowsKey]['outputs']) {
+ this.designerState.template.workflows[workflowsKey]['outputs'] = {};
+ }
}
}
}
@@ -468,7 +475,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
saveBluePrintToDataBase() {
this.create();
- this.zipFile.generateAsync({ type: 'blob' })
+ this.zipFile.generateAsync({type: 'blob'})
.then(blob => {
this.packageCreationService.savePackage(blob).subscribe(
bluePrintDetailModels => {
@@ -500,11 +507,11 @@ export class DesignerComponent implements OnInit, OnDestroy {
// console.log(this.designerState.template.workflows[this.currentActionName]
// ['steps'][customFunctionName]['target']);
this.designerStore.setCurrentFunction(this.designerState.template.workflows[this.currentActionName]
- ['steps'][customFunctionName]['target']);
+ ['steps'][customFunctionName]['target']);
}
getTarget(stepname) {
return this.designerState.template.workflows[this.currentActionName]
- ['steps'][stepname]['target'];
+ ['steps'][stepname]['target'];
}
}