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

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

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

@ -181,9 +181,16 @@ namespace Lidarr.Api.V1.Queue
else if (pagingSpec.SortKey == "estimatedCompletionTime")
{
ordered = ascending
? fullQueue.OrderBy(q => q.EstimatedCompletionTime, new EstimatedCompletionTimeComparer())
? fullQueue.OrderBy(q => q.EstimatedCompletionTime, new DatetimeComparer())
: 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")
{

@ -26,6 +26,7 @@ namespace Lidarr.Api.V1.Queue
public decimal Sizeleft { get; set; }
public TimeSpan? Timeleft { get; set; }
public DateTime? EstimatedCompletionTime { get; set; }
public DateTime? Added { get; set; }
public string Status { get; set; }
public TrackedDownloadStatus? TrackedDownloadStatus { get; set; }
public TrackedDownloadState? TrackedDownloadState { get; set; }
@ -66,6 +67,7 @@ namespace Lidarr.Api.V1.Queue
Sizeleft = model.Sizeleft,
Timeleft = model.Timeleft,
EstimatedCompletionTime = model.EstimatedCompletionTime,
Added = model.Added,
Status = model.Status.FirstCharToLower(),
TrackedDownloadStatus = model.TrackedDownloadStatus,
TrackedDownloadState = model.TrackedDownloadState,

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

@ -1,3 +1,4 @@
using System;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model;
@ -14,11 +15,12 @@ namespace NzbDrone.Core.Download.TrackedDownloads
public TrackedDownloadStatusMessage[] StatusMessages { get; private set; }
public DownloadProtocol Protocol { get; set; }
public string Indexer { get; set; }
public DateTime? Added { get; set; }
public bool IsTrackable { get; set; }
public TrackedDownload()
{
StatusMessages = System.Array.Empty<TrackedDownloadStatusMessage>();
StatusMessages = Array.Empty<TrackedDownloadStatusMessage>();
}
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);
trackedDownload.Indexer = grabbedEvent?.Data["indexer"];
trackedDownload.Added = grabbedEvent?.Date;
if (parsedAlbumInfo == null ||
trackedDownload.RemoteAlbum == null ||

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

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

@ -89,7 +89,8 @@ namespace NzbDrone.Core.Queue
DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name,
Indexer = trackedDownload.Indexer,
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}");

Loading…
Cancel
Save