aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client
diff options
context:
space:
mode:
authorAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-11-16 17:13:02 +0200
committerAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>2020-11-16 17:13:02 +0200
commit67ae82d8f6f66e1e01a3e28dfa8e17d1168c27aa (patch)
treedfabbc9f3d7550c6fd1ed8be17dafb997c6f2dac /cds-ui/designer-client
parent644dc55c1e5ffe2e9a23507af905ac40184dcad2 (diff)
Save package from function attribute button
detect url change in breadcrumb Issue-ID: CCSDK-2900 Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> Change-Id: I30526644715baedfa95080500a23a1eaca10adb5
Diffstat (limited to 'cds-ui/designer-client')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html6
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts63
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts11
5 files changed, 48 insertions, 36 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
index 3ca377df7..b0bfe8be7 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
@@ -10,7 +10,7 @@
</li>
<i class="fa fa-angle-right ml-2 mr-2"></i>
<li class="breadcrumb-item">
- <a routerLink="/packages/package/{{viewedPackage.id}}">{{viewedPackage.artifactName}}</a>
+ <a routerLink="/packages/package/{{packageId}}">{{viewedPackage.artifactName}}</a>
<button type="button" class="btn package-info-btn tooltip-bottom" data-toggle="modal"
data-target="#exampleModalLong" data-tooltip="Package Details">
<i class="icon-info" aria-hidden="true"></i>
@@ -161,7 +161,7 @@
<li class="nav-item">
<div class="btn-group viewBtns" role="group">
<button type="button" class="btn btn-secondary topologySource active">Designer</button>
- <button [routerLink]="['/designer/source', viewedPackage.id]" type="button"
+ <button [routerLink]="['/designer/source', packageId]" type="button"
class="btn btn-secondary topologyView">Scripting
</button>
</div>
@@ -336,7 +336,7 @@
</div>
</div>
</div>
- <app-functions-attribute></app-functions-attribute>
+ <app-functions-attribute (saveEvent)="saveBluePrint()"></app-functions-attribute>
</div>
</div>
</div>
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 ff6406c28..a2b57d6ad 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();
@@ -85,6 +85,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
steps: string[];
designerState: DesignerDashboardState;
currentActionName: string;
+ packageId: any;
constructor(
private designerStore: DesignerStore,
@@ -98,6 +99,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
private designerService: DesignerService,
private packageCreationService: PackageCreationService,
private packageCreationExtractionService: PackageCreationExtractionService,
+ private activatedRoute: ActivatedRoute,
private toastService: ToastrService) {
this.controllerSideBar = true;
this.actionAttributesSideBar = false;
@@ -122,7 +124,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 +171,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 +234,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 = [];
@@ -254,6 +256,9 @@ export class DesignerComponent implements OnInit, OnDestroy {
// action triggering
this.functionStore.retrieveFuntions();
+ this.activatedRoute.paramMap.subscribe(res => {
+ this.packageId = res.get('id');
+ });
}
@@ -475,7 +480,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 => {
@@ -507,11 +512,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'];
}
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts
index 857654c56..c9151c558 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts
@@ -78,7 +78,7 @@ export class DesignerStore extends Store<DesignerDashboardState> {
}
saveSourceContent(code: string) {
- console.log(code);
+ // console.log(code);
if (code) {
const topologyTemplate = JSON.parse(code);
this.setState({
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html
index ab5bb123e..505844c57 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html
@@ -206,7 +206,7 @@
</div>
</div>
</div>
- <button class="btn btn-info" (click)="saveFunctionData()">Save</button>
+ <button class="btn btn-info btn-select-template m-auto" (click)="saveFunctionData()">Save</button>
</div>
<!--function - Select Template - Modal-->
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts
index 347f304c8..871236768 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
import { DesignerStore } from '../designer.store';
import { PackageCreationStore } from '../../package-creation/package-creation.store';
import { Subject } from 'rxjs';
@@ -34,6 +34,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
actionName = '';
functionName = '';
interfaceChildName = '';
+ @Output() saveEvent = new EventEmitter<string>();
constructor(
@@ -132,7 +133,11 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
if (inputs) {
for (const [key, value] of Object.entries(inputs)) {
console.log(key + ' - ' + value);
- this.currentFuncion.inputs[key] = value;
+ if (typeof value === 'object') {
+ this.currentFuncion.inputs[key] = JSON.stringify(value);
+ } else {
+ this.currentFuncion.inputs[key] = value;
+ }
}
}
if (outputs) {
@@ -210,6 +215,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
console.log(node_templates);
// tslint:disable-next-line: no-unused-expression
this.designerStore.addNodeTemplate(instanceName, type, node_templates[instanceName]);
+ this.saveEvent.emit('save');
}
// Template logic
private setIsMappingOrTemplate(key: string, templateAndMapping: TemplateAndMapping, isFromTemplate: boolean) {
@@ -262,6 +268,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
getObjectValue(object) {
return Object.values(object);
}
+
getNodeType(nodeName: string) {
this.functionStore.state$
.subscribe(state => {