diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js
index 3f53870e55..514488babd 100644
--- a/frontend/src/Activity/Queue/QueueRow.js
+++ b/frontend/src/Activity/Queue/QueueRow.js
@@ -97,6 +97,7 @@ class QueueRow extends Component {
outputPath,
downloadClient,
estimatedCompletionTime,
+ added,
timeleft,
size,
sizeleft,
@@ -315,6 +316,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 c95350c71e..c5f7eb9624 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 035db0b2d0..c0bcd07ba9 100644
--- a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
+++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs
@@ -203,6 +203,7 @@ public List GetPendingRemoteMovies(int movieId)
RemoteMovie = pendingRelease.RemoteMovie,
Timeleft = timeleft,
EstimatedCompletionTime = ect,
+ Added = pendingRelease.Added,
Status = pendingRelease.Reason.ToString(),
Protocol = pendingRelease.RemoteMovie.Release.DownloadProtocol,
Indexer = pendingRelease.RemoteMovie.Release.Indexer
diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
index df6ea4280d..977461bf7b 100644
--- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
+++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs
@@ -15,6 +15,7 @@ public class TrackedDownload
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 4aaa4e9f3c..3c395484dd 100644
--- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
+++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs
@@ -141,6 +141,7 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == MovieHistoryEventType.Grabbed);
trackedDownload.Indexer = grabbedEvent?.Data["indexer"];
+ trackedDownload.Added = grabbedEvent?.Date;
if (parsedMovieInfo == null ||
trackedDownload.RemoteMovie == 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 e8c52e1ab8..e851d5a5f2 100644
--- a/src/NzbDrone.Core/Queue/EstimatedCompletionTimeComparer.cs
+++ b/src/NzbDrone.Core/Queue/DatetimeComparer.cs
@@ -3,7 +3,7 @@
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 22723bd632..08b8d46116 100644
--- a/src/NzbDrone.Core/Queue/Queue.cs
+++ b/src/NzbDrone.Core/Queue/Queue.cs
@@ -20,6 +20,7 @@ public class Queue : ModelBase
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 1cf48fa941..395f11a92f 100644
--- a/src/NzbDrone.Core/Queue/QueueService.cs
+++ b/src/NzbDrone.Core/Queue/QueueService.cs
@@ -75,7 +75,8 @@ private Queue MapMovie(TrackedDownload trackedDownload, Movie movie)
Movie = movie,
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}");
diff --git a/src/Radarr.Api.V3/Queue/QueueController.cs b/src/Radarr.Api.V3/Queue/QueueController.cs
index a2af425148..5e9b579aec 100644
--- a/src/Radarr.Api.V3/Queue/QueueController.cs
+++ b/src/Radarr.Api.V3/Queue/QueueController.cs
@@ -188,9 +188,16 @@ public PagingResource GetQueue([FromQuery] PagingRequestResource
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/Radarr.Api.V3/Queue/QueueResource.cs b/src/Radarr.Api.V3/Queue/QueueResource.cs
index d3b4c1ce55..2ba1ea5bda 100644
--- a/src/Radarr.Api.V3/Queue/QueueResource.cs
+++ b/src/Radarr.Api.V3/Queue/QueueResource.cs
@@ -25,6 +25,7 @@ public class QueueResource : RestResource
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; }
@@ -63,6 +64,7 @@ public static QueueResource ToResource(this NzbDrone.Core.Queue.Queue model, boo
Sizeleft = model.Sizeleft,
Timeleft = model.Timeleft,
EstimatedCompletionTime = model.EstimatedCompletionTime,
+ Added = model.Added,
Status = model.Status.FirstCharToLower(),
TrackedDownloadStatus = model.TrackedDownloadStatus,
TrackedDownloadState = model.TrackedDownloadState,