additional system info
This commit is contained in:
		| @ -4,98 +4,149 @@ | ||||
| @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.ApiFramework"]</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" /> | ||||
| <TabStrip> | ||||
|     <TabPanel Name="Info" Heading="Info" ResourceKey="Info"> | ||||
|         <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="clrversion" HelpText="Common Language Runtime Version" ResourceKey="CLRVersion">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> | ||||
|             <tr> | ||||
|                 <td> | ||||
|                     <Label For="installationid" HelpText="The Unique Identifier For Your Installation" ResourceKey="InstallationId">Installation ID: </Label> | ||||
|                 </td> | ||||
|                 <td> | ||||
|                     <input id="installationid" class="form-control" @bind="@_installationid" readonly /> | ||||
|                 </td> | ||||
|             </tr> | ||||
|         </table> | ||||
|         <a class="btn btn-primary" href="swagger/index.html" target="_new">@Localizer["Access.ApiFramework"]</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" /> | ||||
|     </TabPanel> | ||||
|     <TabPanel Name="Options" Heading="Options" ResourceKey="Options"> | ||||
|         <table class="table table-borderless"> | ||||
|             <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="detailederrors" HelpText="Specify If Detailed Errors Are Enabled For Blazor. This Option Should Not Not Be Enabled In Production." ResourceKey="DetailedErrors">Detailed Errors? </Label> | ||||
|                 </td> | ||||
|                 <td> | ||||
|                     <select id="detailederrors" class="form-control" @bind="@_detailederrors"> | ||||
|                         <option value="true">@Localizer["True"]</option> | ||||
|                         <option value="false">@Localizer["False"]</option> | ||||
|                     </select> | ||||
|                 </td> | ||||
|             </tr> | ||||
|             <tr> | ||||
|                 <td> | ||||
|                     <Label For="logginglevel" HelpText="The Minimum Logging Level For The Event Log. This Option Can Be Used To Control The Volume Of Items Stored In Your Event Log." ResourceKey="LoggingLevel">Logging Level: </Label> | ||||
|                 </td> | ||||
|                 <td> | ||||
|                     <select id="logginglevel" class="form-control" @bind="@_logginglevel"> | ||||
|                         <option value="Trace">@Localizer["Trace"]</option> | ||||
|                         <option value="Debug">@Localizer["Debug"]</option> | ||||
|                         <option value="Information">@Localizer["Information"]</option> | ||||
|                         <option value="Warning">@Localizer["Warning"]</option> | ||||
|                         <option value="Error">@Localizer["Error"]</option> | ||||
|                         <option value="Critical">@Localizer["Critical"]</option> | ||||
|                     </select> | ||||
|                 </td> | ||||
|             </tr> | ||||
|         </table> | ||||
|         <button type="button" class="btn btn-success" @onclick="SaveConfig">@Localizer["Save"]</button>  | ||||
|         <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" /> | ||||
|     </TabPanel> | ||||
| </TabStrip> | ||||
|  | ||||
| @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; | ||||
|     private string _installationid = string.Empty; | ||||
|  | ||||
|     private string _runtime = string.Empty; | ||||
|     private string _rendermode = string.Empty; | ||||
|     private string _detailederrors = string.Empty; | ||||
|     private string _logginglevel = 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"]; | ||||
|             _installationid = systeminfo["installationid"]; | ||||
|  | ||||
|             _runtime = systeminfo["runtime"]; | ||||
|             _rendermode = systeminfo["rendermode"]; | ||||
|             _detailederrors = systeminfo["detailederrors"]; | ||||
|             _logginglevel = systeminfo["logginglevel"]; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -106,6 +157,8 @@ | ||||
|             var settings = new Dictionary<string, string>(); | ||||
|             settings.Add("runtime", _runtime); | ||||
|             settings.Add("rendermode", _rendermode); | ||||
|             settings.Add("detailederrors", _detailederrors); | ||||
|             settings.Add("logginglevel", _logginglevel); | ||||
|             await SystemService.UpdateSystemInfoAsync(settings); | ||||
|             AddModuleMessage(Localizer["Success.UpdateConfig.Restart"], MessageType.Success); | ||||
|         } | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|     Microsoft ResX Schema  | ||||
| @ -123,13 +123,13 @@ | ||||
|   <data name="FrameworkVersion.HelpText" xml:space="preserve"> | ||||
|     <value>Framework Version</value> | ||||
|   </data> | ||||
|   <data name="BlazorRunime.HelpText" xml:space="preserve"> | ||||
|   <data name="BlazorRuntime.HelpText" xml:space="preserve"> | ||||
|     <value>Blazor Runtime (Server or WebAssembly)</value> | ||||
|   </data> | ||||
|   <data name="ClrVerion.HelpText" xml:space="preserve"> | ||||
|   <data name="CLRVersion.HelpText" xml:space="preserve"> | ||||
|     <value>Common Language Runtime Version</value> | ||||
|   </data> | ||||
|   <data name="OsVersion.HelpText" xml:space="preserve"> | ||||
|   <data name="OSVersion.HelpText" xml:space="preserve"> | ||||
|     <value>Operating System Version</value> | ||||
|   </data> | ||||
|   <data name="ServerPath.HelpText" xml:space="preserve"> | ||||
| @ -141,13 +141,13 @@ | ||||
|   <data name="FrameworkVersion.Text" xml:space="preserve"> | ||||
|     <value>Framework Version: </value> | ||||
|   </data> | ||||
|   <data name="BlazorRunime.Text" xml:space="preserve"> | ||||
|   <data name="BlazorRuntime.Text" xml:space="preserve"> | ||||
|     <value>Blazor Runtime: </value> | ||||
|   </data> | ||||
|   <data name="ClrVerion.Text" xml:space="preserve"> | ||||
|   <data name="CLRVersion.Text" xml:space="preserve"> | ||||
|     <value>CLR Version: </value> | ||||
|   </data> | ||||
|   <data name="OsVersion.Text" xml:space="preserve"> | ||||
|   <data name="OSVersion.Text" xml:space="preserve"> | ||||
|     <value>OS Version: </value> | ||||
|   </data> | ||||
|   <data name="ServerPath.Text" xml:space="preserve"> | ||||
| @ -180,4 +180,52 @@ | ||||
|   <data name="WebAssembly" xml:space="preserve"> | ||||
|     <value>WebAssembly</value> | ||||
|   </data> | ||||
|   <data name="InstallationId.Text" xml:space="preserve"> | ||||
|     <value>Installation ID: </value> | ||||
|   </data> | ||||
|   <data name="InstallationId.HelpText" xml:space="preserve"> | ||||
|     <value>The Unique Identifier For Your Installation</value> | ||||
|   </data> | ||||
|   <data name="DetailedErrors.Text" xml:space="preserve"> | ||||
|     <value>Detailed Errors? </value> | ||||
|   </data> | ||||
|   <data name="DetailedErrors.HelpText" xml:space="preserve"> | ||||
|     <value>Specify If Detailed Errors Are Enabled For Blazor. This Option Should Not Not Be Enabled In Production.</value> | ||||
|   </data> | ||||
|   <data name="True" xml:space="preserve"> | ||||
|     <value>True</value> | ||||
|   </data> | ||||
|   <data name="False" xml:space="preserve"> | ||||
|     <value>False</value> | ||||
|   </data> | ||||
|   <data name="LoggingLevel.Text" xml:space="preserve"> | ||||
|     <value>Logging Level: </value> | ||||
|   </data> | ||||
|   <data name="LoggingLevel.HelpText" xml:space="preserve"> | ||||
|     <value>The Minimum Logging Level For The Event Log. This Option Can Be Used To Control The Volume Of Items Stored In Your Event Log.</value> | ||||
|   </data> | ||||
|     <data name="Trace" xml:space="preserve"> | ||||
|     <value>Trace</value> | ||||
|   </data> | ||||
|     <data name="Debug" xml:space="preserve"> | ||||
|     <value>Debug</value> | ||||
|   </data> | ||||
|     <data name="Information" xml:space="preserve"> | ||||
|     <value>Information</value> | ||||
|   </data> | ||||
|     <data name="Warning" xml:space="preserve"> | ||||
|     <value>Warning</value> | ||||
|   </data> | ||||
|   <data name="Error" xml:space="preserve"> | ||||
|     <value>Error</value> | ||||
|   </data> | ||||
|   <data name="Critical" xml:space="preserve"> | ||||
|     <value>Critical</value> | ||||
|   </data> | ||||
|   <data name="Info" xml:space="preserve"> | ||||
|     <value>Info</value> | ||||
|   </data> | ||||
|   <data name="Options" xml:space="preserve"> | ||||
|     <value>Options</value> | ||||
|   </data> | ||||
| </root> | ||||
| @ -124,88 +124,4 @@ namespace Oqtane.Controllers | ||||
|             _installationManager.InstallPackages(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public partial class SearchResult | ||||
|     { | ||||
|         [JsonProperty("@context")] | ||||
|         public Context Context { get; set; } | ||||
|  | ||||
|         [JsonProperty("totalHits")] | ||||
|         public long TotalHits { get; set; } | ||||
|  | ||||
|         [JsonProperty("data")] | ||||
|         public Data[] Data { get; set; } | ||||
|     } | ||||
|  | ||||
|     public partial class Context | ||||
|     { | ||||
|         [JsonProperty("@vocab")] | ||||
|         public Uri Vocab { get; set; } | ||||
|  | ||||
|         [JsonProperty("@base")] | ||||
|         public Uri Base { get; set; } | ||||
|     } | ||||
|  | ||||
|     public partial class Data | ||||
|     { | ||||
|         [JsonProperty("@id")] | ||||
|         public Uri Url { get; set; } | ||||
|  | ||||
|         [JsonProperty("@type")] | ||||
|         public string Type { get; set; } | ||||
|  | ||||
|         [JsonProperty("registration")] | ||||
|         public Uri Registration { get; set; } | ||||
|  | ||||
|         [JsonProperty("id")] | ||||
|         public string Id { get; set; } | ||||
|  | ||||
|         [JsonProperty("version")] | ||||
|         public string Version { get; set; } | ||||
|  | ||||
|         [JsonProperty("description")] | ||||
|         public string Description { get; set; } | ||||
|  | ||||
|         [JsonProperty("summary")] | ||||
|         public string Summary { get; set; } | ||||
|  | ||||
|         [JsonProperty("title")] | ||||
|         public string Title { get; set; } | ||||
|  | ||||
|         [JsonProperty("iconUrl")] | ||||
|         public Uri IconUrl { get; set; } | ||||
|  | ||||
|         [JsonProperty("licenseUrl")] | ||||
|         public Uri LicenseUrl { get; set; } | ||||
|  | ||||
|         [JsonProperty("projectUrl")] | ||||
|         public Uri ProjectUrl { get; set; } | ||||
|  | ||||
|         [JsonProperty("tags")] | ||||
|         public string[] Tags { get; set; } | ||||
|  | ||||
|         [JsonProperty("authors")] | ||||
|         public string[] Authors { get; set; } | ||||
|  | ||||
|         [JsonProperty("totalDownloads")] | ||||
|         public long TotalDownloads { get; set; } | ||||
|  | ||||
|         [JsonProperty("verified")] | ||||
|         public bool Verified { get; set; } | ||||
|  | ||||
|         [JsonProperty("versions")] | ||||
|         public Version[] Versions { get; set; } | ||||
|     } | ||||
|  | ||||
|     public partial class Version | ||||
|     { | ||||
|         [JsonProperty("version")] | ||||
|         public string Number { get; set; } | ||||
|  | ||||
|         [JsonProperty("downloads")] | ||||
|         public long Downloads { get; set; } | ||||
|  | ||||
|         [JsonProperty("@id")] | ||||
|         public Uri Url { get; set; } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -27,12 +27,17 @@ namespace Oqtane.Controllers | ||||
|         { | ||||
|             Dictionary<string, string> systeminfo = new Dictionary<string, string>(); | ||||
|  | ||||
|             systeminfo.Add("rendermode", _configManager.GetSetting("RenderMode", "Server")); | ||||
|             systeminfo.Add("clrversion", Environment.Version.ToString()); | ||||
|             systeminfo.Add("osversion", Environment.OSVersion.ToString()); | ||||
|             systeminfo.Add("machinename", Environment.MachineName); | ||||
|             systeminfo.Add("serverpath", _environment.ContentRootPath); | ||||
|             systeminfo.Add("servertime", DateTime.Now.ToString()); | ||||
|             systeminfo.Add("installationid", GetInstallationId()); | ||||
|  | ||||
|             systeminfo.Add("runtime", _configManager.GetSetting("Runtime", "Server")); | ||||
|             systeminfo.Add("rendermode", _configManager.GetSetting("RenderMode", "ServerPrerendered")); | ||||
|             systeminfo.Add("detailederrors", _configManager.GetSetting("DetailedErrors", "false")); | ||||
|             systeminfo.Add("logginglevel", _configManager.GetSetting("Logging:LogLevel:Default", "Information")); | ||||
|  | ||||
|             return systeminfo; | ||||
|         } | ||||
| @ -51,9 +56,25 @@ namespace Oqtane.Controllers | ||||
|                     case "rendermode": | ||||
|                         _configManager.AddOrUpdateSetting("RenderMode", kvp.Value, false); | ||||
|                         break; | ||||
|                     case "detailederrors": | ||||
|                         _configManager.AddOrUpdateSetting("DetailedErrors", kvp.Value, false); | ||||
|                         break; | ||||
|                     case "logginglevel": | ||||
|                         _configManager.AddOrUpdateSetting("Logging:LogLevel:Default", kvp.Value, false); | ||||
|                         break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private string GetInstallationId() | ||||
|         { | ||||
|             var installationid = _configManager.GetSetting("InstallationId", ""); | ||||
|             if (installationid == "") | ||||
|             { | ||||
|                 installationid = Guid.NewGuid().ToString(); | ||||
|                 _configManager.AddOrUpdateSetting("InstallationId", installationid, true); | ||||
|             } | ||||
|             return installationid; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker