diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js
index 1fab52bd9..95ff2527e 100644
--- a/frontend/src/Activity/Queue/QueueRow.js
+++ b/frontend/src/Activity/Queue/QueueRow.js
@@ -100,6 +100,7 @@ class QueueRow extends Component {
outputPath,
downloadClient,
estimatedCompletionTime,
+ added,
timeleft,
size,
sizeleft,
@@ -362,6 +363,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 855173306..8fe114489 100644
--- a/frontend/src/typings/Queue.ts
+++ b/frontend/src/typings/Queue.ts
@@ -28,6 +28,7 @@ interface Queue extends ModelBase {
sizeleft: number;
timeleft: string;
estimatedCompletionTime: string;
+ added?: string;
status: string;
trackedDownloadStatus: QueueTrackedDownloadStatus;
trackedDownloadState: QueueTrackedDownloadState;
diff --git a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
index c4d862fca..6f16dfe3a 100644
--- a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
+++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
@@ -368,6 +368,7 @@ namespace NzbDrone.Core.Download.Pending
RemoteEpisode = pendingRelease.RemoteEpisode,
Timeleft = timeleft,
EstimatedCompletionTime = ect,
+ Added = pendingRelease.Added,
Status = pendingRelease.Reason.ToString(),
Protocol = pendingRelease.RemoteEpisode.Release.DownloadProtocol,
Indexer = pendingRelease.RemoteEpisode.Release.Indexer
diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
index 0b20d3f6f..05c25db81 100644
--- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
+++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
@@ -15,6 +15,7 @@ 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 bool HasNotifiedManualInteractionRequired { get; set; }
diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
index da0658895..bab0a35f9 100644
--- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
+++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
@@ -135,6 +135,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == EpisodeHistoryEventType.Grabbed);
trackedDownload.Indexer = grabbedEvent?.Data["indexer"];
+ trackedDownload.Added = grabbedEvent?.Date;
if (parsedEpisodeInfo == null ||
trackedDownload.RemoteEpisode == 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 da94f8911..15ff7948a 100644
--- a/src/NzbDrone.Core/Queue/Queue.cs
+++ b/src/NzbDrone.Core/Queue/Queue.cs
@@ -21,6 +21,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 abd0742ad..6b4aadb4c 100644
--- a/src/NzbDrone.Core/Queue/QueueService.cs
+++ b/src/NzbDrone.Core/Queue/QueueService.cs
@@ -79,7 +79,8 @@ namespace NzbDrone.Core.Queue
Protocol = trackedDownload.Protocol,
DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name,
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}");
diff --git a/src/Sonarr.Api.V3/Queue/QueueController.cs b/src/Sonarr.Api.V3/Queue/QueueController.cs
index c3e4c1d52..744fedda3 100644
--- a/src/Sonarr.Api.V3/Queue/QueueController.cs
+++ b/src/Sonarr.Api.V3/Queue/QueueController.cs
@@ -193,9 +193,16 @@ namespace Sonarr.Api.V3.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/Sonarr.Api.V3/Queue/QueueResource.cs b/src/Sonarr.Api.V3/Queue/QueueResource.cs
index e56ee2511..6aaf3b1ed 100644
--- a/src/Sonarr.Api.V3/Queue/QueueResource.cs
+++ b/src/Sonarr.Api.V3/Queue/QueueResource.cs
@@ -29,6 +29,7 @@ namespace Sonarr.Api.V3.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; }
@@ -71,6 +72,7 @@ namespace Sonarr.Api.V3.Queue
Sizeleft = model.Sizeleft,
Timeleft = model.Timeleft,
EstimatedCompletionTime = model.EstimatedCompletionTime,
+ Added = model.Added,
Status = model.Status.FirstCharToLower(),
TrackedDownloadStatus = model.TrackedDownloadStatus,
TrackedDownloadState = model.TrackedDownloadState,