133 lines
5.0 KiB
Plaintext
133 lines
5.0 KiB
Plaintext
@namespace Oqtane.Modules.Admin.SystemInfo
|
|
@inherits ModuleBase
|
|
@inject ISystemService SystemService
|
|
@inject IInstallationService InstallationService
|
|
@inject IStringLocalizer<Index> Localizer
|
|
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td>
|
|
<Label For="version" HelpText="Framework Version" ResourceKey="FrameworkVersion">Framework Version: </Label>
|
|
</td>
|
|
<td>
|
|
<input id="version" class="form-control" @bind="@_version" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Label For="runtime" HelpText="Blazor Runtime (Server or WebAssembly)" ResourceKey="BlazorRuntime">Blazor Runtime: </Label>
|
|
</td>
|
|
<td>
|
|
<select id="runtime" class="form-control" @bind="@_runtime">
|
|
<option value="Server">@Localizer["Server"]</option>
|
|
<option value="WebAssembly">@Localizer["WebAssembly"]</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Label For="rendermode" HelpText="Blazor Server Render Mode" ResourceKey="RenderMode">Render Mode: </Label>
|
|
</td>
|
|
<td>
|
|
<select id="rendermode" class="form-control" @bind="@_rendermode">
|
|
<option value="Server">@Localizer["Server"]</option>
|
|
<option value="ServerPrerendered">@Localizer["ServerPrerendered"]</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Label For="clrversion" HelpText="Common Language Runtime Version" ResourceKey="ClrVerion">CLR Version: </Label>
|
|
</td>
|
|
<td>
|
|
<input id="clrversion" class="form-control" @bind="@_clrversion" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Label For="osversion" HelpText="Operating System Version" ResourceKey="OsVersion">OS Version: </Label>
|
|
</td>
|
|
<td>
|
|
<input id="osversion" class="form-control" @bind="@_osversion" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Label For="serverpath" HelpText="Server Path" ResourceKey="ServerPath">Server Path: </Label>
|
|
</td>
|
|
<td>
|
|
<input id="serverpath" class="form-control" @bind="@_serverpath" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Label For="servertime" HelpText="Server Time" ResourceKey="ServerTime">Server Time: </Label>
|
|
</td>
|
|
<td>
|
|
<input id="servertime" class="form-control" @bind="@_servertime" readonly />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<button type="button" class="btn btn-success" @onclick="SaveConfig">@Localizer["Save"]</button>
|
|
<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;
|
|
|
|
private string _version = string.Empty;
|
|
private string _runtime = string.Empty;
|
|
private string _rendermode = string.Empty;
|
|
private string _clrversion = string.Empty;
|
|
private string _osversion = string.Empty;
|
|
private string _serverpath = string.Empty;
|
|
private string _servertime = string.Empty;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
_version = Constants.Version;
|
|
_runtime = PageState.Runtime.ToString();
|
|
|
|
Dictionary<string, string> systeminfo = await SystemService.GetSystemInfoAsync();
|
|
if (systeminfo != null)
|
|
{
|
|
_rendermode = systeminfo["rendermode"];
|
|
_clrversion = systeminfo["clrversion"];
|
|
_osversion = systeminfo["osversion"];
|
|
_serverpath = systeminfo["serverpath"];
|
|
_servertime = systeminfo["servertime"];
|
|
}
|
|
}
|
|
|
|
private async Task SaveConfig()
|
|
{
|
|
try
|
|
{
|
|
var settings = new Dictionary<string, string>();
|
|
settings.Add("runtime", _runtime);
|
|
settings.Add("rendermode", _rendermode);
|
|
await SystemService.UpdateSystemInfoAsync(settings);
|
|
AddModuleMessage(Localizer["Configuration Updated. Please Select Restart Application For These Changes To Be Activated."], MessageType.Success);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await logger.LogError(ex, "Error Saving Configuration");
|
|
AddModuleMessage(Localizer["An Error Occurred Updating The Configuration"], MessageType.Error);
|
|
}
|
|
}
|
|
|
|
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");
|
|
}
|
|
}
|
|
} |