From e4b21306b15a17ed24f5e873b58167261a747cb9 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Fri, 19 Jul 2019 09:36:05 +0200 Subject: [PATCH] Fix some issues --- projects/common/ng-package.json | 5 ++- .../resumable-file-upload.component.html | 2 +- .../resumable-file-upload.service.ts | 36 ++++++++++++++++--- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/projects/common/ng-package.json b/projects/common/ng-package.json index 713d998..23ce9f8 100644 --- a/projects/common/ng-package.json +++ b/projects/common/ng-package.json @@ -2,7 +2,10 @@ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "dest": "../../dist/common", "lib": { - "entryFile": "src/public-api.ts" + "entryFile": "src/public-api.ts", + "umdModuleIds": { + "my-data": "my-data" + } }, "whitelistedNonPeerDependencies": [ "." diff --git a/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.html b/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.html index 278221c..04194f1 100644 --- a/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.html +++ b/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.component.html @@ -11,7 +11,7 @@ diff --git a/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.service.ts b/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.service.ts index d6166a5..82de934 100644 --- a/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.service.ts +++ b/projects/common/src/lib/components/resumable-file-upload/resumable-file-upload.service.ts @@ -10,7 +10,7 @@ import { AppConfig } from '../../shared/app.config'; export class ResumableFileUploadService implements OnDestroy{ public files: Array = new Array(); public isUploading = false; - public totalProgress = "0"; + public totalProgress = 0; public isClosed = true; public isMinimized = false; public parentCode: string; @@ -38,19 +38,45 @@ export class ResumableFileUploadService implements OnDestroy{ } } + updatetotalprogress() { + var totalProgress =0; + for(var i =0;i f.identifier == state.uploadId ) + if(file) { + file.progress = (state.progress?state.progress:0); + this.updatetotalprogress(); + } };break; - case "uploading": case "complete": { var file =this.files.find((f) => f.identifier == state.uploadId ) if(file) { - file.progress = (state.progress * 100) + '%'; + file.progress = (state.progress?state.progress:0); + this.updatetotalprogress(); } + file.success=true; + };break; + case "error": { + var file =this.files.find((f) => f.identifier == state.uploadId ) + if(file) { + file.error=true; + file.errorMessage = state.response; + } };break; } + this.refresh.next({}); } addFiles = (files: any[], event: any, geoRefJson?: string, attributes?: any) => { @@ -97,7 +123,7 @@ export class ResumableFileUploadService implements OnDestroy{ export class File { private file: any; public fileName: string; - public progress: string; + public progress: number; public identifier: string; public success: boolean; public error: boolean; @@ -107,7 +133,7 @@ export class File { constructor(state: UploadState) { this.file = state; this.fileName = state.file.name; - this.progress = (state.progress * 100) + '%'; + this.progress = state.progress?state.progress:0; this.identifier = state.uploadId; this.success = false; this.error = false;