From ba310fe66b85176c0ba1cae871f4c4812cb0104e Mon Sep 17 00:00:00 2001 From: ta264 Date: Sun, 28 Jul 2019 13:43:14 +0100 Subject: [PATCH] New: Sort import list groups --- .../ImportLists/AddImportListModalContentConnector.js | 5 ++++- src/Lidarr.Api.V1/ImportLists/ImportListResource.cs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/Settings/ImportLists/ImportLists/AddImportListModalContentConnector.js b/frontend/src/Settings/ImportLists/ImportLists/AddImportListModalContentConnector.js index 1273035b1..e464ccb93 100644 --- a/frontend/src/Settings/ImportLists/ImportLists/AddImportListModalContentConnector.js +++ b/frontend/src/Settings/ImportLists/ImportLists/AddImportListModalContentConnector.js @@ -17,7 +17,10 @@ function createMapStateToProps() { schema } = importLists; - const listGroups = _.groupBy(schema, 'listType'); + const listGroups = _.chain(schema) + .sortBy((o) => o.listOrder) + .groupBy('listType') + .value(); return { isSchemaFetching, diff --git a/src/Lidarr.Api.V1/ImportLists/ImportListResource.cs b/src/Lidarr.Api.V1/ImportLists/ImportListResource.cs index f1a5f4fab..d5844824f 100644 --- a/src/Lidarr.Api.V1/ImportLists/ImportListResource.cs +++ b/src/Lidarr.Api.V1/ImportLists/ImportListResource.cs @@ -11,6 +11,7 @@ namespace Lidarr.Api.V1.ImportLists public int LanguageProfileId { get; set; } public int MetadataProfileId { get; set; } public ImportListType ListType { get; set; } + public int ListOrder { get; set; } } public class ImportListResourceMapper : ProviderResourceMapper @@ -31,6 +32,7 @@ namespace Lidarr.Api.V1.ImportLists resource.LanguageProfileId = definition.LanguageProfileId; resource.MetadataProfileId = definition.MetadataProfileId; resource.ListType = definition.ListType; + resource.ListOrder = (int) definition.ListType; return resource; }