summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
diff options
context:
space:
mode:
authorshaaban Altanany <shaaban.eltanany.ext@orange.com>2020-01-07 12:08:44 +0200
committershaaban Altanany <shaaban.eltanany.ext@orange.com>2020-01-07 12:08:44 +0200
commitba3756e38e5b22fccd08e68f4ecc4cc95f9440c2 (patch)
treeafd534ecf634acae94ea0de90aefa93e67074731 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
parent077b1ab152c61695ac4d007035dfb81e9aef2c61 (diff)
adding design of first two tabs in creation package component
Issue-ID: CCSDK-2014 Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com> Change-Id: Ib4cf67f38511fbabc9d69313e9e88edadd7b6c4a
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts36
1 files changed, 33 insertions, 3 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
index 8aa9d5e6d..9b65885a5 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts
@@ -1,6 +1,8 @@
import {Component, OnInit} from '@angular/core';
import {NgxFileDropEntry, FileSystemFileEntry, FileSystemDirectoryEntry} from 'ngx-file-drop';
import {PackageCreationStore} from '../package-creation.store';
+import {Observable} from 'rxjs';
+import {HttpClient} from '@angular/common/http';
@Component({
@@ -9,7 +11,10 @@ import {PackageCreationStore} from '../package-creation.store';
styleUrls: ['./imports-tab.component.css']
})
export class ImportsTabComponent {
- constructor(private packageCreationStore: PackageCreationStore) {
+
+ fileContent: string | ArrayBuffer = '';
+
+ constructor(private packageCreationStore: PackageCreationStore, private http: HttpClient) {
}
public files: NgxFileDropEntry[] = [];
@@ -21,16 +26,28 @@ export class ImportsTabComponent {
// Is it a file?
if (droppedFile.fileEntry.isFile) {
const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;
+
fileEntry.file((file: File) => {
console.log(droppedFile.relativePath, file);
- this.packageCreationStore.addDefinition(droppedFile.relativePath, '');
+
+ const formData = new FormData();
+ formData.append('logo', file, droppedFile.relativePath);
+ console.log(formData);
+
+ this.packageCreationStore.addDefinition(droppedFile.relativePath, this.getContent(droppedFile.relativePath));
});
} else {
// It was a directory (empty directories are added, otherwise only files)
const fileEntry = droppedFile.fileEntry as FileSystemDirectoryEntry;
console.log(droppedFile.relativePath, fileEntry);
- this.packageCreationStore.addDefinition(droppedFile.relativePath, '');
+
+
+ /* const formData = new FormData();
+ formData.append('logo', droppedFile, droppedFile.relativePath);
+ console.log(formData);*/
+
+ this.packageCreationStore.addDefinition(droppedFile.relativePath, this.getContent(droppedFile.relativePath));
}
}
@@ -43,4 +60,17 @@ export class ImportsTabComponent {
public fileLeave(event) {
console.log(event);
}
+
+
+ getContent(filePath: string) {
+ let content = '';
+ this.getJSON(filePath).subscribe(data => {
+ content = data;
+ });
+ return content;
+ }
+
+ public getJSON(filePath: string): Observable<any> {
+ return this.http.get(filePath);
+ }
}