diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js
index 4c2829f55..4e3a0b380 100644
--- a/frontend/src/Activity/Queue/QueueRow.js
+++ b/frontend/src/Activity/Queue/QueueRow.js
@@ -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 (
+
+ );
+ }
+
if (name === 'actions') {
return (
translate('Added'),
+ isSortable: true,
+ isVisible: false
+ },
{
name: 'progress',
label: () => translate('Progress'),
diff --git a/frontend/src/typings/Queue.ts b/frontend/src/typings/Queue.ts
index c3e6f1e09..b758ef432 100644
--- a/frontend/src/typings/Queue.ts
+++ b/frontend/src/typings/Queue.ts
@@ -15,6 +15,7 @@ interface Queue extends ModelBase {
sizeleft: number;
timeleft: string;
estimatedCompletionTime: string;
+ added?: string;
status: string;
trackedDownloadStatus: string;
trackedDownloadState: string;
diff --git a/src/Lidarr.Api.V1/Queue/QueueController.cs b/src/Lidarr.Api.V1/Queue/QueueController.cs
index 4f827a40f..995a50060 100644
--- a/src/Lidarr.Api.V1/Queue/QueueController.cs
+++ b/src/Lidarr.Api.V1/Queue/QueueController.cs
@@ -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")
{
diff --git a/src/Lidarr.Api.V1/Queue/QueueResource.cs b/src/Lidarr.Api.V1/Queue/QueueResource.cs
index f169db8be..8c0777b86 100644
--- a/src/Lidarr.Api.V1/Queue/QueueResource.cs
+++ b/src/Lidarr.Api.V1/Queue/QueueResource.cs
@@ -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,
diff --git a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
index f4897608a..c46f2186e 100644
--- a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
+++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
@@ -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
diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
index e12949bd1..d4b4cfe20 100644
--- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
+++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
@@ -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();
+ StatusMessages = Array.Empty();
}
public void Warn(string message, params object[] args)
diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
index 5c397349f..eed5d5405 100644
--- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
+++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
@@ -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 ||
diff --git a/src/NzbDrone.Core/Queue/EstimatedCompletionTimeComparer.cs b/src/NzbDrone.Core/Queue/DatetimeComparer.cs
similarity index 90%
rename from src/NzbDrone.Core/Queue/EstimatedCompletionTimeComparer.cs
rename to src/NzbDrone.Core/Queue/DatetimeComparer.cs
index e8c52e1ab..e851d5a5f 100644
--- a/src/NzbDrone.Core/Queue/EstimatedCompletionTimeComparer.cs
+++ b/src/NzbDrone.Core/Queue/DatetimeComparer.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace NzbDrone.Core.Queue
{
- public class EstimatedCompletionTimeComparer : IComparer
+ public class DatetimeComparer : IComparer
{
public int Compare(DateTime? x, DateTime? y)
{
diff --git a/src/NzbDrone.Core/Queue/Queue.cs b/src/NzbDrone.Core/Queue/Queue.cs
index e8e994b37..a3c8e69be 100644
--- a/src/NzbDrone.Core/Queue/Queue.cs
+++ b/src/NzbDrone.Core/Queue/Queue.cs
@@ -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; }
diff --git a/src/NzbDrone.Core/Queue/QueueService.cs b/src/NzbDrone.Core/Queue/QueueService.cs
index 855a9371b..6d0931fab 100644
--- a/src/NzbDrone.Core/Queue/QueueService.cs
+++ b/src/NzbDrone.Core/Queue/QueueService.cs
@@ -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}");