diff options
author | KAPIL SINGAL <ks220y@att.com> | 2020-09-08 13:10:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-09-08 13:10:50 +0000 |
commit | 2891777b8569fc1dc6886a47e2bc27e646bde088 (patch) | |
tree | 4ce9cda6c81346fad677e20baec0fc7da5fbcec7 /cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard | |
parent | 57c6cdf3c137da78c9d0d52a4862c1bc6445f923 (diff) | |
parent | dc16c9e10b9f7f403761fe5f767cf48c2f39d73b (diff) |
Merge "adding manual enrichment"
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard')
2 files changed, 64 insertions, 28 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html index 772923283..0ffd9cb5e 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html @@ -755,9 +755,9 @@ </nav> <div class="row mt-4"> <div class="col"> - <div class="tab-content" id="nav-tabContent"> + <div class="tab-content" id="nav-tabContent" (change)="clickEvent()"> <div class="tab-pane fade show active" id="nav-metadata" role="tabpanel" - aria-labelledby="nav-metadata-tab" (change)="clickEvent()"> + aria-labelledby="nav-metadata-tab" > <app-metadata-tab></app-metadata-tab> </div> <div class="tab-pane fade" id="nav-template" role="tabpanel" 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 47e89b39a..029601d67 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 @@ -70,6 +70,7 @@ export class ConfigurationDashboardComponent implements OnInit { } } else { this.metadataClasses = this.metadataClasses.replace('complete', ''); + this.isSaveEnabled = false; } }); @@ -92,27 +93,32 @@ export class ConfigurationDashboardComponent implements OnInit { bluePrintDetailModels[0].artifactName + '/' + bluePrintDetailModels[0].artifactVersion).subscribe(response => { const blob = new Blob([response], {type: 'application/octet-stream'}); this.currentBlob = blob; - this.zipFile.loadAsync(blob).then((zip) => { - Object.keys(zip.files).forEach((filename) => { - zip.files[filename].async('string').then((fileData) => { - if (fileData) { - if (filename.includes('Scripts/')) { - this.setScripts(filename, fileData); - } else if (filename.includes('Templates/')) { - if (filename.includes('-mapping.')) { - this.setMapping(filename, fileData); - } else if (filename.includes('-template.')) { - this.setTemplates(filename, fileData); - } - - } else if (filename.includes('Definitions/')) { - this.setImports(filename, fileData, bluePrintDetailModels); - } else if (filename.includes('TOSCA-Metadata/')) { - const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData); - this.setMetaData(metaDataTabInfo, bluePrintDetailModels[0]); + this.extractBlobToStore(blob, bluePrintDetailModels); + }); + } + + private extractBlobToStore(blob: Blob, bluePrintDetailModels: BluePrintDetailModel) { + this.zipFile.loadAsync(blob).then((zip) => { + Object.keys(zip.files).forEach((filename) => { + zip.files[filename].async('string').then((fileData) => { + console.log(filename); + if (fileData) { + if (filename.includes('Scripts/')) { + this.setScripts(filename, fileData); + } else if (filename.includes('Templates/')) { + if (filename.includes('-mapping.')) { + this.setMapping(filename, fileData); + } else if (filename.includes('-template.')) { + this.setTemplates(filename, fileData); } + + } else if (filename.includes('Definitions/')) { + this.setImports(filename, fileData, bluePrintDetailModels); + } else if (filename.includes('TOSCA-Metadata/')) { + const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData); + this.setMetaData(metaDataTabInfo, bluePrintDetailModels[0]); } - }); + } }); }); }); @@ -239,8 +245,9 @@ export class ConfigurationDashboardComponent implements OnInit { } deployCurrentPackage() { - console.log('happened'); - this.router.navigate(['/packages']); + this.collectZipFileFromStore(); + this.deployPackage(); + } goToDesignerMode(id) { @@ -266,19 +273,21 @@ export class ConfigurationDashboardComponent implements OnInit { enrichBluePrint() { + this.collectZipFileFromStore(); + this.enrichPackage(); + } + + private collectZipFileFromStore() { this.packageCreationStore.state$.subscribe( cbaPackage => { FilesContent.clear(); console.log(cbaPackage); - let packageCreationModes: PackageCreationModes; cbaPackage = PackageCreationModes.mapModeType(cbaPackage); cbaPackage.metaData = PackageCreationModes.setEntryPoint(cbaPackage.metaData); packageCreationModes = PackageCreationBuilder.getCreationMode(cbaPackage); packageCreationModes.execute(cbaPackage, this.packageCreationUtils); this.filesData.push(this.folder.TREE_DATA); - this.enrichPackage(); - }); } @@ -289,8 +298,18 @@ export class ConfigurationDashboardComponent implements OnInit { this.packageCreationStore.enrichBluePrint(blob).subscribe(response => { console.log('success'); const blobInfo = new Blob([response], {type: 'application/octet-stream'}); - saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip'); - this.toastService.info('enriched successfully '); + this.configurationDashboardService.getPagedPackages(this.id).subscribe( + (bluePrintDetailModels) => { + if (bluePrintDetailModels) { + this.packageCreationStore.clear(); + this.extractBlobToStore(blob, bluePrintDetailModels); + this.isSaveEnabled = true; + this.toastService.info('enriched successfully '); + } + }); + + // saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip'); + }); }, error => { this.toastService.error('error happened when editing ' + error.message); @@ -298,6 +317,23 @@ export class ConfigurationDashboardComponent implements OnInit { }); } + private deployPackage() { + this.create(); + this.zipFile.generateAsync({type: 'blob'}) + .then(blob => { + this.packageCreationStore.deployBluePrint(blob).subscribe(response => { + console.log('success'); + console.log(response); + + // saveAs(blobInfo, 'test' + '-' + '1.0.0' + '-CBA.zip'); + + }); + }, error => { + this.toastService.error('error happened when deploying ' + error.message); + console.log('Error -' + error.message); + }); + } + clickEvent() { this.isSaveEnabled = true; } |