From 30d343b514abfa632641e3d27ea847be6c7a5e41 Mon Sep 17 00:00:00 2001 From: Ezhilarasi Date: Wed, 28 Aug 2019 16:16:48 +0530 Subject: Fixed store update error after search Had issue with updating blueprint to stores. Fixed it Change-Id: Id38df2c7dd3e22679e2753689d34eac75093558e Issue-ID: CCSDK-1275 Signed-off-by: Ezhilarasi --- .../search-from-database.component.ts | 40 ++++++++++------------ 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'cds-ui/client/src/app/feature-modules/blueprint') diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts index 47771a7aa..1341b8bd1 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts @@ -87,6 +87,8 @@ export class SearchFromDatabaseComponent implements OnInit { editCBA(artifactName: string, artifactVersion: string, option: string) { this.cbEditOption.setCbaOption(option); + this.uploadedFileName = artifactName; + console.log("filename:" + this.uploadedFileName); this.zipFile.generateAsync({ type: "blob" }) .then(blob => { const formData = new FormData(); @@ -101,18 +103,6 @@ export class SearchFromDatabaseComponent implements OnInit { .then((zip) => { if (zip) { this.buildFileViewData(zip); - // console.log("processed"); - let data: IBlueprint = this.activationBlueprint ? JSON.parse(this.activationBlueprint.toString()) : this.activationBlueprint; - let blueprintState = { - blueprint: data, - name: this.blueprintName, - files: this.tree, - filesData: this.paths, - uploadedFileName: this.blueprintName, - entryDefinition: this.entryDefinition - } - this.store.dispatch(new SetBlueprintState(blueprintState)); - // console.log(blueprintState); } }); // this.alertService.success('Blueprint enriched successfully'); @@ -123,14 +113,6 @@ export class SearchFromDatabaseComponent implements OnInit { }); } - create() { - this.filesData.forEach((path) => { - let index = path.name.indexOf("/"); - let name = path.name.slice(index + 1, path.name.length); - this.zipFile.file(name, path.data); - }); - } - async buildFileViewData(zip) { this.validfile = false; this.paths = []; @@ -202,7 +184,8 @@ export class SearchFromDatabaseComponent implements OnInit { }); }); this.loader.hideLoader(); - return tree; + this.filesTree = tree; + this.updateBlueprint(); } fetchTOSACAMetadata() { @@ -219,4 +202,19 @@ export class SearchFromDatabaseComponent implements OnInit { this.blueprintName = (((toscaData['Entry-Definitions']).split('/'))[1]).toString();; // console.log(toscaData); } + + updateBlueprint() { + + let data: IBlueprint = this.activationBlueprint ? JSON.parse(this.activationBlueprint.toString()) : this.activationBlueprint; + let blueprintState = { + blueprint: data, + name: this.blueprintName, + files: this.filesTree, + filesData: this.filesData, + uploadedFileName: this.uploadedFileName, + entryDefinition: this.entryDefinition + } + this.store.dispatch(new SetBlueprintState(blueprintState)); + } + } -- cgit 1.2.3-korg