diff options
author | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-10-13 12:50:31 +0200 |
---|---|---|
committer | ShaabanEltanany <shaaban.eltanany.ext@orange.com> | 2020-10-13 12:50:31 +0200 |
commit | 54a8e07309b4d8ae7d0c9f6f6535f76d4f8db1f7 (patch) | |
tree | 5b401ac15f36fb0d47cb0f4ce644daaadb61946b /cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard | |
parent | f36e67c64667080c78a1d30f5aace683391d8a14 (diff) |
add import&deploy feature
Issue-ID: CCSDK-2904
Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: I69f7d9f951a20ae688ec8f627c5acfac3a30dcc9
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard')
2 files changed, 23 insertions, 0 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html index d578582fd..0632fb47d 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.html @@ -49,6 +49,10 @@ Import&Save </button> <button type="button" class="btn btn-sm btn-primary" [disabled]="uploadedFiles?.length<=0" + data-dismiss="modal" (click)="importAndDeploy()"> + Import&Deploy + </button> + <button type="button" class="btn btn-sm btn-primary" [disabled]="uploadedFiles?.length<=0" data-dismiss="modal" (click)="importPackageAndViewIt()"> Import </button> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts index 7496338d6..5797d18d5 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/import-package/import-package.component.ts @@ -123,4 +123,23 @@ export class ImportPackageComponent implements OnInit { }); }); } + + importAndDeploy() { + const file = this.getFile(this.uploadedFiles[this.uploadedFiles.length - 1]); + this.zipFile = new JSZip(); + this.zipFile.loadAsync(file).then(zip => { + this.zipFile = zip; + console.log(this.zipFile); + this.resetTheUploadedFiles(); + this.zipFile.generateAsync({type: 'blob'}).then(blob => { + this.packageCreationService.deploy(blob).subscribe( + bluePrintDetailModels => { + this.toastService.info('package is imported and deployed successfully '); + this.router.navigate(['/packages']); + this.packagesStore.getAll(); + }, error => + this.toastService.error('there is an error happened ' + error)); + }); + }); + } } |