From 404162a4e997feba3fd6c21f438bcfe8e1ad2281 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Mon, 13 May 2019 14:41:15 +0530 Subject: Fixed defect CCSDK-1326 fixed defect ccsdk-1326 Issue-ID; CCSDK-1326 Change-Id: Ibfc6d6df0fa47569e326fd9e61227e08c36aa0c2 Signed-off-by: Arundathi Patil --- .../src/app/common/core/store/models/blueprintState.model.ts | 1 + .../src/app/common/core/store/reducers/blueprint.reducer.ts | 3 ++- .../blueprint/modify-template/editor/editor.component.ts | 11 ++++++++--- .../search-template/search-template.component.ts | 5 ++++- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'cds-ui/client') diff --git a/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts b/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts index 6d2659248..13d7d53fe 100644 --- a/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts +++ b/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts @@ -28,6 +28,7 @@ export interface IBlueprintState { name?: string; files?: any; filesData?: any; + uploadedFileName?: string; isLoadSuccess?: boolean; isUpdateSuccess?: boolean; isSaveSuccess?: boolean; diff --git a/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts index 37a659da6..b4347d458 100644 --- a/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts +++ b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts @@ -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; diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts index ffe69029b..09fa00315 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts @@ -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 = await zip.files[file].async('string'); diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts index 9c11f7684..1d0ba2c39 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts @@ -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, -- cgit 1.2.3-korg