diff --git a/libs/portal/downloads/feature/src/lib/downloads.component.ts b/libs/portal/downloads/feature/src/lib/downloads.component.ts index 9af28ecca..ab84c0c7b 100644 --- a/libs/portal/downloads/feature/src/lib/downloads.component.ts +++ b/libs/portal/downloads/feature/src/lib/downloads.component.ts @@ -191,9 +191,9 @@ export class DownloadsComponent { constructor() { effect(() => { - const playlistId = this.playlistId(); + this.playlistId(); this.collectionContext.setCategoryId('all'); - void this.downloadsService.loadDownloads(playlistId || undefined); + void this.downloadsService.loadDownloads(); }); } diff --git a/libs/services/src/lib/downloads.service.spec.ts b/libs/services/src/lib/downloads.service.spec.ts index 7455302e3..8ae813d17 100644 --- a/libs/services/src/lib/downloads.service.spec.ts +++ b/libs/services/src/lib/downloads.service.spec.ts @@ -37,7 +37,7 @@ type DownloadsElectronStub = { [number, string] >; downloadsSelectFolder?: jest.Mock, []>; - downloadsGetList: jest.Mock, [string?]>; + downloadsGetList: jest.Mock, []>; }; describe('DownloadsService', () => { @@ -121,7 +121,7 @@ describe('DownloadsService', () => { } }); - it('tracks loading and loaded state around a successful download list request', async () => { + it('loads the global download list without a playlist filter and tracks request state', async () => { const item = createDownload(1); const pending = createDeferred(); const electron = { @@ -130,11 +130,11 @@ describe('DownloadsService', () => { testWindow.electron = electron; const service = createService(); - const request = service.loadDownloads('playlist-1'); + const request = service.loadDownloads(); expect(service.isLoadingDownloads()).toBe(true); expect(service.hasLoadedDownloads()).toBe(false); - expect(electron.downloadsGetList).toHaveBeenCalledWith('playlist-1'); + expect(electron.downloadsGetList).toHaveBeenCalledWith(); pending.resolve([item]); await request; @@ -245,8 +245,8 @@ describe('DownloadsService', () => { testWindow.electron = electron; const service = createService(); - const firstRequest = service.loadDownloads('playlist-old'); - const secondRequest = service.loadDownloads('playlist-new'); + const firstRequest = service.loadDownloads(); + const secondRequest = service.loadDownloads(); expect(service.isLoadingDownloads()).toBe(true); @@ -262,14 +262,8 @@ describe('DownloadsService', () => { expect(service.downloads()).toEqual([latestItem]); expect(service.isLoadingDownloads()).toBe(false); - expect(electron.downloadsGetList).toHaveBeenNthCalledWith( - 1, - 'playlist-old' - ); - expect(electron.downloadsGetList).toHaveBeenNthCalledWith( - 2, - 'playlist-new' - ); + expect(electron.downloadsGetList).toHaveBeenNthCalledWith(1); + expect(electron.downloadsGetList).toHaveBeenNthCalledWith(2); }); it('reports paused content and resumes it by content identity', async () => { diff --git a/libs/services/src/lib/downloads.service.ts b/libs/services/src/lib/downloads.service.ts index 92c7e4fe3..07c46a4b7 100644 --- a/libs/services/src/lib/downloads.service.ts +++ b/libs/services/src/lib/downloads.service.ts @@ -106,14 +106,14 @@ export class DownloadsService implements OnDestroy { /** * Load downloads from the backend */ - async loadDownloads(playlistId?: string): Promise { + async loadDownloads(): Promise { if (!this.isAvailable()) return; const requestId = ++this.loadDownloadsRequestId; this._isLoadingDownloads.set(true); try { - const list = await window.electron.downloadsGetList(playlistId); + const list = await window.electron.downloadsGetList(); if (requestId === this.loadDownloadsRequestId) { this.downloads.set(list); this._hasLoadedDownloads.set(true); diff --git a/libs/workspace/shell/feature/src/lib/workspace-shell/components/workspace-shell-header/workspace-shell-header.component.html b/libs/workspace/shell/feature/src/lib/workspace-shell/components/workspace-shell-header/workspace-shell-header.component.html index cde9d7359..e4e139e91 100644 --- a/libs/workspace/shell/feature/src/lib/workspace-shell/components/workspace-shell-header/workspace-shell-header.component.html +++ b/libs/workspace/shell/feature/src/lib/workspace-shell/components/workspace-shell-header/workspace-shell-header.component.html @@ -121,6 +121,15 @@ } + @if (activeDownloadsCount() > 0) { + + }