diff options
author | shaaban Altanany <shaaban.eltanany.ext@orange.com> | 2020-01-05 12:03:05 +0200 |
---|---|---|
committer | shaaban Altanany <shaaban.eltanany.ext@orange.com> | 2020-01-05 14:30:43 +0200 |
commit | 077b1ab152c61695ac4d007035dfb81e9aef2c61 (patch) | |
tree | 62d9d465e0273be7d5c57127ed9afb6389303ca9 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts | |
parent | 4f4e2de08d3c6259da2497950a96d549d3e82f8a (diff) |
add importTab component in package creation
Issue-ID: CCSDK-2016
Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com>
Change-Id: I828f9891863224cd3c70dbcaf1149efdff394c6e
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.ts | 46 |
1 files changed, 46 insertions, 0 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 new file mode 100644 index 000000000..8aa9d5e6d --- /dev/null +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/imports-tab/imports-tab.component.ts @@ -0,0 +1,46 @@ +import {Component, OnInit} from '@angular/core'; +import {NgxFileDropEntry, FileSystemFileEntry, FileSystemDirectoryEntry} from 'ngx-file-drop'; +import {PackageCreationStore} from '../package-creation.store'; + + +@Component({ + selector: 'app-imports-tab', + templateUrl: './imports-tab.component.html', + styleUrls: ['./imports-tab.component.css'] +}) +export class ImportsTabComponent { + constructor(private packageCreationStore: PackageCreationStore) { + } + + public files: NgxFileDropEntry[] = []; + + public dropped(files: NgxFileDropEntry[]) { + this.files = files; + for (const droppedFile of files) { + + // 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, ''); + + }); + } 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, ''); + + } + } + } + + public fileOver(event) { + console.log(event); + } + + public fileLeave(event) { + console.log(event); + } +} |