From cda48fc99480a9daf1567074b819d9d9870aa1c7 Mon Sep 17 00:00:00 2001 From: Timo Date: Thu, 11 Feb 2021 10:47:04 +0200 Subject: [PATCH] instant download load page --- .../downloads-list-screen.component.ts | 8 ++++++-- .../src/app/upload-download/file-download.service.ts | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/screens/downloads-list-screen/downloads-list-screen.component.ts b/apps/red-ui/src/app/screens/downloads-list-screen/downloads-list-screen.component.ts index 56cbeb7f2..d80c007ff 100644 --- a/apps/red-ui/src/app/screens/downloads-list-screen/downloads-list-screen.component.ts +++ b/apps/red-ui/src/app/screens/downloads-list-screen/downloads-list-screen.component.ts @@ -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; } diff --git a/apps/red-ui/src/app/upload-download/file-download.service.ts b/apps/red-ui/src/app/upload-download/file-download.service.ts index 53958618d..b5637115a 100644 --- a/apps/red-ui/src/app/upload-download/file-download.service.ts +++ b/apps/red-ui/src/app/upload-download/file-download.service.ts @@ -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));