From 3381ffc311f10029d387b84ee356390b682f0bcb Mon Sep 17 00:00:00 2001 From: ManiMatter <124743318+ManiMatter@users.noreply.github.com> Date: Wed, 2 Oct 2024 21:52:27 +0200 Subject: [PATCH] New: Last Searched column on Wanted screens (#5084) * Added lastSearchTime to API & Wanted Screens. --- frontend/src/Album/Album.ts | 1 + frontend/src/Store/Actions/wantedActions.js | 12 ++++++++++++ .../src/Wanted/CutoffUnmet/CutoffUnmetConnector.js | 6 ++++-- frontend/src/Wanted/CutoffUnmet/CutoffUnmetRow.js | 11 +++++++++++ frontend/src/Wanted/Missing/MissingConnector.js | 6 ++++-- frontend/src/Wanted/Missing/MissingRow.js | 11 +++++++++++ src/Lidarr.Api.V1/Albums/AlbumResource.cs | 4 +++- src/NzbDrone.Core/Localization/Core/en.json | 1 + 8 files changed, 47 insertions(+), 5 deletions(-) diff --git a/frontend/src/Album/Album.ts b/frontend/src/Album/Album.ts index 7a645efee..86f1ed5fe 100644 --- a/frontend/src/Album/Album.ts +++ b/frontend/src/Album/Album.ts @@ -20,6 +20,7 @@ interface Album extends ModelBase { monitored: boolean; releaseDate: string; statistics: Statistics; + lastSearchTime?: string; isSaving?: boolean; } diff --git a/frontend/src/Store/Actions/wantedActions.js b/frontend/src/Store/Actions/wantedActions.js index 35aa162d4..61d6f7752 100644 --- a/frontend/src/Store/Actions/wantedActions.js +++ b/frontend/src/Store/Actions/wantedActions.js @@ -52,6 +52,12 @@ export const defaultState = { isSortable: true, isVisible: true }, + { + name: 'albums.lastSearchTime', + label: () => translate('LastSearched'), + isSortable: true, + isVisible: false + }, // { // name: 'status', // label: 'Status', @@ -131,6 +137,12 @@ export const defaultState = { // label: 'Status', // isVisible: true // }, + { + name: 'albums.lastSearchTime', + label: () => translate('LastSearched'), + isSortable: true, + isVisible: false + }, { name: 'actions', columnLabel: () => translate('Actions'), diff --git a/frontend/src/Wanted/CutoffUnmet/CutoffUnmetConnector.js b/frontend/src/Wanted/CutoffUnmet/CutoffUnmetConnector.js index dbb4f2235..1dd9870d1 100644 --- a/frontend/src/Wanted/CutoffUnmet/CutoffUnmetConnector.js +++ b/frontend/src/Wanted/CutoffUnmet/CutoffUnmetConnector.js @@ -131,13 +131,15 @@ class CutoffUnmetConnector extends Component { onSearchSelectedPress = (selected) => { this.props.executeCommand({ name: commandNames.ALBUM_SEARCH, - albumIds: selected + albumIds: selected, + commandFinished: this.repopulate }); }; onSearchAllCutoffUnmetPress = () => { this.props.executeCommand({ - name: commandNames.CUTOFF_UNMET_ALBUM_SEARCH + name: commandNames.CUTOFF_UNMET_ALBUM_SEARCH, + commandFinished: this.repopulate }); }; diff --git a/frontend/src/Wanted/CutoffUnmet/CutoffUnmetRow.js b/frontend/src/Wanted/CutoffUnmet/CutoffUnmetRow.js index 785b9b1c1..452e2947a 100644 --- a/frontend/src/Wanted/CutoffUnmet/CutoffUnmetRow.js +++ b/frontend/src/Wanted/CutoffUnmet/CutoffUnmetRow.js @@ -20,6 +20,7 @@ function CutoffUnmetRow(props) { foreignAlbumId, albumType, title, + lastSearchTime, disambiguation, isSelected, columns, @@ -89,6 +90,15 @@ function CutoffUnmetRow(props) { ); } + if (name === 'albums.lastSearchTime') { + return ( + + ); + } + if (name === 'status') { return ( { this.props.executeCommand({ name: commandNames.ALBUM_SEARCH, - albumIds: selected + albumIds: selected, + commandFinished: this.repopulate }); }; onSearchAllMissingPress = () => { this.props.executeCommand({ - name: commandNames.MISSING_ALBUM_SEARCH + name: commandNames.MISSING_ALBUM_SEARCH, + commandFinished: this.repopulate }); }; diff --git a/frontend/src/Wanted/Missing/MissingRow.js b/frontend/src/Wanted/Missing/MissingRow.js index 0eb1a0452..6c0b5a0c6 100644 --- a/frontend/src/Wanted/Missing/MissingRow.js +++ b/frontend/src/Wanted/Missing/MissingRow.js @@ -17,6 +17,7 @@ function MissingRow(props) { albumType, foreignAlbumId, title, + lastSearchTime, disambiguation, isSelected, columns, @@ -86,6 +87,15 @@ function MissingRow(props) { ); } + if (name === 'albums.lastSearchTime') { + return ( + + ); + } + if (name === 'actions') { return ( Images { get; set; } public List Links { get; set; } + public DateTime? LastSearchTime { get; set; } public AlbumStatisticsResource Statistics { get; set; } public AddAlbumOptions AddOptions { get; set; } public string RemoteCover { get; set; } @@ -86,7 +87,8 @@ namespace Lidarr.Api.V1.Albums SecondaryTypes = model.SecondaryTypes.Select(s => s.Name).ToList(), Releases = model.AlbumReleases?.Value.ToResource() ?? new List(), Media = selectedRelease?.Media.ToResource() ?? new List(), - Artist = model.Artist?.Value.ToResource() + Artist = model.Artist?.Value.ToResource(), + LastSearchTime = model.LastSearchTime }; } diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 56ce142b4..4280a6933 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -646,6 +646,7 @@ "LastAlbum": "Last Album", "LastDuration": "Last Duration", "LastExecution": "Last Execution", + "LastSearched": "Last Searched", "LastUsed": "Last Used", "LastWriteTime": "Last Write Time", "LatestAlbum": "Latest Album",