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 <ezhrajam@in.ibm.com>
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 47771a7..1341b8b 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 @@
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 @@
.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 @@
});
}
- 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 @@
});
});
this.loader.hideLoader();
- return tree;
+ this.filesTree = tree;
+ this.updateBlueprint();
}
fetchTOSACAMetadata() {
@@ -219,4 +202,19 @@
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));
+ }
+
}