mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
UI: Fix cancel plugin command (#3903)
* UI: Fix cancel plugin command As installing a plugin also adds the delete/uninstall command, we just select the last action, which is the one the user triggered. Fixes #3890. * Apply suggestions from code review https://stackoverflow.com/questions/50100688/check-if-value-tuple-is-default
This commit is contained in:
@@ -66,6 +66,7 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
return RedirectToAction("ListPlugins");
|
return RedirectToAction("ListPlugins");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("server/plugins/cancel")]
|
[HttpPost("server/plugins/cancel")]
|
||||||
public IActionResult CancelPluginCommands(
|
public IActionResult CancelPluginCommands(
|
||||||
[FromServices] PluginService pluginService, string plugin)
|
[FromServices] PluginService pluginService, string plugin)
|
||||||
@@ -93,7 +94,6 @@ namespace BTCPayServer.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
pluginService.InstallPlugin(plugin);
|
pluginService.InstallPlugin(plugin);
|
||||||
}
|
}
|
||||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||||
|
|||||||
@@ -291,20 +291,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@{
|
|
||||||
var pending = Model.Commands.Any(tuple => tuple.plugin.Equals(plugin.Identifier, StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
var pluginCommands = Model.Commands.GroupBy(tuple => tuple.plugin.Equals(plugin.Identifier, StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
}
|
|
||||||
<div class="card-footer border-0 pb-3">
|
<div class="card-footer border-0 pb-3">
|
||||||
@if (pending)
|
@{ var pending = Model.Commands.LastOrDefault(tuple => tuple.plugin.Equals(plugin.Identifier, StringComparison.InvariantCultureIgnoreCase)); }
|
||||||
|
@if (!pending.Equals(default))
|
||||||
{
|
{
|
||||||
@foreach (var command in pluginCommands)
|
<form asp-action="CancelPluginCommands" asp-route-plugin="@plugin.Identifier">
|
||||||
{
|
<button type="submit" class="btn btn-outline-secondary">Cancel pending @pending.command</button>
|
||||||
|
</form>
|
||||||
<form asp-action="CancelPluginCommands" asp-route-plugin="@plugin.Identifier">
|
|
||||||
<button type="submit" class="btn btn-outline-secondary">Cancel pending @command.Last().command</button>
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (DependenciesMet(plugin.Dependencies))
|
else if (DependenciesMet(plugin.Dependencies))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user