From eb63ec6895966565aa80a145bddf2c3054555467 Mon Sep 17 00:00:00 2001 From: Timo Date: Thu, 3 Dec 2020 11:00:33 +0200 Subject: [PATCH] fix progress attempt --- apps/red-ui/src/app/upload/file-upload.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/upload/file-upload.service.ts b/apps/red-ui/src/app/upload/file-upload.service.ts index 2bb40d6f2..089ff78fa 100644 --- a/apps/red-ui/src/app/upload/file-upload.service.ts +++ b/apps/red-ui/src/app/upload/file-upload.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { ApplicationRef, Injectable } from '@angular/core'; import { FileUploadModel } from './model/file-upload.model'; import { AppStateService } from '../state/app-state.service'; import { HttpEventType } from '@angular/common/http'; @@ -16,7 +16,11 @@ export class FileUploadService { private _pendingUploads: FileUploadModel[] = []; private _activeUploads: Subscription[] = []; - constructor(private readonly _appStateService: AppStateService, private readonly _fileManagementControllerService: FileManagementControllerService) { + constructor( + private readonly _appStateService: AppStateService, + private readonly _applicationRef: ApplicationRef, + private readonly _fileManagementControllerService: FileManagementControllerService + ) { interval(2500).subscribe((val) => { this._handleUploads(); }); @@ -69,6 +73,7 @@ export class FileUploadService { async (event) => { if (event.type === HttpEventType.UploadProgress) { uploadFile.progress = Math.round((event.loaded / (event.total || event.loaded)) * 100); + this._applicationRef.tick(); } if (event.type === HttpEventType.Response) { if (event.status < 300) {