1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

Updating manually now uses a command so it shows progress

This commit is contained in:
Mark McDowall 2013-10-18 17:48:14 -07:00
parent e7780af212
commit aa26d68f18
5 changed files with 24 additions and 15 deletions

View File

@ -22,7 +22,6 @@ public UpdateModule(IRecentUpdateProvider recentUpdateProvider,
_recentUpdateProvider = recentUpdateProvider;
_installUpdateService = installUpdateService;
GetResourceAll = GetRecentUpdates;
Post["/"] = x=> InstallUpdate();
}
private List<UpdateResource> GetRecentUpdates()
@ -46,16 +45,6 @@ private List<UpdateResource> GetRecentUpdates()
return resources;
}
private Response InstallUpdate()
{
var updateResource = Request.Body.FromJson<UpdateResource>();
var updatePackage = updateResource.InjectTo<UpdatePackage>();
_installUpdateService.InstallUpdate(updatePackage);
return updateResource.AsResponse();
}
}
public class UpdateResource : RestResource

View File

@ -570,6 +570,7 @@
<Compile Include="Tv\SeriesStatusType.cs" />
<Compile Include="Tv\RefreshSeriesService.cs" />
<Compile Include="Update\Commands\ApplicationUpdateCommand.cs" />
<Compile Include="Update\Commands\InstallUpdateCommand.cs" />
<Compile Include="Update\InstallUpdateService.cs" />
<Compile Include="Update\RecentUpdateProvider.cs" />
<Compile Include="Update\UpdateChanges.cs" />

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.Update.Commands
{
public class InstallUpdateCommand : Command
{
public UpdatePackage UpdatePackage { get; set; }
}
}

View File

@ -16,7 +16,7 @@ public interface IInstallUpdates
void InstallUpdate(UpdatePackage updatePackage);
}
public class InstallUpdateService : IInstallUpdates, IExecute<ApplicationUpdateCommand>
public class InstallUpdateService : IInstallUpdates, IExecute<ApplicationUpdateCommand>, IExecute<InstallUpdateCommand>
{
private readonly ICheckUpdateService _checkUpdateService;
private readonly Logger _logger;
@ -89,5 +89,10 @@ public void Execute(ApplicationUpdateCommand message)
InstallUpdate(latestAvailable);
}
}
public void Execute(InstallUpdateCommand message)
{
InstallUpdate(message.UpdatePackage);
}
}
}

View File

@ -2,8 +2,9 @@
define(
[
'marionette'
], function (Marionette) {
'marionette',
'Commands/CommandController'
], function (Marionette, CommandController) {
return Marionette.ItemView.extend({
template: 'System/Update/UpdateItemViewTemplate',
@ -12,7 +13,7 @@ define(
},
_installUpdate: function () {
this.model.save();
CommandController.Execute('installUpdate', { updatePackage: this.model.toJSON() });
}
});
});