instant download load page

This commit is contained in:
Timo 2021-02-11 10:47:04 +02:00
parent 431a47eee7
commit cda48fc994
2 changed files with 9 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { FileDownloadService } from '../../upload-download/file-download.service';
import { DownloadStatusWrapper } from '../../upload-download/model/download-status.wrapper';
@ -7,9 +7,13 @@ import { DownloadStatusWrapper } from '../../upload-download/model/download-stat
templateUrl: './downloads-list-screen.component.html',
styleUrls: ['./downloads-list-screen.component.scss']
})
export class DownloadsListScreenComponent {
export class DownloadsListScreenComponent implements OnInit {
constructor(public readonly fileDownloadService: FileDownloadService) {}
ngOnInit(): void {
this.fileDownloadService.getDownloadStatus().subscribe();
}
public get noData(): boolean {
return this.fileDownloadService.downloads.length === 0;
}

View File

@ -32,7 +32,7 @@ export class FileDownloadService {
) {
interval(5000).subscribe((val) => {
if (_permissionsService.isUser()) {
this._getDownloadStatus().subscribe(() => {});
this.getDownloadStatus().subscribe(() => {});
}
});
}
@ -47,12 +47,12 @@ export class FileDownloadService {
})
.pipe(
mergeMap(() => {
return this._getDownloadStatus();
return this.getDownloadStatus();
})
);
}
private _getDownloadStatus() {
public getDownloadStatus() {
return this._downloadControllerService.getDownloadStatus().pipe(
tap((statusResponse) => {
this.downloads = statusResponse.downloadStatus.map((d) => new DownloadStatusWrapper(d));