summaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorEzhilarasi <ezhrajam@in.ibm.com>2019-08-28 16:16:48 +0530
committerEzhilarasi <ezhrajam@in.ibm.com>2019-08-28 16:16:57 +0530
commit30d343b514abfa632641e3d27ea847be6c7a5e41 (patch)
tree66f6e0615cc54bca1429a6777dc4a8316969a697 /cds-ui
parentf5c26aa8745348cc54ad12c47d67cc13f0a56740 (diff)
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>
Diffstat (limited to 'cds-ui')
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts40
1 files changed, 19 insertions, 21 deletions
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));
+ }
+
}