improve user experience by delegating application restart responsibility to the host user
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
@namespace Oqtane.Modules.Admin.SystemInfo
|
||||
@inherits ModuleBase
|
||||
@inject ISystemService SystemService
|
||||
@inject IInstallationService InstallationService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
@ -53,7 +54,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a class="btn btn-primary" href="swagger/index.html" target="_new">@Localizer["Access Framework API"]</a>
|
||||
<a class="btn btn-primary" href="swagger/index.html" target="_new">@Localizer["Access Framework API"]</a>
|
||||
<ActionDialog Header="Restart Application" Message="@("Are You Sure You Wish To Restart The Application?")" Action="Restart Application" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await RestartApplication())" ResourceKey="RestartApplication" />
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
@ -79,4 +81,19 @@
|
||||
_servertime = systeminfo["servertime"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RestartApplication()
|
||||
{
|
||||
try
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(""), 10);
|
||||
await InstallationService.RestartAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Restarting Application");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user