New: Added column in Queue

Closes #6270
This commit is contained in:
Rubicj 2024-01-15 21:28:28 -08:00 committed by GitHub
parent ec91142c85
commit 57445bbe57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 36 additions and 4 deletions

View File

@ -100,6 +100,7 @@ class QueueRow extends Component {
outputPath, outputPath,
downloadClient, downloadClient,
estimatedCompletionTime, estimatedCompletionTime,
added,
timeleft, timeleft,
size, size,
sizeleft, sizeleft,
@ -362,6 +363,15 @@ class QueueRow extends Component {
); );
} }
if (name === 'added') {
return (
<RelativeDateCellConnector
key={name}
date={added}
/>
);
}
if (name === 'actions') { if (name === 'actions') {
return ( return (
<TableRowCell <TableRowCell
@ -441,6 +451,7 @@ QueueRow.propTypes = {
outputPath: PropTypes.string, outputPath: PropTypes.string,
downloadClient: PropTypes.string, downloadClient: PropTypes.string,
estimatedCompletionTime: PropTypes.string, estimatedCompletionTime: PropTypes.string,
added: PropTypes.string,
timeleft: PropTypes.string, timeleft: PropTypes.string,
size: PropTypes.number, size: PropTypes.number,
sizeleft: PropTypes.number, sizeleft: PropTypes.number,

View File

@ -158,6 +158,12 @@ export const defaultState = {
isSortable: true, isSortable: true,
isVisible: true isVisible: true
}, },
{
name: 'added',
label: () => translate('Added'),
isSortable: true,
isVisible: false
},
{ {
name: 'progress', name: 'progress',
label: () => translate('Progress'), label: () => translate('Progress'),

View File

@ -28,6 +28,7 @@ interface Queue extends ModelBase {
sizeleft: number; sizeleft: number;
timeleft: string; timeleft: string;
estimatedCompletionTime: string; estimatedCompletionTime: string;
added?: string;
status: string; status: string;
trackedDownloadStatus: QueueTrackedDownloadStatus; trackedDownloadStatus: QueueTrackedDownloadStatus;
trackedDownloadState: QueueTrackedDownloadState; trackedDownloadState: QueueTrackedDownloadState;

View File

@ -368,6 +368,7 @@ namespace NzbDrone.Core.Download.Pending
RemoteEpisode = pendingRelease.RemoteEpisode, RemoteEpisode = pendingRelease.RemoteEpisode,
Timeleft = timeleft, Timeleft = timeleft,
EstimatedCompletionTime = ect, EstimatedCompletionTime = ect,
Added = pendingRelease.Added,
Status = pendingRelease.Reason.ToString(), Status = pendingRelease.Reason.ToString(),
Protocol = pendingRelease.RemoteEpisode.Release.DownloadProtocol, Protocol = pendingRelease.RemoteEpisode.Release.DownloadProtocol,
Indexer = pendingRelease.RemoteEpisode.Release.Indexer Indexer = pendingRelease.RemoteEpisode.Release.Indexer

View File

@ -15,6 +15,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
public TrackedDownloadStatusMessage[] StatusMessages { get; private set; } public TrackedDownloadStatusMessage[] StatusMessages { get; private set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
public string Indexer { get; set; } public string Indexer { get; set; }
public DateTime? Added { get; set; }
public bool IsTrackable { get; set; } public bool IsTrackable { get; set; }
public bool HasNotifiedManualInteractionRequired { get; set; } public bool HasNotifiedManualInteractionRequired { get; set; }

View File

@ -135,6 +135,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == EpisodeHistoryEventType.Grabbed); var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == EpisodeHistoryEventType.Grabbed);
trackedDownload.Indexer = grabbedEvent?.Data["indexer"]; trackedDownload.Indexer = grabbedEvent?.Data["indexer"];
trackedDownload.Added = grabbedEvent?.Date;
if (parsedEpisodeInfo == null || if (parsedEpisodeInfo == null ||
trackedDownload.RemoteEpisode == null || trackedDownload.RemoteEpisode == null ||

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace NzbDrone.Core.Queue namespace NzbDrone.Core.Queue
{ {
public class EstimatedCompletionTimeComparer : IComparer<DateTime?> public class DatetimeComparer : IComparer<DateTime?>
{ {
public int Compare(DateTime? x, DateTime? y) public int Compare(DateTime? x, DateTime? y)
{ {

View File

@ -21,6 +21,7 @@ namespace NzbDrone.Core.Queue
public decimal Sizeleft { get; set; } public decimal Sizeleft { get; set; }
public TimeSpan? Timeleft { get; set; } public TimeSpan? Timeleft { get; set; }
public DateTime? EstimatedCompletionTime { get; set; } public DateTime? EstimatedCompletionTime { get; set; }
public DateTime? Added { get; set; }
public string Status { get; set; } public string Status { get; set; }
public TrackedDownloadStatus? TrackedDownloadStatus { get; set; } public TrackedDownloadStatus? TrackedDownloadStatus { get; set; }
public TrackedDownloadState? TrackedDownloadState { get; set; } public TrackedDownloadState? TrackedDownloadState { get; set; }

View File

@ -79,7 +79,8 @@ namespace NzbDrone.Core.Queue
Protocol = trackedDownload.Protocol, Protocol = trackedDownload.Protocol,
DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name, DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name,
Indexer = trackedDownload.Indexer, Indexer = trackedDownload.Indexer,
OutputPath = trackedDownload.DownloadItem.OutputPath.ToString() OutputPath = trackedDownload.DownloadItem.OutputPath.ToString(),
Added = trackedDownload.Added
}; };
queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}-ep{episode?.Id ?? 0}"); queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}-ep{episode?.Id ?? 0}");

View File

@ -193,9 +193,16 @@ namespace Sonarr.Api.V3.Queue
else if (pagingSpec.SortKey == "estimatedCompletionTime") else if (pagingSpec.SortKey == "estimatedCompletionTime")
{ {
ordered = ascending ordered = ascending
? fullQueue.OrderBy(q => q.EstimatedCompletionTime, new EstimatedCompletionTimeComparer()) ? fullQueue.OrderBy(q => q.EstimatedCompletionTime, new DatetimeComparer())
: fullQueue.OrderByDescending(q => q.EstimatedCompletionTime, : fullQueue.OrderByDescending(q => q.EstimatedCompletionTime,
new EstimatedCompletionTimeComparer()); new DatetimeComparer());
}
else if (pagingSpec.SortKey == "added")
{
ordered = ascending
? fullQueue.OrderBy(q => q.Added, new DatetimeComparer())
: fullQueue.OrderByDescending(q => q.Added,
new DatetimeComparer());
} }
else if (pagingSpec.SortKey == "protocol") else if (pagingSpec.SortKey == "protocol")
{ {

View File

@ -29,6 +29,7 @@ namespace Sonarr.Api.V3.Queue
public decimal Sizeleft { get; set; } public decimal Sizeleft { get; set; }
public TimeSpan? Timeleft { get; set; } public TimeSpan? Timeleft { get; set; }
public DateTime? EstimatedCompletionTime { get; set; } public DateTime? EstimatedCompletionTime { get; set; }
public DateTime? Added { get; set; }
public string Status { get; set; } public string Status { get; set; }
public TrackedDownloadStatus? TrackedDownloadStatus { get; set; } public TrackedDownloadStatus? TrackedDownloadStatus { get; set; }
public TrackedDownloadState? TrackedDownloadState { get; set; } public TrackedDownloadState? TrackedDownloadState { get; set; }
@ -71,6 +72,7 @@ namespace Sonarr.Api.V3.Queue
Sizeleft = model.Sizeleft, Sizeleft = model.Sizeleft,
Timeleft = model.Timeleft, Timeleft = model.Timeleft,
EstimatedCompletionTime = model.EstimatedCompletionTime, EstimatedCompletionTime = model.EstimatedCompletionTime,
Added = model.Added,
Status = model.Status.FirstCharToLower(), Status = model.Status.FirstCharToLower(),
TrackedDownloadStatus = model.TrackedDownloadStatus, TrackedDownloadStatus = model.TrackedDownloadStatus,
TrackedDownloadState = model.TrackedDownloadState, TrackedDownloadState = model.TrackedDownloadState,