Skip to content

Commit c2d8bc8

Browse files
Rubicjmynameisbogdan
authored andcommittedJan 16, 2024
New: Added column in Queue
(cherry picked from commit 57445bbe57a84990e284ef97d42455a06587e1ee) Closes #9621
1 parent 3e55b1c commit c2d8bc8

File tree

11 files changed

+36
-4
lines changed

11 files changed

+36
-4
lines changed
 

‎frontend/src/Activity/Queue/QueueRow.js

+11
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class QueueRow extends Component {
9797
outputPath,
9898
downloadClient,
9999
estimatedCompletionTime,
100+
added,
100101
timeleft,
101102
size,
102103
sizeleft,
@@ -315,6 +316,15 @@ class QueueRow extends Component {
315316
);
316317
}
317318

319+
if (name === 'added') {
320+
return (
321+
<RelativeDateCellConnector
322+
key={name}
323+
date={added}
324+
/>
325+
);
326+
}
327+
318328
if (name === 'actions') {
319329
return (
320330
<TableRowCell
@@ -393,6 +403,7 @@ QueueRow.propTypes = {
393403
outputPath: PropTypes.string,
394404
downloadClient: PropTypes.string,
395405
estimatedCompletionTime: PropTypes.string,
406+
added: PropTypes.string,
396407
timeleft: PropTypes.string,
397408
size: PropTypes.number,
398409
year: PropTypes.number,

‎frontend/src/Store/Actions/queueActions.js

+6
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ export const defaultState = {
147147
isSortable: true,
148148
isVisible: true
149149
},
150+
{
151+
name: 'added',
152+
label: () => translate('Added'),
153+
isSortable: true,
154+
isVisible: false
155+
},
150156
{
151157
name: 'progress',
152158
label: () => translate('Progress'),

‎frontend/src/typings/Queue.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ interface Queue extends ModelBase {
2828
sizeleft: number;
2929
timeleft: string;
3030
estimatedCompletionTime: string;
31+
added?: string;
3132
status: string;
3233
trackedDownloadStatus: QueueTrackedDownloadStatus;
3334
trackedDownloadState: QueueTrackedDownloadState;

‎src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
203203
RemoteMovie = pendingRelease.RemoteMovie,
204204
Timeleft = timeleft,
205205
EstimatedCompletionTime = ect,
206+
Added = pendingRelease.Added,
206207
Status = pendingRelease.Reason.ToString(),
207208
Protocol = pendingRelease.RemoteMovie.Release.DownloadProtocol,
208209
Indexer = pendingRelease.RemoteMovie.Release.Indexer

‎src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class TrackedDownload
1515
public TrackedDownloadStatusMessage[] StatusMessages { get; private set; }
1616
public DownloadProtocol Protocol { get; set; }
1717
public string Indexer { get; set; }
18+
public DateTime? Added { get; set; }
1819
public bool IsTrackable { get; set; }
1920
public bool HasNotifiedManualInteractionRequired { get; set; }
2021

‎src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
141141
var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == MovieHistoryEventType.Grabbed);
142142

143143
trackedDownload.Indexer = grabbedEvent?.Data["indexer"];
144+
trackedDownload.Added = grabbedEvent?.Date;
144145

145146
if (parsedMovieInfo == null ||
146147
trackedDownload.RemoteMovie == null ||

‎src/NzbDrone.Core/Queue/EstimatedCompletionTimeComparer.cs ‎src/NzbDrone.Core/Queue/DatetimeComparer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace NzbDrone.Core.Queue
55
{
6-
public class EstimatedCompletionTimeComparer : IComparer<DateTime?>
6+
public class DatetimeComparer : IComparer<DateTime?>
77
{
88
public int Compare(DateTime? x, DateTime? y)
99
{

‎src/NzbDrone.Core/Queue/Queue.cs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class Queue : ModelBase
2020
public decimal Sizeleft { get; set; }
2121
public TimeSpan? Timeleft { get; set; }
2222
public DateTime? EstimatedCompletionTime { get; set; }
23+
public DateTime? Added { get; set; }
2324
public string Status { get; set; }
2425
public TrackedDownloadStatus? TrackedDownloadStatus { get; set; }
2526
public TrackedDownloadState? TrackedDownloadState { get; set; }

‎src/NzbDrone.Core/Queue/QueueService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ private Queue MapMovie(TrackedDownload trackedDownload, Movie movie)
7575
Movie = movie,
7676
DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name,
7777
Indexer = trackedDownload.Indexer,
78-
OutputPath = trackedDownload.DownloadItem.OutputPath.ToString()
78+
OutputPath = trackedDownload.DownloadItem.OutputPath.ToString(),
79+
Added = trackedDownload.Added
7980
};
8081

8182
queue.Id = HashConverter.GetHashInt31($"trackedDownload-{trackedDownload.DownloadClient}-{trackedDownload.DownloadItem.DownloadId}");

‎src/Radarr.Api.V3/Queue/QueueController.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,16 @@ public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource
188188
else if (pagingSpec.SortKey == "estimatedCompletionTime")
189189
{
190190
ordered = ascending
191-
? fullQueue.OrderBy(q => q.EstimatedCompletionTime, new EstimatedCompletionTimeComparer())
191+
? fullQueue.OrderBy(q => q.EstimatedCompletionTime, new DatetimeComparer())
192192
: fullQueue.OrderByDescending(q => q.EstimatedCompletionTime,
193-
new EstimatedCompletionTimeComparer());
193+
new DatetimeComparer());
194+
}
195+
else if (pagingSpec.SortKey == "added")
196+
{
197+
ordered = ascending
198+
? fullQueue.OrderBy(q => q.Added, new DatetimeComparer())
199+
: fullQueue.OrderByDescending(q => q.Added,
200+
new DatetimeComparer());
194201
}
195202
else if (pagingSpec.SortKey == "protocol")
196203
{

‎src/Radarr.Api.V3/Queue/QueueResource.cs

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class QueueResource : RestResource
2525
public decimal Sizeleft { get; set; }
2626
public TimeSpan? Timeleft { get; set; }
2727
public DateTime? EstimatedCompletionTime { get; set; }
28+
public DateTime? Added { get; set; }
2829
public string Status { get; set; }
2930
public TrackedDownloadStatus? TrackedDownloadStatus { get; set; }
3031
public TrackedDownloadState? TrackedDownloadState { get; set; }
@@ -63,6 +64,7 @@ public static QueueResource ToResource(this NzbDrone.Core.Queue.Queue model, boo
6364
Sizeleft = model.Sizeleft,
6465
Timeleft = model.Timeleft,
6566
EstimatedCompletionTime = model.EstimatedCompletionTime,
67+
Added = model.Added,
6668
Status = model.Status.FirstCharToLower(),
6769
TrackedDownloadStatus = model.TrackedDownloadStatus,
6870
TrackedDownloadState = model.TrackedDownloadState,

0 commit comments

Comments
 (0)
Please sign in to comment.