diff options
author | 2019-04-15 15:03:52 +0530 | |
---|---|---|
committer | 2019-04-15 15:04:00 +0530 | |
commit | 789d7aed42ec7ee9bff6e0f1b09c71696a53d26b (patch) | |
tree | 8308c2b56a3cc57d351cdcaba75f5a256f514382 /cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts | |
parent | 1c98d5673c70325bb9913419e730a31af009b6df (diff) |
Fixed issue ccsdk-1223
User was unable to add folde/file in the root level of the file-manegr.
fixed this issue
Issue-ID: CCSDK-1223
Change-Id: I6f9960d3d8545b364385cc235f9117a488a5cef1
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts')
-rw-r--r-- | cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts | 66 |
1 files changed, 47 insertions, 19 deletions
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 73cc72cfd..1f8526a53 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 @@ -165,7 +165,7 @@ export class EditorComponent implements OnInit { blueprint.push(this.blueprintdata[key]); } } - this.metadata=blueprintState.blueprint.metadata; + this.metadata = blueprintState.blueprint.metadata; let metadatavalues = []; for (let key in this.metadata) { if (this.metadata.hasOwnProperty(key)) { @@ -181,21 +181,21 @@ export class EditorComponent implements OnInit { } updateBlueprint() { - console.log(this.blueprint); - this.filesData.forEach(fileNode => { - if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) { - fileNode.data = this.text; - } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) { - // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) { - fileNode.data = this.text; - } - }); + // console.log(this.blueprint); + // this.filesData.forEach(fileNode => { + // if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) { + // fileNode.data = this.text; + // } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) { + // // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) { + // fileNode.data = this.text; + // } + // }); - if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) { - this.blueprint = JSON.parse(this.text); - } else { - this.blueprint = this.blueprintdata; - } + // if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) { + // this.blueprint = JSON.parse(this.text); + // } else { + // this.blueprint = this.blueprintdata; + // } let blueprintState = { blueprint: this.blueprint, @@ -243,11 +243,11 @@ export class EditorComponent implements OnInit { console.log("processed"); } }); - window.alert('Blueprint enriched successfully' ); + window.alert('Blueprint enriched successfully'); }); }); } - + saveToBackend() { @@ -300,7 +300,9 @@ export class EditorComponent implements OnInit { create() { this.filesData.forEach((path) => { - this.zipFile.file(path.name, path.data); + let index = path.name.indexOf("/"); + let name = path.name.slice(index + 1, path.name.length); + this.zipFile.file(name, path.data); }); } @@ -318,6 +320,13 @@ export class EditorComponent implements OnInit { // console.log(error); // } // ); + + // this.create(); + // var zipFilename = "baseconfiguration.zip"; + // this.zipFile.generateAsync({ type: "blob" }) + // .then(blob => { + // saveAs(blob, zipFilename); + // }); } setEditorMode() { switch (this.fileExtension) { @@ -436,7 +445,7 @@ export class EditorComponent implements OnInit { this.blueprintName = (((toscaData['Entry-Definitions']).split('/'))[1]).toString();; console.log(toscaData); } - + arrangeTreeData(paths) { const tree = []; @@ -557,4 +566,23 @@ export class EditorComponent implements OnInit { return paramValue; } } + + saveEditedChanges() { + this.filesData.forEach(fileNode => { + if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) { + fileNode.data = this.text; + } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) { + // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) { + fileNode.data = this.text; + } + }); + + if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) { + this.blueprint = JSON.parse(this.text); + } else { + this.blueprint = this.blueprintdata; + } + + this.updateBlueprint(); + } } |