Updating manually now uses a command so it shows progress

pull/3113/head
Mark McDowall 11 years ago
parent e7780af212
commit aa26d68f18

@ -22,7 +22,6 @@ namespace NzbDrone.Api.Update
_recentUpdateProvider = recentUpdateProvider;
_installUpdateService = installUpdateService;
GetResourceAll = GetRecentUpdates;
Post["/"] = x=> InstallUpdate();
}
private List<UpdateResource> GetRecentUpdates()
@ -46,16 +45,6 @@ namespace NzbDrone.Api.Update
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

@ -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" />

@ -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; }
}
}

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Update
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 @@ namespace NzbDrone.Core.Update
InstallUpdate(latestAvailable);
}
}
public void Execute(InstallUpdateCommand message)
{
InstallUpdate(message.UpdatePackage);
}
}
}

@ -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() });
}
});
});

Loading…
Cancel
Save