summaryrefslogtreecommitdiffstats
path: root/cds-ui/client
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/client')
-rw-r--r--cds-ui/client/src/app/common/utility/zipfile-extraction.component.ts12
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts64
2 files changed, 45 insertions, 31 deletions
diff --git a/cds-ui/client/src/app/common/utility/zipfile-extraction.component.ts b/cds-ui/client/src/app/common/utility/zipfile-extraction.component.ts
index fcadee816..279405a6b 100644
--- a/cds-ui/client/src/app/common/utility/zipfile-extraction.component.ts
+++ b/cds-ui/client/src/app/common/utility/zipfile-extraction.component.ts
@@ -39,11 +39,21 @@ export class ZipfileExtractionComponent implements OnInit {
private entryDefinition: string;
validfile: boolean = false;
uploadedFileName: string;
-
+ filesData: any = [];
+
constructor(private loader: LoaderService) { }
ngOnInit() {
}
+
+ 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 = [];
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 08f1ca130..9367c0638 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
@@ -244,9 +244,39 @@ export class EditorComponent implements OnInit {
})
this.fileExtension = this.selectedFile.substr(this.selectedFile.lastIndexOf('.') + 1);
this.setEditorMode();
- if(this.options == '3')
- {
- this.editorReadOnly= true;
+ if (this.options == '3') {
+ this.editorReadOnly = true;
+ }
+ }
+
+ setEditorMode() {
+ switch (this.fileExtension) {
+ case "xml":
+ this.mode = 'xml';
+ break;
+ case "py":
+ this.mode = 'python';
+ break;
+ case "kts":
+ this.mode = 'kotlin';
+ break;
+ case "kt":
+ this.mode = 'kotlin';
+ break;
+ case "txt":
+ this.mode = 'text';
+ break;
+ case "meta":
+ this.mode = 'text';
+ break;
+ case "vtl":
+ this.mode = 'velocity';
+ break;
+ case "properties":
+ this.mode = 'properties';
+ break;
+ default:
+ this.mode = 'json';
}
}
@@ -256,7 +286,6 @@ export class EditorComponent implements OnInit {
.then(blob => {
const formData = new FormData();
formData.append("file", blob);
- // this.editorService.enrich("/enrich-blueprint/", formData)
this.editorService.enrich(formData)
.subscribe(
(response) => {
@@ -276,8 +305,6 @@ export class EditorComponent implements OnInit {
});
}
-
-
saveToBackend() {
this.create();
this.zipFile.generateAsync({ type: "blob" })
@@ -346,30 +373,7 @@ export class EditorComponent implements OnInit {
this.editorService.downloadCBA("/" + this.artifactName + "/" + this.artifactVersion);
}
- setEditorMode() {
- switch (this.fileExtension) {
- case "xml":
- this.mode = 'xml';
- break;
- case "py":
- this.mode = 'python';
- break;
- case "kts":
- this.mode = 'kotlin';
- break;
- case "txt":
- this.mode = 'text';
- break;
- case "meta":
- this.mode = 'text';
- break;
- case "vtl":
- this.mode = 'velocity';
- break;
- default:
- this.mode = 'json';
- }
- }
+
selectFolder(node) {
this.currentFilePath = '';