New: Added column in Queue

(cherry picked from commit 57445bbe57a84990e284ef97d42455a06587e1ee)

Closes #4460
pull/4470/head
Rubicj 4 months ago committed by Bogdan
parent 3f865fd8e8
commit 829ef83e00

@ -100,6 +100,7 @@ class QueueRow extends Component {
downloadClient, downloadClient,
downloadForced, downloadForced,
estimatedCompletionTime, estimatedCompletionTime,
added,
timeleft, timeleft,
size, size,
sizeleft, sizeleft,
@ -328,6 +329,15 @@ class QueueRow extends Component {
); );
} }
if (name === 'added') {
return (
<RelativeDateCellConnector
key={name}
date={added}
/>
);
}
if (name === 'actions') { if (name === 'actions') {
return ( return (
<TableRowCell <TableRowCell
@ -424,6 +434,7 @@ QueueRow.propTypes = {
downloadClient: PropTypes.string, downloadClient: PropTypes.string,
downloadForced: PropTypes.bool.isRequired, downloadForced: PropTypes.bool.isRequired,
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,

@ -146,6 +146,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'),

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

@ -181,9 +181,16 @@ namespace Lidarr.Api.V1.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")
{ {

@ -26,6 +26,7 @@ namespace Lidarr.Api.V1.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; }
@ -66,6 +67,7 @@ namespace Lidarr.Api.V1.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,

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

@ -1,3 +1,4 @@
using System;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -14,11 +15,12 @@ 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 TrackedDownload() public TrackedDownload()
{ {
StatusMessages = System.Array.Empty<TrackedDownloadStatusMessage>(); StatusMessages = Array.Empty<TrackedDownloadStatusMessage>();
} }
public void Warn(string message, params object[] args) public void Warn(string message, params object[] args)

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

@ -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)
{ {

@ -19,6 +19,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; }

@ -89,7 +89,8 @@ namespace NzbDrone.Core.Queue
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(),
DownloadForced = downloadForced DownloadForced = downloadForced,
Added = trackedDownload.Added
}; };
queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}-album{album?.Id ?? 0}"); queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}-album{album?.Id ?? 0}");

Loading…
Cancel
Save