loading services corner cases and download api updates

This commit is contained in:
Timo 2021-07-20 12:54:24 +03:00
parent 1c953c5b2f
commit cf583dde4d
5 changed files with 31 additions and 29 deletions

View File

@ -28,7 +28,7 @@ export class DownloadsListScreenComponent implements OnInit {
deleteItem(download: DownloadStatusWrapper) {
this._downloadControllerService
.deleteDownload({ storageId: download.storageId })
.deleteDownload({ storageIds: [download.storageId] })
.subscribe(() => this.fileDownloadService.getDownloadStatus().subscribe());
}
}

View File

@ -147,12 +147,11 @@ export class DossierOverviewBulkActionsComponent {
setToUnderApproval() {
// If more than 1 approver - show dialog and ask who to assign
if (this._appStateService.activeDossier.approverIds.length > 1) {
this._loadingService.start();
this._dialogService.openAssignFileToUserDialog(
this.selectedFiles,
'approver',
() => {
this._loadingService.start();
this.reload.emit();
this._loadingService.stop();
},
@ -189,11 +188,10 @@ export class DossierOverviewBulkActionsComponent {
}
assign() {
this._loadingService.start();
const mode = this.selectedFiles[0].isUnderApproval ? 'approver' : 'reviewer';
this._dialogService.openAssignFileToUserDialog(this.selectedFiles, mode, () => {
this._loadingService.start();
this.reload.emit();
this._loadingService.stop();
});

View File

@ -98,32 +98,35 @@ export class DossierOverviewScreenComponent
}
async ngOnInit(): Promise<void> {
this._fileDropOverlayService.initFileDropHandling();
this.calculateData();
this.addSubscription = timer(0, 7500).subscribe(async () => {
await this._appStateService.reloadActiveDossierFilesIfNecessary();
this._loadEntitiesFromState();
});
this.addSubscription = this._appStateService.fileChanged.subscribe(() => {
this.calculateData();
});
this.addSubscription = this._router.events
.pipe(filter(event => event instanceof NavigationStart))
.subscribe((event: NavigationStart) => {
if (!event.url.endsWith(this._appStateService.activeDossierId)) {
this._lastScrollPosition = this.scrollViewport.measureScrollOffset('top');
}
});
this._loadingService.start();
this.dossierAttributes = await this._dossierAttributesService.getValues(this.activeDossier);
try {
this._fileDropOverlayService.initFileDropHandling();
this._loadingService.stop();
this.calculateData();
this.addSubscription = timer(0, 7500).subscribe(async () => {
await this._appStateService.reloadActiveDossierFilesIfNecessary();
this._loadEntitiesFromState();
});
this.addSubscription = this._appStateService.fileChanged.subscribe(() => {
this.calculateData();
});
this.addSubscription = this._router.events
.pipe(filter(event => event instanceof NavigationStart))
.subscribe((event: NavigationStart) => {
if (!event.url.endsWith(this._appStateService.activeDossierId)) {
this._lastScrollPosition = this.scrollViewport.measureScrollOffset('top');
}
});
this.dossierAttributes = await this._dossierAttributesService.getValues(this.activeDossier);
} catch (e) {
} finally {
this._loadingService.stop();
}
}
ngOnDestroy(): void {

View File

@ -15,6 +15,7 @@ export class LoadingService {
}
start(): void {
console.log('start');
this._loadingEvent.next(true);
this._loadingStarted = new Date().getTime();
}

View File

@ -11,5 +11,5 @@
*/
export interface RemoveDownloadRequest {
storageId?: string;
storageIds?: string[];
}