dockerfile-build-form component working with promise-based method
This commit is contained in:
parent
4e913f106d
commit
4303f658e8
1 changed files with 11 additions and 6 deletions
|
@ -15,14 +15,19 @@ export class DockerfileServiceImpl implements DockerfileService {
|
|||
return new Promise((resolve, reject) => {
|
||||
var reader: FileReader = this.fileReaderFactory();
|
||||
reader.onload = (event: any) => {
|
||||
// FIXME: Debugging
|
||||
console.log(event.target.result);
|
||||
|
||||
this.DataFileService.readDataArrayAsPossibleArchive(event.target.result,
|
||||
(files: any[]) => {
|
||||
this.processFiles(files)
|
||||
.then((dockerfileInfo: DockerfileInfoImpl) => resolve(dockerfileInfo))
|
||||
.catch((error: string) => reject(error));
|
||||
if (files.length > 0) {
|
||||
this.processFiles(files)
|
||||
.then((dockerfileInfo: DockerfileInfoImpl) => resolve(dockerfileInfo))
|
||||
.catch((error: string) => reject(error));
|
||||
}
|
||||
// Not an archive. Read directly as a single file.
|
||||
else {
|
||||
this.processFile(event.target.result)
|
||||
.then((dockerfileInfo: DockerfileInfoImpl) => resolve(dockerfileInfo))
|
||||
.catch((error: string) => reject(error));
|
||||
}
|
||||
},
|
||||
() => {
|
||||
// Not an archive. Read directly as a single file.
|
||||
|
|
Reference in a new issue