1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-10 23:29:53 +02:00

Fixed: Sorting queue by columns

Sort allowed keys

Co-authored-by: Mark McDowall <markus.mcd5@gmail.com>
This commit is contained in:
Bogdan 2024-09-22 07:21:53 +03:00 committed by Mark McDowall
parent be4a9e9491
commit 30a52d11aa
6 changed files with 36 additions and 12 deletions

View File

@ -33,10 +33,10 @@ public PagingResource<BlocklistResource> GetBlocklist([FromQuery] PagingRequestR
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>( var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase) new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ {
"series.sortTitle",
"sourceTitle",
"date", "date",
"indexer" "indexer",
"series.sortTitle",
"sourceTitle"
}, },
"date", "date",
SortDirection.Descending); SortDirection.Descending);

View File

@ -68,8 +68,8 @@ public PagingResource<HistoryResource> GetHistory([FromQuery] PagingRequestResou
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, EpisodeHistory>( var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, EpisodeHistory>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase) new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ {
"series.sortTitle", "date",
"date" "series.sortTitle"
}, },
"date", "date",
SortDirection.Descending); SortDirection.Descending);

View File

@ -51,8 +51,8 @@ public PagingResource<ImportListExclusionResource> GetImportListExclusionsPaged(
new HashSet<string>(StringComparer.OrdinalIgnoreCase) new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ {
"id", "id",
"tvdbId", "title",
"title" "tvdbId"
}, },
"id", "id",
SortDirection.Descending); SortDirection.Descending);

View File

@ -139,7 +139,31 @@ public object RemoveMany([FromBody] QueueBulkResource resource, [FromQuery] bool
public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownSeriesItems = false, bool includeSeries = false, bool includeEpisode = false, [FromQuery] int[] seriesIds = null, DownloadProtocol? protocol = null, [FromQuery] int[] languages = null, int? quality = null) public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownSeriesItems = false, bool includeSeries = false, bool includeEpisode = false, [FromQuery] int[] seriesIds = null, DownloadProtocol? protocol = null, [FromQuery] int[] languages = null, int? quality = null)
{ {
var pagingResource = new PagingResource<QueueResource>(paging); var pagingResource = new PagingResource<QueueResource>(paging);
var pagingSpec = pagingResource.MapToPagingSpec<QueueResource, NzbDrone.Core.Queue.Queue>(null, "timeleft", SortDirection.Ascending); var pagingSpec = pagingResource.MapToPagingSpec<QueueResource, NzbDrone.Core.Queue.Queue>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"added",
"downloadClient",
"episode",
"episode.airDateUtc",
"episode.title",
"episodes.airDateUtc",
"episodes.title",
"estimatedCompletionTime",
"indexer",
"language",
"languages",
"progress",
"protocol",
"quality",
"series.sortTitle",
"size",
"status",
"timeleft",
"title"
},
"timeleft",
SortDirection.Ascending);
return pagingSpec.ApplyToPage((spec) => GetQueue(spec, seriesIds?.ToHashSet(), protocol, languages?.ToHashSet(), quality, includeUnknownSeriesItems), (q) => MapToResource(q, includeSeries, includeEpisode)); return pagingSpec.ApplyToPage((spec) => GetQueue(spec, seriesIds?.ToHashSet(), protocol, languages?.ToHashSet(), quality, includeUnknownSeriesItems), (q) => MapToResource(q, includeSeries, includeEpisode));
} }

View File

@ -36,9 +36,9 @@ public PagingResource<EpisodeResource> GetCutoffUnmetEpisodes([FromQuery] Paging
var pagingSpec = pagingResource.MapToPagingSpec<EpisodeResource, Episode>( var pagingSpec = pagingResource.MapToPagingSpec<EpisodeResource, Episode>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase) new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ {
"series.sortTitle",
"episodes.airDateUtc", "episodes.airDateUtc",
"episodes.lastSearchTime" "episodes.lastSearchTime",
"series.sortTitle"
}, },
"episodes.airDateUtc", "episodes.airDateUtc",
SortDirection.Ascending); SortDirection.Ascending);

View File

@ -32,9 +32,9 @@ public PagingResource<EpisodeResource> GetMissingEpisodes([FromQuery] PagingRequ
var pagingSpec = pagingResource.MapToPagingSpec<EpisodeResource, Episode>( var pagingSpec = pagingResource.MapToPagingSpec<EpisodeResource, Episode>(
new HashSet<string>(StringComparer.OrdinalIgnoreCase) new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ {
"series.sortTitle",
"episodes.airDateUtc", "episodes.airDateUtc",
"episodes.lastSearchTime" "episodes.lastSearchTime",
"series.sortTitle"
}, },
"episodes.airDateUtc", "episodes.airDateUtc",
SortDirection.Ascending); SortDirection.Ascending);