From 81d82489f5592770a9e5f9ee137bfc1558b48153 Mon Sep 17 00:00:00 2001 From: ShaabanEltanany Date: Tue, 22 Sep 2020 11:56:38 +0200 Subject: adding saving simple function at designer Issue-ID: CCSDK-2298 Signed-off-by: ShaabanEltanany Change-Id: Id4ebd3413103d6433e84b3513c4f651176a9833f --- .../configuration-dashboard.component.ts | 26 +++++----- .../packages/designer/designer.component.html | 2 +- .../packages/designer/designer.component.ts | 29 ++++++++---- .../packages/designer/designer.store.ts | 21 +++++---- .../creationModes/DesignerCreationMode.ts | 1 + .../imports-tab/imports-tab.component.html | 2 +- .../mapping-models/definitions/VlbDefinition.ts | 18 ++++--- .../metadata-tab/metadata-tab.component.ts | 6 +-- .../package-creation-extraction.service.ts | 55 ++++++++++++++-------- .../package-creation/package-creation.component.ts | 28 +++++------ .../package-creation/package-creation.service.ts | 6 ++- .../package-creation/package-creation.store.ts | 2 + .../scripts-tab/scripts-tab.component.ts | 1 + .../import-package/import-package.component.ts | 12 +++-- .../package-list/package-list.component.ts | 4 -- 15 files changed, 130 insertions(+), 83 deletions(-) (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages') diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts index 2b0521bb2..228953eb9 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts @@ -17,6 +17,7 @@ import {ToastrService} from 'ngx-toastr'; import {NgxFileDropEntry} from 'ngx-file-drop'; import {PackageCreationService} from '../package-creation/package-creation.service'; import {ComponentCanDeactivate} from '../../../../common/core/canDactivate/ComponentCanDeactivate'; +import {PackageCreationExtractionService} from '../package-creation/package-creation-extraction.service'; @Component({ selector: 'app-configuration-dashboard', @@ -54,13 +55,17 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl private packageCreationUtils: PackageCreationUtils, private router: Router, private designerStore: DesignerStore, - private toastService: ToastrService + private toastService: ToastrService, + private packageCreationExtractionService: PackageCreationExtractionService ) { super(); + this.packageCreationStore.state$.subscribe( cbaPackage => { this.cbaPackage = cbaPackage; }); + + } ngOnInit() { @@ -83,9 +88,12 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl } - private refreshCurrentPackage() { + + private refreshCurrentPackage(id?) { this.id = this.route.snapshot.paramMap.get('id'); - this.configurationDashboardService.getPagedPackages(this.id).subscribe( + console.log(this.id); + id = id ? id : this.id; + this.configurationDashboardService.getPagedPackages(id).subscribe( (bluePrintDetailModels) => { if (bluePrintDetailModels) { this.viewedPackage = bluePrintDetailModels[0]; @@ -97,10 +105,10 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl private downloadCBAPackage(bluePrintDetailModels: BluePrintDetailModel) { this.configurationDashboardService.downloadResource( - bluePrintDetailModels[0].artifactName + '/' + bluePrintDetailModels[0].artifactVersion).subscribe(response => { + this.viewedPackage.artifactName + '/' + this.viewedPackage.artifactVersion).subscribe(response => { const blob = new Blob([response], {type: 'application/octet-stream'}); this.currentBlob = blob; - this.extractBlobToStore(blob, bluePrintDetailModels[0]); + this.extractBlobToStore(blob, this.viewedPackage); }); } @@ -218,8 +226,8 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl const id = bluePrintDetailModels.toString().split('id')[1].split(':')[1].split('"')[1]; this.toastService.info('package updated successfully '); this.isSaveEnabled = false; - this.id = id; this.router.navigate(['/packages/package/' + id]); + this.refreshCurrentPackage(id); } }, error => { this.toastService.error('error happened when editing ' + error.message); @@ -266,11 +274,7 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl } goToDesignerMode(id) { - // this.designerService.setActionName(this.customActionName); - this.packageCreationStore.state$.subscribe(cba => { - console.log(cba); - sessionStorage.setItem('cba', this.packageCreationUtils.transformToJson(cba)); - }); + this.router.navigate(['/packages/designer', id, {actionName: this.customActionName}]); } 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 4c0835741..88923229b 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 @@