Fixed defect CCSDK-1326 31/87531/1
authorArundathi Patil <arundpil@in.ibm.com>
Mon, 13 May 2019 09:11:15 +0000 (14:41 +0530)
committerArundathi Patil <arundpil@in.ibm.com>
Mon, 13 May 2019 09:12:41 +0000 (14:42 +0530)
fixed defect ccsdk-1326

Issue-ID; CCSDK-1326
Change-Id: Ibfc6d6df0fa47569e326fd9e61227e08c36aa0c2
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts

index 6d26592..13d7d53 100644 (file)
@@ -28,6 +28,7 @@ export interface IBlueprintState {
     name?: string;
     files?: any;
     filesData?: any;
+    uploadedFileName?: string;
     isLoadSuccess?: boolean;
     isUpdateSuccess?: boolean;
     isSaveSuccess?: boolean;
index 37a659d..b4347d4 100644 (file)
@@ -55,7 +55,8 @@ export function blueprintReducer(state: IBlueprintState = initialBlueprintState,
                     blueprint: action.payload.blueprint,
                     name: action.payload.name,
                     files: action.payload.files,
-                    filesData: action.payload.filesData
+                    filesData: action.payload.filesData,
+                    uploadedFileName: action.payload.uploadedFileName
                     }
         default:
             return state;
index ffe6902..09fa003 100644 (file)
@@ -105,6 +105,7 @@ export class EditorComponent implements OnInit {
   private fileObject: any;
   private tocsaMetadaData: any;
   metadata: IMetaData;
+  uploadedFileName: string;
 
   private transformer = (node: Node, level: number) => {
     return {
@@ -159,6 +160,7 @@ export class EditorComponent implements OnInit {
         this.filesData = blueprintdata.filesData;
         this.dataSource.data = this.filesTree;
         this.blueprintName = blueprintdata.name;
+        this.uploadedFileName = blueprintdata.uploadedFileName;
         let blueprint = [];
         for (let key in this.blueprintdata) {
           if (this.blueprintdata.hasOwnProperty(key)) {
@@ -202,7 +204,8 @@ export class EditorComponent implements OnInit {
       blueprint: this.blueprint,
       name: this.blueprintName,
       files: this.filesTree,
-      filesData: this.filesData
+      filesData: this.filesData,
+      uploadedFileName: this.uploadedFileName
     }
     this.store.dispatch(new SetBlueprintState(blueprintState));
     // console.log(this.text);
@@ -218,7 +221,7 @@ export class EditorComponent implements OnInit {
     this.filetoDelete = file.name;
     this.currentFilePath = this.currentFilePath + this.selectedFile;
     this.filesData.forEach((fileNode) => {
-      if (fileNode.name.includes(file.name)) {
+      if (fileNode.name.includes(file.name) && fileNode.name == this.currentFilePath) {
         this.text = fileNode.data;
       }
     })
@@ -406,7 +409,9 @@ export class EditorComponent implements OnInit {
     this.paths = [];
     for (var file in zip.files) {
       this.fileObject = {
-        name: zip.files[file].name,
+        // name: zip.files[file].name,
+        // name: this.uploadedFileName + '/' + zip.files[file].name,
+        name: this.uploadedFileName + zip.files[file].name,
         data: ''
       };
       const value = <any>await zip.files[file].async('string');
index 9c11f76..1d0ba2c 100644 (file)
@@ -78,7 +78,8 @@ export class SearchTemplateComponent implements OnInit {
       blueprint: data,
       name: this.blueprintName,
       files: this.tree,
-      filesData: this.paths
+      filesData: this.paths,
+      uploadedFileName: this.uploadedFileName
     }
     this.store.dispatch(new SetBlueprintState(blueprintState))
     // this.store.dispatch(new LoadBlueprintSuccess(data));
@@ -87,7 +88,9 @@ export class SearchTemplateComponent implements OnInit {
   async buildFileViewData(zip) {
     this.validfile = false;
     this.paths = [];
+    console.log(zip.files);
     for (var file in zip.files) {
+      console.log("name: " +zip.files[file].name);
       this.fileObject = {
         // nameForUIDisplay: this.uploadedFileName + '/' + zip.files[file].name,
         // name: zip.files[file].name,