New: Show previously installed version in Updates UI

Co-Authored-By: Taloth <Taloth@users.noreply.github.com>
This commit is contained in:
Qstick
2021-01-24 23:33:54 -05:00
parent e3a4cd8b19
commit 86eeb3cc57
19 changed files with 374 additions and 11 deletions
+17 -1
View File
@@ -2,7 +2,9 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Update;
using NzbDrone.Core.Update.History;
using Prowlarr.Http;
namespace Prowlarr.Api.V1.Update
@@ -11,10 +13,12 @@ namespace Prowlarr.Api.V1.Update
public class UpdateController : Controller
{
private readonly IRecentUpdateProvider _recentUpdateProvider;
private readonly IUpdateHistoryService _updateHistoryService;
public UpdateController(IRecentUpdateProvider recentUpdateProvider)
public UpdateController(IRecentUpdateProvider recentUpdateProvider, IUpdateHistoryService updateHistoryService)
{
_recentUpdateProvider = recentUpdateProvider;
_updateHistoryService = updateHistoryService;
}
[HttpGet]
@@ -40,6 +44,18 @@ namespace Prowlarr.Api.V1.Update
{
installed.Installed = true;
}
var installDates = _updateHistoryService.InstalledSince(resources.Last().ReleaseDate)
.DistinctBy(v => v.Version)
.ToDictionary(v => v.Version);
foreach (var resource in resources)
{
if (installDates.TryGetValue(resource.Version, out var installDate))
{
resource.InstalledOn = installDate.Date;
}
}
}
return resources;