summaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app/feature-modules/blueprint/modify-template
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/blueprint/modify-template')
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts13
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts9
2 files changed, 14 insertions, 8 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 1f8526a53..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)) {
@@ -176,6 +178,7 @@ export class EditorComponent implements OnInit {
this.artifactVersion = metadatavalues[4];
this.editor.getEditor().getSession().setTabSize(2);
this.editor.getEditor().getSession().setUseWrapMode(true);
+ this.editor.getEditor().getSession().setValue("");
this.setEditorMode();
})
}
@@ -201,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);
@@ -217,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;
}
})
@@ -405,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');
@@ -425,6 +431,7 @@ export class EditorComponent implements OnInit {
if (this.validfile) {
this.fetchTOSACAMetadata();
+ this.filesData = this.paths;
this.tree = this.arrangeTreeData(this.paths);
} else {
alert('Please update proper file with TOSCA metadata');
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
index 63c8019c3..ec2524422 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
@@ -24,7 +24,6 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, observable } from 'rxjs';
import { ApiService } from '../../../../common/core/services/api.service';
-import { LoopbackConfig } from '../../../../common/constants/app-constants';
import { saveAs } from 'file-saver';
@Injectable()
@@ -35,10 +34,10 @@ export class EditorService {
}
enrich(uri: string, body: FormData): Observable<any> {
- return this.api.post(LoopbackConfig.url + uri, body, { responseType: 'blob' });
+ return this.api.post(uri, body, { responseType: 'blob' });
}
downloadCBA(uri: string): string {
- this.api.get(LoopbackConfig.url + uri, { responseType: 'blob' })
+ this.api.get(uri, { responseType: 'blob' })
.subscribe(response => {
let blob = new Blob([response], { 'type': "application/octet-stream" });
saveAs(blob, "CBA.zip");
@@ -49,11 +48,11 @@ export class EditorService {
}
post(uri: string, body: any | null, options?: any): Observable<any> {
- return this.api.post(LoopbackConfig.url + uri, body, options);
+ return this.api.post(uri, body, options);
}
deployPost(uri: string, body: any | null, options?: any): Observable<any> {
- return this.api.post(LoopbackConfig.url + uri, body, { responseType: 'text' });
+ return this.api.post(uri, body, { responseType: 'text' });
}
} \ No newline at end of file