summaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-09-13 12:28:48 +0200
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-09-13 12:28:48 +0200
commit6e998ce32f75614c90963954c62bde64df747c64 (patch)
treecfcc7241314ab5f8c7b47e5ec7fcf34344b70988 /cds-ui
parentdbf58e985a064a8a499ce2db4643b3b5c602d625 (diff)
improve manual enrichment
Issue-ID: CCSDK-2542 Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com> Change-Id: I3ec0bdc702f7e424896bd57c4560ab60349bbc37
Diffstat (limited to 'cds-ui')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts32
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts2
2 files changed, 14 insertions, 20 deletions
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 71afa155d..eb699af75 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
@@ -98,11 +98,11 @@ 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.extractBlobToStore(blob, bluePrintDetailModels);
+ this.extractBlobToStore(blob, bluePrintDetailModels[0]);
});
}
- private extractBlobToStore(blob: Blob, bluePrintDetailModels: BluePrintDetailModel) {
+ private extractBlobToStore(blob: Blob, bluePrintDetailModel: BluePrintDetailModel) {
this.zipFile.loadAsync(blob).then((zip) => {
Object.keys(zip.files).forEach((filename) => {
zip.files[filename].async('string').then((fileData) => {
@@ -118,10 +118,10 @@ export class ConfigurationDashboardComponent implements OnInit {
}
} else if (filename.includes('Definitions/')) {
- this.setImports(filename, fileData, bluePrintDetailModels);
+ this.setImports(filename, fileData, bluePrintDetailModel);
} else if (filename.includes('TOSCA-Metadata/')) {
const metaDataTabInfo: MetaDataTabModel = this.getMetaDataTabInfo(fileData);
- this.setMetaData(metaDataTabInfo, bluePrintDetailModels[0]);
+ this.setMetaData(metaDataTabInfo, bluePrintDetailModel);
}
}
});
@@ -134,7 +134,8 @@ export class ConfigurationDashboardComponent implements OnInit {
}
setImports(filename: string, fileData: any, bluePrintDetailModels: BluePrintDetailModel) {
- if (filename.includes(bluePrintDetailModels[0].artifactName)) {
+ console.log(filename);
+ if (filename.includes(bluePrintDetailModels.artifactName)) {
let definition = new VlbDefinition();
definition = fileData as VlbDefinition;
definition = JSON.parse(fileData);
@@ -293,22 +294,15 @@ export class ConfigurationDashboardComponent implements OnInit {
this.packageCreationService.enrichPackage(blob).subscribe(response => {
console.log('success');
const blobInfo = new Blob([response], {type: 'application/octet-stream'});
- 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');
-
+ this.currentBlob = blobInfo;
+ this.packageCreationStore.clear();
+ this.extractBlobToStore(this.currentBlob, this.viewedPackage);
+ this.isSaveEnabled = true;
+ this.toastService.info('enriched successfully ');
});
}, error => {
- this.toastService.error('error happened when editing ' + error.message);
- console.log('Error -' + error.message);
+ this.toastService.error('error happened when enrich ' + error.message);
+ console.error('Error -' + error.message);
});
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts
index e7ccbb39a..bd8360a14 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.service.ts
@@ -42,7 +42,7 @@ export class PackageCreationService {
}
private enrichBlueprint(body: any | null, options?: any): Observable<any> {
- return this.api.post(BlueprintURLs.enrich, body, {responseType: 'text'});
+ return this.api.post(BlueprintURLs.enrich, body, { responseType: 'blob' });
}
private deployBluePrint(body: any | null, options?: any): Observable<any> {