From 50f48277e50657cc53e095d61dae0566e5cdd3d4 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 7 Nov 2023 20:25:17 +0200 Subject: [PATCH] Don't show already imported movies as downloading in Movies index --- frontend/src/App/State/QueueAppState.ts | 32 +------------- .../Index/createMovieQueueDetailsSelector.ts | 5 ++- frontend/src/typings/Queue.ts | 43 +++++++++++++++++++ 3 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 frontend/src/typings/Queue.ts diff --git a/frontend/src/App/State/QueueAppState.ts b/frontend/src/App/State/QueueAppState.ts index 2ec27678f..05d74acac 100644 --- a/frontend/src/App/State/QueueAppState.ts +++ b/frontend/src/App/State/QueueAppState.ts @@ -1,40 +1,10 @@ -import ModelBase from 'App/ModelBase'; -import Language from 'Language/Language'; -import { QualityModel } from 'Quality/Quality'; -import CustomFormat from 'typings/CustomFormat'; +import Queue from 'typings/Queue'; import AppSectionState, { AppSectionFilterState, AppSectionItemState, Error, } from './AppSectionState'; -export interface StatusMessage { - title: string; - messages: string[]; -} - -export interface Queue extends ModelBase { - languages: Language[]; - quality: QualityModel; - customFormats: CustomFormat[]; - size: number; - title: string; - sizeleft: number; - timeleft: string; - estimatedCompletionTime: string; - status: string; - trackedDownloadStatus: string; - trackedDownloadState: string; - statusMessages: StatusMessage[]; - errorMessage: string; - downloadId: string; - protocol: string; - downloadClient: string; - outputPath: string; - movieHasFile: boolean; - movieId?: number; -} - export interface QueueDetailsAppState extends AppSectionState { params: unknown; } diff --git a/frontend/src/Movie/Index/createMovieQueueDetailsSelector.ts b/frontend/src/Movie/Index/createMovieQueueDetailsSelector.ts index 486f385f5..d3dcbbe59 100644 --- a/frontend/src/Movie/Index/createMovieQueueDetailsSelector.ts +++ b/frontend/src/Movie/Index/createMovieQueueDetailsSelector.ts @@ -11,7 +11,10 @@ function createMovieQueueDetailsSelector(movieId: number) { (queueItems) => { return queueItems.reduce( (acc: MovieQueueDetails, item) => { - if (item.movieId !== movieId) { + if ( + item.trackedDownloadState === 'imported' || + item.movieId !== movieId + ) { return acc; } diff --git a/frontend/src/typings/Queue.ts b/frontend/src/typings/Queue.ts new file mode 100644 index 000000000..c95350c71 --- /dev/null +++ b/frontend/src/typings/Queue.ts @@ -0,0 +1,43 @@ +import ModelBase from 'App/ModelBase'; +import Language from 'Language/Language'; +import { QualityModel } from 'Quality/Quality'; +import CustomFormat from 'typings/CustomFormat'; + +export type QueueTrackedDownloadStatus = 'ok' | 'warning' | 'error'; + +export type QueueTrackedDownloadState = + | 'downloading' + | 'importPending' + | 'importing' + | 'imported' + | 'failedPending' + | 'failed' + | 'ignored'; + +export interface StatusMessage { + title: string; + messages: string[]; +} + +interface Queue extends ModelBase { + languages: Language[]; + quality: QualityModel; + customFormats: CustomFormat[]; + size: number; + title: string; + sizeleft: number; + timeleft: string; + estimatedCompletionTime: string; + status: string; + trackedDownloadStatus: QueueTrackedDownloadStatus; + trackedDownloadState: QueueTrackedDownloadState; + statusMessages: StatusMessage[]; + errorMessage: string; + downloadId: string; + protocol: string; + downloadClient: string; + outputPath: string; + movieHasFile: boolean; + movieId?: number; +} +export default Queue;