reload files while uploading every 2.5 seconds
This commit is contained in:
parent
1249e41089
commit
ea07ca5b21
@ -41,7 +41,7 @@
|
||||
<ng-container *ngIf="dossierStats$ | async as stats">
|
||||
<div *ngIf="stats.hasFiles" class="mt-24">
|
||||
<redaction-simple-doughnut-chart
|
||||
[config]="calculateChartConfig(stats.fileCountPerWorkflowStatus)"
|
||||
[config]="calculateChartConfig(stats)"
|
||||
[radius]="63"
|
||||
[strokeWidth]="15"
|
||||
[subtitle]="'dossier-overview.dossier-details.charts.documents-in-dossier' | translate"
|
||||
|
||||
@ -6,15 +6,7 @@ import { UserService } from '@services/user.service';
|
||||
import { FilterService, shareLast, Toaster } from '@iqser/common-ui';
|
||||
import { fileStatusTranslations } from '../../../../translations/file-status-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import {
|
||||
Dossier,
|
||||
DossierAttributeWithValue,
|
||||
DossierStats,
|
||||
FileCountPerWorkflowStatus,
|
||||
IDossierRequest,
|
||||
StatusSorter,
|
||||
User,
|
||||
} from '@red/domain';
|
||||
import { Dossier, DossierAttributeWithValue, DossierStats, IDossierRequest, StatusSorter, User } from '@red/domain';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
@ -65,9 +57,9 @@ export class DossierDetailsComponent {
|
||||
return this._userService.managerUsers.map(manager => manager.id);
|
||||
}
|
||||
|
||||
calculateChartConfig(filesCount: FileCountPerWorkflowStatus): DoughnutChartConfig[] {
|
||||
const documentsChartData: DoughnutChartConfig[] = Object.keys(filesCount).map(status => ({
|
||||
value: filesCount[status],
|
||||
calculateChartConfig(stats: DossierStats): DoughnutChartConfig[] {
|
||||
const documentsChartData: DoughnutChartConfig[] = Object.keys(stats.fileCountPerWorkflowStatus).map(status => ({
|
||||
value: stats.fileCountPerWorkflowStatus[status],
|
||||
color: status,
|
||||
label: fileStatusTranslations[status],
|
||||
key: status,
|
||||
|
||||
@ -37,7 +37,10 @@ export class FileUploadService extends GenericService<IFileUploadResult> {
|
||||
protected readonly _injector: Injector,
|
||||
) {
|
||||
super(_injector, 'upload');
|
||||
interval(2500).subscribe(() => {
|
||||
interval(2500).subscribe(async () => {
|
||||
if (this.activeUploads > 0) {
|
||||
await this._appStateService.reloadActiveDossierFiles();
|
||||
}
|
||||
this._handleUploads();
|
||||
});
|
||||
}
|
||||
@ -174,7 +177,7 @@ export class FileUploadService extends GenericService<IFileUploadResult> {
|
||||
this.activeUploads++;
|
||||
const obs = this.uploadFileForm(uploadFile.dossierId, uploadFile.file);
|
||||
return obs.subscribe(
|
||||
async event => {
|
||||
event => {
|
||||
if (event.type === HttpEventType.UploadProgress) {
|
||||
uploadFile.progress = Math.round((event.loaded / (event.total || event.loaded)) * 100);
|
||||
this._applicationRef.tick();
|
||||
@ -190,7 +193,6 @@ export class FileUploadService extends GenericService<IFileUploadResult> {
|
||||
};
|
||||
}
|
||||
this._removeUpload(uploadFile);
|
||||
await this._appStateService.reloadActiveDossierFiles();
|
||||
}
|
||||
},
|
||||
(err: HttpErrorResponse) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user